git repos / blockattack-game

blame: source/code/themes.cpp

normal view · raw

aaba4f1e Poul Sander 2023-07-25 13:34 1
/*
aaba4f1e Poul Sander 2023-07-25 13:34 2
===========================================================================
aaba4f1e Poul Sander 2023-07-25 13:34 3
blockattack - Block Attack - Rise of the Blocks
aaba4f1e Poul Sander 2023-07-25 13:34 4
Copyright (C) 2005-2023 Poul Sander
aaba4f1e Poul Sander 2023-07-25 13:34 5
aaba4f1e Poul Sander 2023-07-25 13:34 6
This program is free software: you can redistribute it and/or modify
aaba4f1e Poul Sander 2023-07-25 13:34 7
it under the terms of the GNU General Public License as published by
aaba4f1e Poul Sander 2023-07-25 13:34 8
the Free Software Foundation, either version 2 of the License, or
aaba4f1e Poul Sander 2023-07-25 13:34 9
(at your option) any later version.
aaba4f1e Poul Sander 2023-07-25 13:34 10
aaba4f1e Poul Sander 2023-07-25 13:34 11
This program is distributed in the hope that it will be useful,
aaba4f1e Poul Sander 2023-07-25 13:34 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
aaba4f1e Poul Sander 2023-07-25 13:34 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
aaba4f1e Poul Sander 2023-07-25 13:34 14
GNU General Public License for more details.
aaba4f1e Poul Sander 2023-07-25 13:34 15
aaba4f1e Poul Sander 2023-07-25 13:34 16
You should have received a copy of the GNU General Public License
aaba4f1e Poul Sander 2023-07-25 13:34 17
along with this program.  If not, see http://www.gnu.org/licenses/
aaba4f1e Poul Sander 2023-07-25 13:34 18
aaba4f1e Poul Sander 2023-07-25 13:34 19
Source information and contacts persons can be found at
aaba4f1e Poul Sander 2023-07-25 13:34 20
https://www.blockattack.net
aaba4f1e Poul Sander 2023-07-25 13:34 21
===========================================================================
aaba4f1e Poul Sander 2023-07-25 13:34 22
*/
aaba4f1e Poul Sander 2023-07-25 13:34 23
aaba4f1e Poul Sander 2023-07-25 13:34 24
aaba4f1e Poul Sander 2023-07-25 13:34 25
#include "themes.hpp"
aaba4f1e Poul Sander 2023-07-25 13:34 26
aaba4f1e Poul Sander 2023-07-25 13:34 27
#include <vector>
aaba4f1e Poul Sander 2023-07-25 13:34 28
aaba4f1e Poul Sander 2023-07-25 13:34 29
static std::vector<Theme> themes(1);
aaba4f1e Poul Sander 2023-07-25 13:34 30
static bool initialized = false;
aaba4f1e Poul Sander 2023-07-25 13:34 31
static size_t current_theme = 0;
aaba4f1e Poul Sander 2023-07-25 13:34 32
aaba4f1e Poul Sander 2023-07-25 13:34 33
void InitThemes() {
aaba4f1e Poul Sander 2023-07-25 13:34 34
	if (initialized) {
aaba4f1e Poul Sander 2023-07-25 13:34 35
		return;
aaba4f1e Poul Sander 2023-07-25 13:34 36
	}
aaba4f1e Poul Sander 2023-07-25 13:34 37
	themes.resize(1);  //Add the default theme
aaba4f1e Poul Sander 2023-07-25 13:34 38
	Theme snow;
aaba4f1e Poul Sander 2023-07-25 13:34 39
	snow.theme_name = "snow";
aaba4f1e Poul Sander 2023-07-25 13:34 40
	snow.back_board = "back_board_sample_snow";
aaba4f1e Poul Sander 2023-07-25 13:34 41
	themes.push_back(snow);
aaba4f1e Poul Sander 2023-07-25 13:34 42
}
aaba4f1e Poul Sander 2023-07-25 13:34 43
aaba4f1e Poul Sander 2023-07-25 13:34 44
Theme getNextTheme() {
aaba4f1e Poul Sander 2023-07-25 13:34 45
	InitThemes();
aaba4f1e Poul Sander 2023-07-25 13:34 46
	current_theme++;
aaba4f1e Poul Sander 2023-07-25 13:34 47
	current_theme = current_theme % themes.size();
aaba4f1e Poul Sander 2023-07-25 13:34 48
	return themes.at(current_theme);
aaba4f1e Poul Sander 2023-07-25 13:34 49
}
1970-01-01 00:00 50