Debian Codegraph @

source/code/ScoresDisplay.hpp

raw symbols SCIP
1 /*
2 ===========================================================================
3 blockattack - Block Attack - Rise of the Blocks
4 Copyright (C) 2005-2016 Poul Sander
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see http://www.gnu.org/licenses/
18
19 Source information and contacts persons can be found at
20 http://www.blockattack.net
21 ===========================================================================
22 */
23
24 #ifndef SCORESDISPLAY_HPP
25 #define SCORESDISPLAY_HPP
26
27 #include "HelpCommon.hpp"
28 #include "sago/SagoTextField.hpp"
29 #include <map>
30 #include <memory>
31 #include "highscore.h"
32
33 class ScoresDisplay : public HelpCommonState {
34 public:
35 ScoresDisplay();
36 ScoresDisplay(const ScoresDisplay& orig) = delete;
37 virtual ~ScoresDisplay();
38
39 void Draw(SDL_Renderer* target) override;
40 void ProcessInput(const SDL_Event& event, bool& processed) override;
41 void Update() override;
42
43 int page = 0;
44 //button coodinates:
45 int scoreX = 0;
46 int scoreY = 0;
47 int buttonXsize = 0;
48 int buttonYsize = 0;
49 Highscore theTopScoresEndless0 = Highscore("endless", 0.5); //Stores highscores for endless
50 Highscore theTopScoresEndless1 = Highscore("endless", 0.1); //Stores highscores for endless
51 Highscore theTopScoresEndless2 = Highscore("endless", 0.07); //Stores highscores for endless
52 Highscore theTopScoresEndless3 = Highscore("endless", 0.04); //Stores highscores for endless
53 Highscore theTopScoresEndless4 = Highscore("endless", 0.015); //Stores highscores for endless
54 Highscore theTopScoresTimeTrial = Highscore("timetrial", 0.5); //Stores highscores for timetrial
55 // 5 variant
56 Highscore theTopScoresEndless0_5 = Highscore("endless_block5", 0.5); //Stores highscores for endless
57 Highscore theTopScoresEndless1_5 = Highscore("endless_block5", 0.1); //Stores highscores for endless
58 Highscore theTopScoresEndless2_5 = Highscore("endless_block5", 0.07); //Stores highscores for endless
59 Highscore theTopScoresEndless3_5 = Highscore("endless_block5", 0.04); //Stores highscores for endless
60 Highscore theTopScoresEndless4_5 = Highscore("endless_block5", 0.015); //Stores highscores for endless
61 Highscore theTopScoresTimeTrial_5 = Highscore("timetrial_block5", 0.5); //Stores highscores for timetrial
62 private:
63 void DrawHighscores(int x, int y, bool endless, int speedLevel);
64 void DrawStats();
65 void DrawBackgroundAndCalcPlacements();
66 void Write(SDL_Renderer* target, int x, int y, const char* text);
67 void Write(SDL_Renderer* target, int x, int y, const std::string& text);
68 sago::SagoTextField* getCachedText(const std::string& text);
69 std::map<std::string, std::shared_ptr<sago::SagoTextField> > fieldCache;
70 bool bMouseUp = false;
71 int backX = 20;
72 int backY = 0;
73 int nextX = 0;
74 int nextY = 0;
75 };
76
77 #endif /* SCORESDISPLAY_HPP */
78