Show stats button on title screen.

This commit is contained in:
Steve 2016-02-29 09:35:39 +00:00
parent 1291c0cf22
commit 0e159402e9
3 changed files with 62 additions and 14 deletions

View File

@ -5,7 +5,7 @@
"type" : "WT_BUTTON",
"text" : "Campaign",
"x" : -1,
"y" : 250,
"y" : 225,
"w" : 200,
"h": 34
},
@ -15,7 +15,17 @@
"type" : "WT_BUTTON",
"text" : "Challenges",
"x" : -1,
"y" : 350,
"y" : 325,
"w" : 200,
"h": 34
},
{
"name" : "stats",
"group" : "title",
"type" : "WT_BUTTON",
"text" : "Stats",
"x" : -1,
"y" : 425,
"w" : 200,
"h": 34
},
@ -25,7 +35,7 @@
"type" : "WT_BUTTON",
"text" : "Options",
"x" : -1,
"y" : 450,
"y" : 525,
"w" : 200,
"h": 34
},
@ -35,7 +45,7 @@
"type" : "WT_BUTTON",
"text" : "Quit",
"x" : -1,
"y" : 550,
"y" : 625,
"w" : 200,
"h": 34
}

View File

@ -28,6 +28,8 @@ static void doFighters(void);
static void drawFighters(void);
static void campaign(void);
static void challenges(void);
static void stats(void);
static void statsOK(void);
static void options(void);
static void quit(void);
static void returnFromOptions(void);
@ -39,7 +41,7 @@ static SDL_Texture *earthTexture;
static PointF earth;
static Entity fighters[NUM_FIGHTERS];
static const char *fighterTextures[] = {"gfx/fighters/firefly.png", "gfx/fighters/hammerhead.png", "gfx/fighters/hyena.png", "gfx/fighters/khepri.png", "gfx/fighters/kingfisher.png", "gfx/fighters/leopard.png", "gfx/fighters/nymph.png", "gfx/fighters/ray.png", "gfx/fighters/rook.png", "gfx/fighters/taf.png"};
static int showingOptions;
static int show;
void initTitle(void)
{
@ -74,10 +76,13 @@ void initTitle(void)
getWidget("campaign", "title")->action = campaign;
getWidget("challenges", "title")->action = challenges;
getWidget("stats", "title")->action = stats;
getWidget("options", "title")->action = options;
getWidget("quit", "title")->action = quit;
showingOptions = 0;
getWidget("ok", "stats")->action = statsOK;
show = SHOW_TITLE;
endSectionTransition();
@ -165,13 +170,19 @@ static void draw(void)
drawText(10, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2016");
drawText(SCREEN_WIDTH - 10, SCREEN_HEIGHT - 25, 14, TA_RIGHT, colors.white, "Version %.2f.%d", VERSION, REVISION);
if (!showingOptions)
switch (show)
{
case SHOW_TITLE:
drawWidgets("title");
}
else
{
break;
case SHOW_STATS:
drawStats();
break;
case SHOW_OPTIONS:
drawOptions();
break;
}
}
@ -209,14 +220,34 @@ static void challenges(void)
static void options(void)
{
showingOptions = 1;
selectWidget("ok", "options");
show = SHOW_OPTIONS;
initOptions(returnFromOptions);
}
static void stats(void)
{
selectWidget("ok", "stats");
show = SHOW_STATS;
initStatsDisplay();
}
static void statsOK(void)
{
selectWidget("stats", "title");
show = SHOW_TITLE;
}
static void returnFromOptions(void)
{
showingOptions = 0;
show = SHOW_TITLE;
selectWidget("options", "title");
}
static void quit(void)

View File

@ -20,6 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h"
#define SHOW_TITLE 0
#define SHOW_STATS 1
#define SHOW_OPTIONS 2
#define NUM_FIGHTERS 12
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
@ -42,12 +46,15 @@ extern Widget *getWidget(const char *name, const char *group);
extern void initGalacticMap(void);
extern void initOptions(void (*returnFromOptions)(void));
extern void drawOptions(void);
extern void initStatsDisplay(void);
extern void playMusic(char *filename);
extern void destroyBattle(void);
extern void playSound(int id);
extern void initEffects(void);
extern void setMouse(int x, int y);
extern void initChallengeHome(void);
extern void selectWidget(const char *name, const char *group);
extern void drawStats(void);
extern App app;
extern Battle battle;