1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

- Extend upstream patch to display more info when engine is run without game specified

This commit is contained in:
Dmitry Marakasov 2013-12-10 01:19:55 +00:00
parent 745524d2be
commit 4f05e4e6b8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=336036
2 changed files with 95 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= flare
PORTVERSION= 0.19
PORTREVISION= 1
CATEGORIES= games
MASTER_SITES= SF/${PORTNAME}-game/Linux/
DISTNAME= ${PORTNAME}-engine.${PORTVERSION}

View File

@ -1,3 +1,97 @@
commit 2a85555c8f0851de1bccc3f633a8072e1ea15551
Author: Justin Jacobs <jajdorkster@gmail.com>
Date: Mon Dec 9 20:06:56 2013 -0500
Display the default game warning on the title screen
Closes #896
diff --git src/GameStateTitle.cpp src/GameStateTitle.cpp
index 2cdd797..3ca06e8 100644
--- src/GameStateTitle.cpp
+++ src/GameStateTitle.cpp
@@ -24,6 +24,8 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "SharedResources.h"
#include "WidgetButton.h"
#include "WidgetLabel.h"
+#include "WidgetScrollBox.h"
+#include "UtilsMath.h"
GameStateTitle::GameStateTitle() : GameState() {
@@ -71,6 +73,21 @@ GameStateTitle::GameStateTitle() : GameState() {
tablist.add(button_cfg);
tablist.add(button_credits);
tablist.add(button_exit);
+
+ // Warning text box
+ warning_box = NULL;
+ if (GAME_FOLDER == "default") {
+ std::string warning_text = msg->get("Warning: A game wasn't specified, falling back to the 'default' game. Did you forget the --game flag? (e.g. --game=flare-game). See --help for more details.");
+ Point warning_size = font->calc_size(warning_text, VIEW_W/2);
+
+ int warning_box_h = warning_size.y;
+ clampCeil(warning_box_h, VIEW_H/2);
+ warning_box = new WidgetScrollBox(VIEW_W/2, warning_box_h);
+ warning_box->resize(warning_size.y);
+
+ font->setFont("font_normal");
+ font->renderShadowed(warning_text, 0, 0, JUSTIFY_LEFT, warning_box->contents, VIEW_W/2, FONT_WHITE);
+ }
}
void GameStateTitle::logic() {
@@ -83,6 +100,10 @@ void GameStateTitle::logic() {
exitRequested = true;
}
+ if (warning_box) {
+ warning_box->logic();
+ }
+
tablist.logic();
if (button_play->checkClick()) {
@@ -134,6 +155,11 @@ void GameStateTitle::render() {
// version number
label_version->render();
+
+ // warning text
+ if (warning_box) {
+ warning_box->render();
+ }
}
GameStateTitle::~GameStateTitle() {
@@ -142,5 +168,6 @@ GameStateTitle::~GameStateTitle() {
delete button_credits;
delete button_exit;
delete label_version;
+ delete warning_box;
SDL_FreeSurface(logo);
}
diff --git src/GameStateTitle.h src/GameStateTitle.h
index 7494dc5..ed2a093 100644
--- src/GameStateTitle.h
+++ src/GameStateTitle.h
@@ -24,6 +24,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
class WidgetButton;
class WidgetLabel;
+class WidgetScrollBox;
class GameStateTitle : public GameState {
private:
@@ -33,6 +34,7 @@ private:
WidgetButton *button_cfg;
WidgetButton *button_credits;
WidgetLabel *label_version;
+ WidgetScrollBox *warning_box;
TabList tablist;
commit 2f99397b27a407d8f5a34a023a6e54b378d0e32d
Author: Justin Jacobs <jajdorkster@gmail.com>
Date: Sat Dec 7 04:52:17 2013 -0500