Draw hud widgets.
This commit is contained in:
parent
03c02c01f9
commit
cdea5b42fb
|
@ -41,6 +41,7 @@ static void quit(void);
|
||||||
static void doCursor(void);
|
static void doCursor(void);
|
||||||
static void doMissionSelect(void);
|
static void doMissionSelect(void);
|
||||||
static void doMissionInfo(void);
|
static void doMissionInfo(void);
|
||||||
|
static void drawHudWidgets(void);
|
||||||
|
|
||||||
static HubMission hubMissionHead;
|
static HubMission hubMissionHead;
|
||||||
static HubMission *hubMissionTail;
|
static HubMission *hubMissionTail;
|
||||||
|
@ -205,15 +206,29 @@ static void logic(void)
|
||||||
|
|
||||||
animateSprites();
|
animateSprites();
|
||||||
|
|
||||||
doCursor();
|
if (!showingWidgets)
|
||||||
|
|
||||||
if (selectedMission == NULL)
|
|
||||||
{
|
{
|
||||||
doMissionSelect();
|
doCursor();
|
||||||
|
|
||||||
|
if (selectedMission == NULL)
|
||||||
|
{
|
||||||
|
doMissionSelect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
doMissionInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
doMissionInfo();
|
doWidgets();
|
||||||
|
|
||||||
|
if (app.keyboard[SDL_SCANCODE_ESCAPE])
|
||||||
|
{
|
||||||
|
showingWidgets = 0;
|
||||||
|
|
||||||
|
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +273,7 @@ static void doMissionSelect(void)
|
||||||
{
|
{
|
||||||
showWidgetGroup("hub");
|
showWidgetGroup("hub");
|
||||||
showingWidgets = 1;
|
showingWidgets = 1;
|
||||||
|
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
|
||||||
}
|
}
|
||||||
else if (isControl(CONTROL_FIRE) || app.mouse.button[SDL_BUTTON_LEFT])
|
else if (isControl(CONTROL_FIRE) || app.mouse.button[SDL_BUTTON_LEFT])
|
||||||
{
|
{
|
||||||
|
@ -303,14 +319,21 @@ static void draw(void)
|
||||||
|
|
||||||
drawInfoBar();
|
drawInfoBar();
|
||||||
|
|
||||||
if (selectedMission != NULL)
|
if (!showingWidgets)
|
||||||
{
|
{
|
||||||
drawMissionInfo();
|
if (selectedMission != NULL)
|
||||||
|
{
|
||||||
|
drawMissionInfo();
|
||||||
|
|
||||||
|
drawWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
drawWidgets();
|
blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1);
|
||||||
|
}
|
||||||
|
else if (showingWidgets)
|
||||||
|
{
|
||||||
|
drawHudWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawMissions(void)
|
static void drawMissions(void)
|
||||||
|
@ -359,6 +382,21 @@ static void drawInfoBar(void)
|
||||||
drawText(1010, 5, 18, TA_LEFT, colors.white, "Cells : %d / %d", game.stats[STAT_CELLS_FOUND], game.totalCells);
|
drawText(1010, 5, 18, TA_LEFT, colors.white, "Cells : %d / %d", game.stats[STAT_CELLS_FOUND], game.totalCells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drawHudWidgets(void)
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
w = 300;
|
||||||
|
h = 420;
|
||||||
|
|
||||||
|
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 drawMissionInfo(void)
|
static void drawMissionInfo(void)
|
||||||
{
|
{
|
||||||
int w, h, x, y, size, mid, i;
|
int w, h, x, y, size, mid, i;
|
||||||
|
|
|
@ -53,6 +53,7 @@ extern void initWorld(void);
|
||||||
extern void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect);
|
extern void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect);
|
||||||
extern void scrollBackground(float x, float y);
|
extern void scrollBackground(float x, float y);
|
||||||
extern double randF(void);
|
extern double randF(void);
|
||||||
|
extern void doWidgets(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue