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