commit 0471a1d3
Can now show the credits box
Changed files
| M | source/code/ShowFileState.hpp before |
| M | source/code/menudef.cpp before |
diff --git a/source/code/ShowFileState.hpp b/source/code/ShowFileState.hpp
index 9880b65..3bad338 100644
--- a/source/code/ShowFileState.hpp
+++ b/source/code/ShowFileState.hpp
@@ -22,6 +22,7 @@ https://blockattack.net
#include "sago/GameStateInterface.hpp"
+#include <string>
class ShowFileState : public sago::GameStateInterface {
public:
@@ -34,9 +35,16 @@ public:
void ProcessInput(const SDL_Event& event, bool &processed) override;
void Update() override;
+ void SetData(const std::string& filename, const std::string& header) {
+ this->filename = filename;
+ this->header = header;
+ }
+
private:
bool isActive = true;
bool bMouseUp = true;
+ std::string filename;
+ std::string header;
};
#endif /* SHOWFILESTATE_HPP */
diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp
index 35ec7ea..91d4a76 100644
--- a/source/code/menudef.cpp
+++ b/source/code/menudef.cpp
@@ -28,6 +28,7 @@ http://blockattack.net
#include "HelpHowtoState.hpp"
#include "HelpGamepadState.hpp"
#include "HelpAboutState.hpp"
+#include "ShowFileState.hpp"
using std::string;
using std::cerr;
@@ -284,6 +285,12 @@ static void runHelpAbout() {
RunGameState(helpAbout);
}
+static void runCredits() {
+ ShowFileState creditsFile;
+ creditsFile.SetData("misc/AUTHORS", _("Credits"));
+ RunGameState(creditsFile);
+}
+
static void HelpMenu() {
Menu m(globalData.screen, _("Help"), true);
Button bHowto;
@@ -294,6 +301,10 @@ static void HelpMenu() {
bGamepad.setLabel(_("Gamepad"));
bGamepad.setAction(runHelpGamepad);
m.addButton(&bGamepad);
+ Button bCredits;
+ bCredits.setLabel(_("Credits"));
+ bCredits.setAction(runCredits);
+ m.addButton(&bCredits);
Button bAbout;
bAbout.setLabel(_("About"));
bAbout.setAction(runHelpAbout);