Debian Codegraph @

src/game/menu/help.cpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2015 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #include "help.hpp"
17 #include "../common/config.hpp"
18 #include "renderer.hpp"
19
20 #include <MCTextureText>
21 #include <QObject> // For QObject::tr()
22
23 Help::Help(std::string id, int width, int height)
24 : SurfaceMenu("helpBack", id, width, height, Menu::Style::VerticalList, true)
25 {
26 }
27
28 void Help::render()
29 {
30 static MCTextureText HELP_TEXT(
31 (QObject::tr("GAME GOAL\n\n"
32 "You are racing against eleven\ncomputer players.\n\n"
33 "Your best position will be\nthe next start position.\n\n"
34 "Finish in TOP-6 to unlock\na new race track!\n\n"
35 "CONTROLS FOR PLAYER 1\n\n"
36 "Turn left : Left\n"
37 "Turn right : Right\n"
38 "Accelerate : Up / RIGHT SHIFT\n"
39 "Brake : Down / RIGHT CTRL\n\n"
40 "CONTROLS FOR PLAYER 2\n\n"
41 "Turn left : A\n"
42 "Turn right : D\n"
43 "Accelerate : W / LEFT SHIFT\n"
44 "Brake : S / LEFT CTRL\n\n"
45 "Quit : ESC/Q\n"
46 "Pause : P")
47 + "\n\n" + Config::General::WEB_SITE_URL)
48 .toStdWString());
49
50 SurfaceMenu::render();
51
52 HELP_TEXT.setGlyphSize(20, 20 * height() / 640);
53 HELP_TEXT.render(
54 x() + width() / 2 - HELP_TEXT.width(font()) / 2,
55 y() + height() / 2 + HELP_TEXT.height(font()) / 2, nullptr, font());
56 }