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 doMissionSelect(void);
|
||||
static void doMissionInfo(void);
|
||||
static void drawHudWidgets(void);
|
||||
|
||||
static HubMission hubMissionHead;
|
||||
static HubMission *hubMissionTail;
|
||||
|
@ -205,6 +206,8 @@ static void logic(void)
|
|||
|
||||
animateSprites();
|
||||
|
||||
if (!showingWidgets)
|
||||
{
|
||||
doCursor();
|
||||
|
||||
if (selectedMission == NULL)
|
||||
|
@ -215,6 +218,18 @@ static void logic(void)
|
|||
{
|
||||
doMissionInfo();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
doWidgets();
|
||||
|
||||
if (app.keyboard[SDL_SCANCODE_ESCAPE])
|
||||
{
|
||||
showingWidgets = 0;
|
||||
|
||||
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void doCursor(void)
|
||||
|
@ -258,6 +273,7 @@ static void doMissionSelect(void)
|
|||
{
|
||||
showWidgetGroup("hub");
|
||||
showingWidgets = 1;
|
||||
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
|
||||
}
|
||||
else if (isControl(CONTROL_FIRE) || app.mouse.button[SDL_BUTTON_LEFT])
|
||||
{
|
||||
|
@ -303,6 +319,8 @@ static void draw(void)
|
|||
|
||||
drawInfoBar();
|
||||
|
||||
if (!showingWidgets)
|
||||
{
|
||||
if (selectedMission != NULL)
|
||||
{
|
||||
drawMissionInfo();
|
||||
|
@ -311,6 +329,11 @@ static void draw(void)
|
|||
}
|
||||
|
||||
blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1);
|
||||
}
|
||||
else if (showingWidgets)
|
||||
{
|
||||
drawHudWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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 scrollBackground(float x, float y);
|
||||
extern double randF(void);
|
||||
extern void doWidgets(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
Loading…
Reference in New Issue