Debian Codegraph @

source/code/HelpAboutState.cpp

raw symbols SCIP
1 /*
2 ===========================================================================
3 blockattack - Block Attack - Rise of the Blocks
4 Copyright (C) 2005-2018 Poul Sander
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see http://www.gnu.org/licenses/
18
19 Source information and contacts persons can be found at
20 https://blockattack.net
21 ===========================================================================
22 */
23
24 #include "DialogBox.hpp"
25 #include "HelpCommon.hpp"
26 #include "HelpAboutState.hpp"
27 #include "global.hpp"
28 #include "common.h"
29 #include "MenuSystem.h"
30 #include "sstream"
31 #include "version.h"
32 #include "sago/SagoMisc.hpp"
33 #include "fmt/core.h"
34
35
36 template <class T>
37 std::string sdl_verison_as_string(const T& version) {
38 std::string ret = fmt::format("{}.{}.{}", version.major, version.minor, version.patch);
39 return ret;
40 }
41
42
43 HelpAboutState::HelpAboutState() {
44 SDL_RendererInfo renderInfo;
45 SDL_version compiled;
46 SDL_version linked;
47 SDL_GetRendererInfo(globalData.screen, &renderInfo);
48 SDL_VERSION(&compiled);
49 SDL_GetVersion(&linked);
50 const char* audio_driver_name = SDL_GetCurrentAudioDriver();
51 if (!audio_driver_name) {
52 audio_driver_name = _("No audio driver");
53 }
54 std::stringstream infoStream;
55 infoStream << _("Name:") << " " << _("Block Attack - Rise of the Blocks") << "\n";
56 infoStream << _("Original name:") << " Block Attack - Rise of the Blocks" << "\n";
57 infoStream << _("Version:") << " " << VERSION_NUMBER << "\n";
58 infoStream << _("Homepage:") << " " << "https://blockattack.net\n";
59 infoStream << _("Github page:") << " " << "https://github.com/blockattack/blockattack-game\n";
60 infoStream << _("SDL render:") << " " << renderInfo.name << "\n";
61 infoStream << _("SDL audio driver:") << " " << audio_driver_name << "\n";
62 infoStream << _("SDL compiled version:") << " " << sdl_verison_as_string(compiled) << "\n";
63 infoStream << _("SDL linked version:") << " " << sdl_verison_as_string(linked) << "\n";
64 SDL_IMAGE_VERSION(&compiled);
65 const SDL_version* sdl_link_version=IMG_Linked_Version();
66 infoStream << _("SDL_image compiled version:") << " " << sdl_verison_as_string(compiled) << "\n";
67 infoStream << _("SDL_image linked version:") << " " << sdl_verison_as_string(*sdl_link_version) << "\n";
68 SDL_MIXER_VERSION(&compiled);
69 sdl_link_version = Mix_Linked_Version();
70 infoStream << _("SDL_mixer compiled version:") << " " << sdl_verison_as_string(compiled) << "\n";
71 infoStream << _("SDL_mixer linked version:") << " " << sdl_verison_as_string(*sdl_link_version) << "\n";
72 SDL_TTF_VERSION(&compiled);
73 sdl_link_version = TTF_Linked_Version();
74 infoStream << _("SDL_ttf compiled version:") << " " << sdl_verison_as_string(compiled) << "\n";
75 infoStream << _("SDL_ttf linked version:") << " " << sdl_verison_as_string(*sdl_link_version) << "\n";
76 PHYSFS_Version physfs_compiled_version;
77 PHYSFS_Version physfs_linked_version;
78 PHYSFS_VERSION(&physfs_compiled_version);
79 PHYSFS_getLinkedVersion(&physfs_linked_version);
80 infoStream << _("PhysFS compiled version:") << " " << sdl_verison_as_string(physfs_compiled_version) << "\n";
81 infoStream << _("PhysFS linked version:") << " " << sdl_verison_as_string(physfs_linked_version) << "\n";
82 infoStream << _("Save folder:") << " " << PHYSFS_getWriteDir() << "\n";
83 infoStream << _("Locale:") << " " << setlocale( LC_CTYPE, nullptr ) << "\n";
84 infoStream << "SHAREDIR: " << SHAREDIR << "\n";
85 setHelp30FontThinOutline(&globalData.spriteHolder->GetDataHolder(), titleField, _("About"));
86 setHelpBoxFont(&globalData.spriteHolder->GetDataHolder(), infoBox, infoStream.str().c_str());
87 sago::WriteFileContent("about.txt", infoStream.str());
88 }
89
90 HelpAboutState::~HelpAboutState() {
91 }