git repos / blockattack-game

blame: source/code/HelpAboutState.cpp

normal view · raw

5147de4e Poul Sander 2018-05-06 12:59 1
/*
5147de4e Poul Sander 2018-05-06 12:59 2
===========================================================================
5147de4e Poul Sander 2018-05-06 12:59 3
blockattack - Block Attack - Rise of the Blocks
5147de4e Poul Sander 2018-05-06 12:59 4
Copyright (C) 2005-2018 Poul Sander
5147de4e Poul Sander 2018-05-06 12:59 5
5147de4e Poul Sander 2018-05-06 12:59 6
This program is free software: you can redistribute it and/or modify
5147de4e Poul Sander 2018-05-06 12:59 7
it under the terms of the GNU General Public License as published by
5147de4e Poul Sander 2018-05-06 12:59 8
the Free Software Foundation, either version 2 of the License, or
5147de4e Poul Sander 2018-05-06 12:59 9
(at your option) any later version.
5147de4e Poul Sander 2018-05-06 12:59 10
5147de4e Poul Sander 2018-05-06 12:59 11
This program is distributed in the hope that it will be useful,
5147de4e Poul Sander 2018-05-06 12:59 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
5147de4e Poul Sander 2018-05-06 12:59 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5147de4e Poul Sander 2018-05-06 12:59 14
GNU General Public License for more details.
5147de4e Poul Sander 2018-05-06 12:59 15
5147de4e Poul Sander 2018-05-06 12:59 16
You should have received a copy of the GNU General Public License
5147de4e Poul Sander 2018-05-06 12:59 17
along with this program.  If not, see http://www.gnu.org/licenses/
5147de4e Poul Sander 2018-05-06 12:59 18
5147de4e Poul Sander 2018-05-06 12:59 19
Source information and contacts persons can be found at
5147de4e Poul Sander 2018-05-06 12:59 20
https://blockattack.net
5147de4e Poul Sander 2018-05-06 12:59 21
===========================================================================
5147de4e Poul Sander 2018-05-06 12:59 22
*/
5147de4e Poul Sander 2018-05-06 12:59 23
d7f4a888 sago007 2020-06-28 09:22 24
#include "DialogBox.hpp"
46404443 sago007 2020-06-28 08:53 25
#include "HelpCommon.hpp"
5147de4e Poul Sander 2018-05-06 12:59 26
#include "HelpAboutState.hpp"
5147de4e Poul Sander 2018-05-06 12:59 27
#include "global.hpp"
5147de4e Poul Sander 2018-05-06 12:59 28
#include "common.h"
5147de4e Poul Sander 2018-05-06 12:59 29
#include "MenuSystem.h"
b344a21b sago007 2018-05-10 10:22 30
#include "sstream"
b344a21b sago007 2018-05-10 10:22 31
#include "version.h"
8cb016a5 sago007 2019-03-09 15:41 32
#include "sago/SagoMisc.hpp"
5147de4e Poul Sander 2018-05-06 12:59 33
b344a21b sago007 2018-05-10 10:22 34
5147de4e Poul Sander 2018-05-06 12:59 35
HelpAboutState::HelpAboutState() {
0e662388 sago007 2019-03-09 12:21 36
	SDL_RendererInfo renderInfo;
0e662388 sago007 2019-03-09 12:21 37
	SDL_version compiled;
0e662388 sago007 2019-03-09 12:21 38
	SDL_version linked;
b344a21b sago007 2018-05-10 10:22 39
	SDL_GetRendererInfo(globalData.screen, &renderInfo);
0e662388 sago007 2019-03-09 12:21 40
	SDL_VERSION(&compiled);
0e662388 sago007 2019-03-09 12:21 41
	SDL_GetVersion(&linked);
0e662388 sago007 2019-03-09 12:21 42
	const char* audio_driver_name = SDL_GetCurrentAudioDriver();
0e662388 sago007 2019-03-09 12:21 43
	if (!audio_driver_name) {
0e662388 sago007 2019-03-09 12:21 44
		audio_driver_name = _("No audio driver");
0e662388 sago007 2019-03-09 12:21 45
	}
b344a21b sago007 2018-05-10 10:22 46
	std::stringstream infoStream;
0082cd9a sago007 2018-05-13 14:31 47
	infoStream << _("Name:") << " " << _("Block Attack - Rise of the Blocks") << "\n";
0082cd9a sago007 2018-05-13 14:31 48
	infoStream << _("Original name:") << " Block Attack - Rise of the Blocks" << "\n";
0082cd9a sago007 2018-05-13 14:31 49
	infoStream << _("Version:") << " " << VERSION_NUMBER << "\n";
0082cd9a sago007 2018-05-13 14:31 50
	infoStream << _("Homepage:") << " " << "https://blockattack.net\n";
0082cd9a sago007 2018-05-13 14:31 51
	infoStream << _("Github page:") << " " << "https://github.com/blockattack/blockattack-game\n";
0082cd9a sago007 2018-05-13 14:31 52
	infoStream << _("SDL render:") << " " << renderInfo.name << "\n";
0e662388 sago007 2019-03-09 12:21 53
	infoStream << _("SDL audio driver:") << " " << audio_driver_name << "\n";
0e662388 sago007 2019-03-09 12:21 54
	infoStream << _("SDL compiled version:") << " " << (int)compiled.major << "." << (int)compiled.minor << "." << (int)compiled.patch << "\n";
0e662388 sago007 2019-03-09 12:21 55
	infoStream << _("SDL linked version:") << " " << (int)linked.major << "." << (int)linked.minor << "." << (int)linked.patch << "\n";
0082cd9a sago007 2018-05-13 14:31 56
	infoStream << _("Save folder:") << " " << PHYSFS_getWriteDir() << "\n";
0082cd9a sago007 2018-05-13 14:31 57
	infoStream << _("Locale:") << " " << setlocale( LC_CTYPE, nullptr ) << "\n";
dfebdcd4 Poul Sander 2022-01-30 18:12 58
	setHelp30FontThinOutline(&globalData.spriteHolder->GetDataHolder(), titleField, _("About"));
46404443 sago007 2020-06-28 08:53 59
	setHelpBoxFont(&globalData.spriteHolder->GetDataHolder(), infoBox, infoStream.str().c_str());
8cb016a5 sago007 2019-03-09 15:41 60
	sago::WriteFileContent("about.txt", infoStream.str());
5147de4e Poul Sander 2018-05-06 12:59 61
}
5147de4e Poul Sander 2018-05-06 12:59 62
5147de4e Poul Sander 2018-05-06 12:59 63
HelpAboutState::~HelpAboutState() {
5147de4e Poul Sander 2018-05-06 12:59 64
}
5147de4e Poul Sander 2018-05-06 12:59 65
5147de4e Poul Sander 2018-05-06 12:59 66
5147de4e Poul Sander 2018-05-06 12:59 67
void HelpAboutState::Draw(SDL_Renderer* target) {
5147de4e Poul Sander 2018-05-06 12:59 68
	DrawBackground(target);
b344a21b sago007 2018-05-10 10:22 69
	titleField.Draw(target, 50, 50);
db2f559e sago007 2018-05-10 10:36 70
	DrawRectYellow(target, 40, 90, 600, 900);
a2197600 sago007 2018-05-11 15:45 71
	infoBox.SetMaxWidth(850);
b344a21b sago007 2018-05-10 10:22 72
	infoBox.Draw(target, 50, 100);
ec3f09de Poul Sander 2022-01-29 14:33 73
	HelpCommonState::Draw(target);
465d2e3f sago007 2020-06-28 08:40 74
}
1970-01-01 00:00 75