git repos / blockattack-game

blame: source/code/ScoresDisplay.hpp

normal view · raw

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