git repos / blockattack-game

blame: source/code/ScoresDisplay.cpp

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
c3b697c6 sago007 2016-02-07 17:30 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
#include "ScoresDisplay.hpp"
c3b697c6 sago007 2016-02-07 17:30 25
#include "global.hpp"
c3b697c6 sago007 2016-02-07 17:30 26
#include "common.h"
c3b697c6 sago007 2016-02-07 17:30 27
#include "stats.h"
d21782d4 sago007 2016-03-13 11:17 28
#include "MenuSystem.h"
c3b697c6 sago007 2016-02-07 17:30 29
d2ba3cf5 sago007 2018-05-13 15:00 30
static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
34ab7861 sago007 2018-03-28 14:47 31
	field.SetHolder(holder);
34ab7861 sago007 2018-03-28 14:47 32
	field.SetFont("freeserif");
34ab7861 sago007 2018-03-28 14:47 33
	field.SetColor({255,255,255,255});
34ab7861 sago007 2018-03-28 14:47 34
	field.SetFontSize(24);
d8fe60bd sago007 2018-04-02 16:15 35
	field.SetOutline(1, {128,128,128,255});
34ab7861 sago007 2018-03-28 14:47 36
	field.SetText(text);
34ab7861 sago007 2018-03-28 14:47 37
}
e1b2e653 sago007 2017-11-28 18:10 38
69d8f1dc sago007 2018-03-31 16:19 39
sago::SagoTextField* ScoresDisplay::getCachedText(const std::string& text) {
69d8f1dc sago007 2018-03-31 16:19 40
	std::shared_ptr<sago::SagoTextField> ptr = fieldCache[text];
69d8f1dc sago007 2018-03-31 16:19 41
	if (!ptr) {
69d8f1dc sago007 2018-03-31 16:19 42
		std::shared_ptr<sago::SagoTextField> newText = std::make_shared<sago::SagoTextField>();
69d8f1dc sago007 2018-03-31 16:19 43
		sagoTextSetBlueFont(*newText.get());
0b8fb137 sago007 2018-03-31 19:53 44
		newText->SetText(text);
69d8f1dc sago007 2018-03-31 16:19 45
		fieldCache[text] = newText;
69d8f1dc sago007 2018-03-31 16:19 46
	}
69d8f1dc sago007 2018-03-31 16:19 47
	return fieldCache[text].get();
69d8f1dc sago007 2018-03-31 16:19 48
}
69d8f1dc sago007 2018-03-31 16:19 49
69d8f1dc sago007 2018-03-31 16:19 50
void ScoresDisplay::Write(SDL_Renderer* target, int x, int y, const char* text) {
69d8f1dc sago007 2018-03-31 16:19 51
	getCachedText(text)->Draw(target, x, y);
c3b697c6 sago007 2016-02-07 17:30 52
}
c3b697c6 sago007 2016-02-07 17:30 53
79d552fa sago007 2019-02-12 17:17 54
const int numberOfPages = 7;
c3b697c6 sago007 2016-02-07 17:30 55
13476fc2 sago007 2016-09-28 18:34 56
void ScoresDisplay::DrawBackgroundAndCalcPlacements() {
72383a9e sago007 2016-10-30 11:56 57
	DrawBackground(globalData.screen);
72383a9e sago007 2016-10-30 11:56 58
	nextX = globalData.xsize-buttonXsize-20;
72383a9e sago007 2016-10-30 11:56 59
	backY = globalData.ysize-buttonYsize-20;
13476fc2 sago007 2016-09-28 18:34 60
	nextY = backY;
13476fc2 sago007 2016-09-28 18:34 61
}
13476fc2 sago007 2016-09-28 18:34 62
c3b697c6 sago007 2016-02-07 17:30 63
//Draws the highscores
79d552fa sago007 2019-02-12 17:17 64
void ScoresDisplay::DrawHighscores(int x, int y, bool endless, int level = 0) {
13476fc2 sago007 2016-09-28 18:34 65
	DrawBackgroundAndCalcPlacements();
c3b697c6 sago007 2016-02-07 17:30 66
	if (endless) {
47515b6a Poul Sander 2019-02-13 18:16 67
		std::string header;
47515b6a Poul Sander 2019-02-13 18:16 68
		switch (level) {
47515b6a Poul Sander 2019-02-13 18:16 69
			case 1:
47515b6a Poul Sander 2019-02-13 18:16 70
				header = _("Endless (Fast):");
47515b6a Poul Sander 2019-02-13 18:16 71
				break;
47515b6a Poul Sander 2019-02-13 18:16 72
			case 2:
47515b6a Poul Sander 2019-02-13 18:16 73
				header = _("Endless (Faster):");
47515b6a Poul Sander 2019-02-13 18:16 74
				break;
47515b6a Poul Sander 2019-02-13 18:16 75
			case 3:
47515b6a Poul Sander 2019-02-13 18:16 76
				header = _("Endless (Even faster):");
47515b6a Poul Sander 2019-02-13 18:16 77
				break;
47515b6a Poul Sander 2019-02-13 18:16 78
			case 4:
47515b6a Poul Sander 2019-02-13 18:16 79
				header = _("Endless (Fastest):");
47515b6a Poul Sander 2019-02-13 18:16 80
				break;
47515b6a Poul Sander 2019-02-13 18:16 81
			default:
47515b6a Poul Sander 2019-02-13 18:16 82
				header = _("Endless:");
47515b6a Poul Sander 2019-02-13 18:16 83
		};
79d552fa sago007 2019-02-12 17:17 84
		Write(globalData.screen, x+100,y+100, header.c_str() );
c3b697c6 sago007 2016-02-07 17:30 85
	}
c3b697c6 sago007 2016-02-07 17:30 86
	else {
69d8f1dc sago007 2018-03-31 16:19 87
		Write(globalData.screen, x+100,y+100, _("Time Trial:") );
c3b697c6 sago007 2016-02-07 17:30 88
	}
c3b697c6 sago007 2016-02-07 17:30 89
	for (int i =0; i<10; i++) {
7a956470 sago007 2016-02-14 17:09 90
		record r;
c3b697c6 sago007 2016-02-07 17:30 91
		if (endless) {
79d552fa sago007 2019-02-12 17:17 92
			switch(level) {
79d552fa sago007 2019-02-12 17:17 93
				case 1:
79d552fa sago007 2019-02-12 17:17 94
					r = theTopScoresEndless1.getScoreNumber(i);
79d552fa sago007 2019-02-12 17:17 95
					break;
79d552fa sago007 2019-02-12 17:17 96
				case 2:
79d552fa sago007 2019-02-12 17:17 97
					r = theTopScoresEndless2.getScoreNumber(i);
79d552fa sago007 2019-02-12 17:17 98
					break;
79d552fa sago007 2019-02-12 17:17 99
				case 3:
79d552fa sago007 2019-02-12 17:17 100
					r = theTopScoresEndless3.getScoreNumber(i);
79d552fa sago007 2019-02-12 17:17 101
					break;
79d552fa sago007 2019-02-12 17:17 102
				case 4:
79d552fa sago007 2019-02-12 17:17 103
					r = theTopScoresEndless4.getScoreNumber(i);
79d552fa sago007 2019-02-12 17:17 104
					break;
79d552fa sago007 2019-02-12 17:17 105
				default:
79d552fa sago007 2019-02-12 17:17 106
					r = theTopScoresEndless0.getScoreNumber(i);
79d552fa sago007 2019-02-12 17:17 107
			}
c3b697c6 sago007 2016-02-07 17:30 108
		}
c3b697c6 sago007 2016-02-07 17:30 109
		else {
905de2a2 sago007 2019-02-08 18:46 110
			r = theTopScoresTimeTrial.getScoreNumber(i);
c3b697c6 sago007 2016-02-07 17:30 111
		}
7a956470 sago007 2016-02-14 17:09 112
		char playerScore[32];
7a956470 sago007 2016-02-14 17:09 113
		char playerName[32];
7a956470 sago007 2016-02-14 17:09 114
		snprintf(playerScore, sizeof(playerScore), "%i", r.score);
7a956470 sago007 2016-02-14 17:09 115
		snprintf(playerName, sizeof(playerName), "%s", r.name.c_str());
69d8f1dc sago007 2018-03-31 16:19 116
		Write(globalData.screen, x+420,y+150+i*35, playerScore);
69d8f1dc sago007 2018-03-31 16:19 117
		Write(globalData.screen, x+60,y+150+i*35, playerName);
c3b697c6 sago007 2016-02-07 17:30 118
	}
c3b697c6 sago007 2016-02-07 17:30 119
}
c3b697c6 sago007 2016-02-07 17:30 120
c3b697c6 sago007 2016-02-07 17:30 121
void ScoresDisplay::DrawStats() {
13476fc2 sago007 2016-09-28 18:34 122
	DrawBackgroundAndCalcPlacements();
c3b697c6 sago007 2016-02-07 17:30 123
	int y = 5;
c3b697c6 sago007 2016-02-07 17:30 124
	const int y_spacing = 30;
69d8f1dc sago007 2018-03-31 16:19 125
	Write(globalData.screen, 10,y,_("Stats") );
c3b697c6 sago007 2016-02-07 17:30 126
	y+=y_spacing*2;
69d8f1dc sago007 2018-03-31 16:19 127
	Write(globalData.screen, 10,y,_("Chains") );
c3b697c6 sago007 2016-02-07 17:30 128
	for (int i=2; i<13; i++) {
c3b697c6 sago007 2016-02-07 17:30 129
		y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 130
		Write(globalData.screen, 10,y,(std::to_string(i)+"X").c_str());
e373cd75 Poul Sander 2018-11-07 19:21 131
		std::string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("chainX"+std::to_string(i)));
69d8f1dc sago007 2018-03-31 16:19 132
		Write(globalData.screen, 300,y,numberAsString.c_str());
c3b697c6 sago007 2016-02-07 17:30 133
	}
c3b697c6 sago007 2016-02-07 17:30 134
	y+=y_spacing*2;
69d8f1dc sago007 2018-03-31 16:19 135
	Write(globalData.screen, 10,y,_("Lines Pushed: ") );
e373cd75 Poul Sander 2018-11-07 19:21 136
	std::string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("linesPushed"));
69d8f1dc sago007 2018-03-31 16:19 137
	Write(globalData.screen, 300,y,numberAsString.c_str());
c3b697c6 sago007 2016-02-07 17:30 138
c3b697c6 sago007 2016-02-07 17:30 139
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 140
	Write(globalData.screen, 10,y, _("Puzzles solved: ") );
549ecfae sago007 2016-10-09 08:37 141
	numberAsString = std::to_string(Stats::getInstance()->getNumberOf("puzzlesSolved"));
69d8f1dc sago007 2018-03-31 16:19 142
	Write(globalData.screen, 300,y,numberAsString.c_str());
c3b697c6 sago007 2016-02-07 17:30 143
c3b697c6 sago007 2016-02-07 17:30 144
	y+=y_spacing*2;
69d8f1dc sago007 2018-03-31 16:19 145
	Write(globalData.screen, 10,y, _("Run time: ") );
c3b697c6 sago007 2016-02-07 17:30 146
	commonTime ct = TimeHandler::peekTime("totalTime",TimeHandler::ms2ct(SDL_GetTicks()));
c3b697c6 sago007 2016-02-07 17:30 147
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 148
	Write(globalData.screen, 10, y, SPrintCF( _("Days: %i"), ct.days) );
c3b697c6 sago007 2016-02-07 17:30 149
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 150
	Write(globalData.screen, 10, y, SPrintCF( _("Hours: %i"), ct.hours) );
c3b697c6 sago007 2016-02-07 17:30 151
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 152
	Write(globalData.screen, 10, y, SPrintCF( _("Minutes: %i"), ct.minutes) );
c3b697c6 sago007 2016-02-07 17:30 153
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 154
	Write(globalData.screen, 10, y, SPrintCF( _("Seconds: %i"), ct.seconds) );
c3b697c6 sago007 2016-02-07 17:30 155
c3b697c6 sago007 2016-02-07 17:30 156
	y-=y_spacing*4; //Four rows back
72383a9e sago007 2016-10-30 11:56 157
	const int x_offset3 = globalData.xsize/3+10; //Ofset for three rows
69d8f1dc sago007 2018-03-31 16:19 158
	Write(globalData.screen, x_offset3,y, _("Play time: ") );
c3b697c6 sago007 2016-02-07 17:30 159
	ct = TimeHandler::getTime("playTime");
c3b697c6 sago007 2016-02-07 17:30 160
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 161
	Write(globalData.screen, x_offset3, y, SPrintCF( _("Days: %i"), ct.days) );
c3b697c6 sago007 2016-02-07 17:30 162
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 163
	Write(globalData.screen, x_offset3, y, SPrintCF( _("Hours: %i"), ct.hours) );
c3b697c6 sago007 2016-02-07 17:30 164
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 165
	Write(globalData.screen, x_offset3, y, SPrintCF( _("Minutes: %i"), ct.minutes) );
c3b697c6 sago007 2016-02-07 17:30 166
	y+=y_spacing;
69d8f1dc sago007 2018-03-31 16:19 167
	Write(globalData.screen, x_offset3, y, SPrintCF( _("Seconds: %i"), ct.seconds) );
c3b697c6 sago007 2016-02-07 17:30 168
72383a9e sago007 2016-10-30 11:56 169
	const int x_offset = globalData.xsize/2+10;
c3b697c6 sago007 2016-02-07 17:30 170
	y = 5+y_spacing*2;
69d8f1dc sago007 2018-03-31 16:19 171
	Write(globalData.screen, x_offset,y, _("VS CPU (win/loss)") );
c3b697c6 sago007 2016-02-07 17:30 172
	for (int i=0; i<7; i++) {
c3b697c6 sago007 2016-02-07 17:30 173
		y += y_spacing;
e373cd75 Poul Sander 2018-11-07 19:21 174
		Write(globalData.screen, x_offset,y,std::string("AI "+std::to_string(i+1)).c_str());
549ecfae sago007 2016-10-09 08:37 175
		numberAsString = std::to_string(Stats::getInstance()->getNumberOf("defeatedAI"+std::to_string(i)));
e373cd75 Poul Sander 2018-11-07 19:21 176
		std::string numberAsString2 = std::to_string(Stats::getInstance()->getNumberOf("defeatedByAI"+std::to_string(i)));
e373cd75 Poul Sander 2018-11-07 19:21 177
		std::string toPrint = numberAsString + "/" + numberAsString2;
69d8f1dc sago007 2018-03-31 16:19 178
		Write(globalData.screen, x_offset+230,y,toPrint.c_str());
c3b697c6 sago007 2016-02-07 17:30 179
	}
c3b697c6 sago007 2016-02-07 17:30 180
}
c3b697c6 sago007 2016-02-07 17:30 181
c3b697c6 sago007 2016-02-07 17:30 182
ScoresDisplay::ScoresDisplay() {
c3b697c6 sago007 2016-02-07 17:30 183
}
c3b697c6 sago007 2016-02-07 17:30 184
c3b697c6 sago007 2016-02-07 17:30 185
ScoresDisplay::~ScoresDisplay() {
c3b697c6 sago007 2016-02-07 17:30 186
}
c3b697c6 sago007 2016-02-07 17:30 187
c3b697c6 sago007 2016-02-07 17:30 188
bool ScoresDisplay::IsActive() {
c3b697c6 sago007 2016-02-07 17:30 189
	return isActive;
c3b697c6 sago007 2016-02-07 17:30 190
}
c3b697c6 sago007 2016-02-07 17:30 191
647f12da sago007 2016-09-12 20:07 192
void ScoresDisplay::Draw(SDL_Renderer*) {
c3b697c6 sago007 2016-02-07 17:30 193
	switch (page) {
79d552fa sago007 2019-02-12 17:17 194
		case 0:
79d552fa sago007 2019-02-12 17:17 195
		case 1:
79d552fa sago007 2019-02-12 17:17 196
		case 2:
79d552fa sago007 2019-02-12 17:17 197
		case 3:
79d552fa sago007 2019-02-12 17:17 198
		case 4:
79d552fa sago007 2019-02-12 17:17 199
			//Highscores, endless
79d552fa sago007 2019-02-12 17:17 200
			DrawHighscores(100,100,true, page);
79d552fa sago007 2019-02-12 17:17 201
			break;
79d552fa sago007 2019-02-12 17:17 202
		case 5:
79d552fa sago007 2019-02-12 17:17 203
			//Highscores, Time Trial
79d552fa sago007 2019-02-12 17:17 204
			DrawHighscores(100,100,false);
79d552fa sago007 2019-02-12 17:17 205
			break;
79d552fa sago007 2019-02-12 17:17 206
		case 6:
79d552fa sago007 2019-02-12 17:17 207
		default:
79d552fa sago007 2019-02-12 17:17 208
			DrawStats();
c3b697c6 sago007 2016-02-07 17:30 209
	};
c3b697c6 sago007 2016-02-07 17:30 210
34ab7861 sago007 2018-03-28 14:47 211
	const sago::SagoDataHolder* holder = &globalData.spriteHolder->GetDataHolder();
c3b697c6 sago007 2016-02-07 17:30 212
	//Draw buttons:
72383a9e sago007 2016-10-30 11:56 213
	globalData.bHighScore.Draw(globalData.screen, 0, scoreX,scoreY);
72383a9e sago007 2016-10-30 11:56 214
	globalData.bBack.Draw(globalData.screen, 0, backX, backY);
34ab7861 sago007 2018-03-28 14:47 215
	static sago::SagoTextField backLabel;
34ab7861 sago007 2018-03-28 14:47 216
	setButtonFont(holder, backLabel, _("Back"));
34ab7861 sago007 2018-03-28 14:47 217
	backLabel.Draw(globalData.screen, backX+60,backY+10, sago::SagoTextField::Alignment::center);
72383a9e sago007 2016-10-30 11:56 218
	globalData.bNext.Draw(globalData.screen, 0, nextX, nextY);
34ab7861 sago007 2018-03-28 14:47 219
	static sago::SagoTextField nextLabel;
34ab7861 sago007 2018-03-28 14:47 220
	setButtonFont(holder, nextLabel, _("Next"));
34ab7861 sago007 2018-03-28 14:47 221
	nextLabel.Draw(globalData.screen, nextX+60, nextY+10, sago::SagoTextField::Alignment::center);
c3b697c6 sago007 2016-02-07 17:30 222
c3b697c6 sago007 2016-02-07 17:30 223
	//Draw page number
e373cd75 Poul Sander 2018-11-07 19:21 224
	std::string pageXofY = SPrintStringF(_("Page %i of %i"), page+1, numberOfPages);
c9a65d81 sago007 2018-03-31 16:22 225
	getCachedText(pageXofY)->Draw(globalData.screen,  globalData.xsize/2, globalData.ysize-60, sago::SagoTextField::Alignment::center);
c3b697c6 sago007 2016-02-07 17:30 226
}
c3b697c6 sago007 2016-02-07 17:30 227
58a2d7e1 sago007 2016-02-12 18:53 228
void ScoresDisplay::ProcessInput(const SDL_Event& event, bool& processed) {
c7f2082f sago007 2016-03-13 11:48 229
20d77c6e sago007 2016-11-12 16:28 230
	UpdateMouseCoordinates(event, globalData.mousex, globalData.mousey);
092bdebe sago007 2017-03-19 14:39 231
79d552fa sago007 2019-02-12 17:17 232
	if (isRightEvent(event)) {
d21782d4 sago007 2016-03-13 11:17 233
		page++;
d21782d4 sago007 2016-03-13 11:17 234
		if (page>=numberOfPages) {
d21782d4 sago007 2016-03-13 11:17 235
			page = 0;
c3b697c6 sago007 2016-02-07 17:30 236
		}
647f12da sago007 2016-09-12 20:07 237
		processed = true;
d21782d4 sago007 2016-03-13 11:17 238
	}
8e3fb7e1 sago007 2016-03-13 11:26 239
79d552fa sago007 2019-02-12 17:17 240
	if (isLeftEvent(event)) {
d21782d4 sago007 2016-03-13 11:17 241
		page--;
d21782d4 sago007 2016-03-13 11:17 242
		if (page<0) {
d21782d4 sago007 2016-03-13 11:17 243
			page = numberOfPages-1;
c3b697c6 sago007 2016-02-07 17:30 244
		}
647f12da sago007 2016-09-12 20:07 245
		processed = true;
c3b697c6 sago007 2016-02-07 17:30 246
	}
8e3fb7e1 sago007 2016-03-13 11:26 247
d21782d4 sago007 2016-03-13 11:17 248
	if (isConfirmEvent(event) || isEscapeEvent(event)) {
d21782d4 sago007 2016-03-13 11:17 249
		isActive = false;
647f12da sago007 2016-09-12 20:07 250
		processed = true;
d21782d4 sago007 2016-03-13 11:17 251
	}
c3b697c6 sago007 2016-02-07 17:30 252
}
c3b697c6 sago007 2016-02-07 17:30 253
c3b697c6 sago007 2016-02-07 17:30 254
void ScoresDisplay::Update() {
c3b697c6 sago007 2016-02-07 17:30 255
	// If the mouse button is released, make bMouseUp equal true
08c44684 sago007 2016-10-30 09:19 256
	if ( !(SDL_GetMouseState(nullptr, nullptr)&SDL_BUTTON(1)) ) {
c3b697c6 sago007 2016-02-07 17:30 257
		bMouseUp=true;
c3b697c6 sago007 2016-02-07 17:30 258
	}
c3b697c6 sago007 2016-02-07 17:30 259
c3b697c6 sago007 2016-02-07 17:30 260
	if (SDL_GetMouseState(nullptr,nullptr)&SDL_BUTTON(1) && bMouseUp) {
c3b697c6 sago007 2016-02-07 17:30 261
		bMouseUp = false;
c3b697c6 sago007 2016-02-07 17:30 262
c3b697c6 sago007 2016-02-07 17:30 263
		//The Score button:
20d77c6e sago007 2016-11-12 16:28 264
		if ((globalData.mousex>scoreX) && (globalData.mousex<scoreX+buttonXsize) && (globalData.mousey>scoreY) && (globalData.mousey<scoreY+buttonYsize)) {
c3b697c6 sago007 2016-02-07 17:30 265
			isActive = false;
c3b697c6 sago007 2016-02-07 17:30 266
		}
c3b697c6 sago007 2016-02-07 17:30 267
c3b697c6 sago007 2016-02-07 17:30 268
		//The back button:
20d77c6e sago007 2016-11-12 16:28 269
		if ((globalData.mousex>backX) && (globalData.mousex<backX+buttonXsize) && (globalData.mousey>backY) && (globalData.mousey<backY+buttonYsize)) {
c3b697c6 sago007 2016-02-07 17:30 270
			page--;
c3b697c6 sago007 2016-02-07 17:30 271
			if (page<0) {
c3b697c6 sago007 2016-02-07 17:30 272
				page = numberOfPages-1;
c3b697c6 sago007 2016-02-07 17:30 273
			}
c3b697c6 sago007 2016-02-07 17:30 274
		}
c3b697c6 sago007 2016-02-07 17:30 275
c3b697c6 sago007 2016-02-07 17:30 276
		//The next button:
20d77c6e sago007 2016-11-12 16:28 277
		if ((globalData.mousex>nextX) && (globalData.mousex<nextX+buttonXsize) && (globalData.mousey>nextY) && (globalData.mousey<nextY+buttonYsize)) {
c3b697c6 sago007 2016-02-07 17:30 278
			page++;
c3b697c6 sago007 2016-02-07 17:30 279
			if (page>=numberOfPages) {
c3b697c6 sago007 2016-02-07 17:30 280
				page = 0;
c3b697c6 sago007 2016-02-07 17:30 281
			}
c3b697c6 sago007 2016-02-07 17:30 282
		}
c3b697c6 sago007 2016-02-07 17:30 283
	}
c3b697c6 sago007 2016-02-07 17:30 284
}