diff --git a/src/game/trophies.h b/src/game/trophies.h index ecab245..c5e1ebe 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -31,6 +31,5 @@ extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a); extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a); extern float mod(float n, float x); -extern App app; extern Colors colors; extern Game game; diff --git a/src/system/widgets.c b/src/system/widgets.c index 8da5108..65d6ab9 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -78,6 +78,18 @@ void drawWidgets(void) switch (w->type) { case WT_BUTTON: + if (w != selectedWidget) + { + drawRect(w->x, w->y, w->w, w->h, 0, 64, 0, 255); + drawOutlineRect(w->x, w->y, w->w, w->h, 0, 128, 0, 255); + drawText(w->x + w->w / 2, w->y + 2, 24, TA_CENTER, colors.white, w->label); + } + else + { + drawRect(w->x, w->y, w->w, w->h, 0, 128, 0, 255); + drawOutlineRect(w->x, w->y, w->w, w->h, 0, 255, 0, 255); + drawText(w->x + w->w / 2, w->y + 2, 24, TA_CENTER, colors.yellow, w->label); + } break; case WT_PLAIN_BUTTON: @@ -220,6 +232,11 @@ static void loadWidgetGroup(char *filename) w->h = cJSON_GetObjectItem(node, "h")->valueint; w->type = lookup(cJSON_GetObjectItem(node, "type")->valuestring); + if (w->x == -1) + { + w->x = (SCREEN_WIDTH - w->w) / 2; + } + switch (w->type) { case WT_SPINNER: diff --git a/src/system/widgets.h b/src/system/widgets.h index bb05c91..cbfcbee 100644 --- a/src/system/widgets.h +++ b/src/system/widgets.h @@ -24,5 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern char *readFile(const char *filename); extern char **getFileList(const char *dir, int *count); extern long lookup(const char *name); +extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a); +extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a); extern App app; +extern Colors colors; diff --git a/src/test/atlasTest.c b/src/test/atlasTest.c index 68a2169..df48298 100644 --- a/src/test/atlasTest.c +++ b/src/test/atlasTest.c @@ -33,7 +33,7 @@ void initAtlasTest(void) initHub(); - loadWorld("greenlands5"); + loadWorld("beachApproach"); initWorld(); @@ -42,4 +42,6 @@ void initAtlasTest(void) initEntities(); saveConfig(); + + /*awardTrophy("BEACH");*/ } diff --git a/src/test/atlasTest.h b/src/test/atlasTest.h index 97fb12b..927cd1e 100644 --- a/src/test/atlasTest.h +++ b/src/test/atlasTest.h @@ -27,5 +27,6 @@ extern void initGame(void); extern void initEntities(void); extern void loadWorld(char *id); extern void saveConfig(void); +extern void awardTrophy(char *id); extern Dev dev; diff --git a/src/world/world.c b/src/world/world.c index c2ce178..077b73e 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -35,9 +35,11 @@ static void addHelperItems(void); static void spawnEnemies(void); static int canAdd(Unit *u, int mx, int my); static void startMission(void); +static void drawInGameWidgets(void); static Texture *background; static int observationIndex; +static int showingWidgets; void initWorld(void) { @@ -87,6 +89,12 @@ void initWorld(void) app.delegate.logic = logic; app.delegate.draw = draw; + + showWidgetGroup("gamePaused"); + + showingWidgets = 1; + + startMission(); } static void logic(void) @@ -154,6 +162,26 @@ static void draw(void) } break; } + + if (showingWidgets) + { + drawInGameWidgets(); + } +} + +static void drawInGameWidgets(void) +{ + int w, h; + + w = 300; + h = 350; + + drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 64); + + drawRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 0, 0, 0, 192); + drawOutlineRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 255, 255, 255, 255); + + drawWidgets(); } static void drawNormal(void) diff --git a/src/world/world.h b/src/world/world.h index 2bcd121..19d0964 100644 --- a/src/world/world.h +++ b/src/world/world.h @@ -72,6 +72,10 @@ extern void playMusic(int loop); extern void initRadar(void); extern void startSectionTransition(void); extern void endSectionTransition(void); +extern void drawWidgets(void); +extern void showWidgetGroup(char *group); +extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a); +extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a); extern App app; extern Colors colors;