Add a title to char select menu.
This commit is contained in:
parent
1a0d806459
commit
f895fdb35e
12
src/main.c
12
src/main.c
|
@ -153,6 +153,7 @@ static Timer *menuTimer = NULL;
|
|||
static Camera *gCamera = NULL;
|
||||
static Screen *creditsScreen = NULL;
|
||||
static Screen *scoreScreen = NULL;
|
||||
static Screen *characterSelectScreen = NULL;
|
||||
static Sprite *new_skill_tooltip = NULL;
|
||||
static Sprite *howto_tooltip = NULL;
|
||||
static Sprite *new_artifact_tooltip = NULL;
|
||||
|
@ -474,6 +475,7 @@ initMainMenu(void)
|
|||
mixer_play_music(MENU_MUSIC);
|
||||
creditsScreen = screen_create_credits(gRenderer);
|
||||
scoreScreen = screen_create_hiscore(gRenderer);
|
||||
characterSelectScreen = screen_create_characterselect(gRenderer);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -505,6 +507,10 @@ resetGame(void)
|
|||
screen_destroy(scoreScreen);
|
||||
scoreScreen = NULL;
|
||||
|
||||
if (characterSelectScreen)
|
||||
screen_destroy(characterSelectScreen);
|
||||
characterSelectScreen = NULL;
|
||||
|
||||
if (inGameMenu)
|
||||
menu_destroy(inGameMenu);
|
||||
inGameMenu = NULL;
|
||||
|
@ -1007,8 +1013,10 @@ run_menu(void)
|
|||
|
||||
if (gGameState == MENU)
|
||||
menu_render(mainMenu, gCamera);
|
||||
if (gGameState == CHARACTER_MENU)
|
||||
if (gGameState == CHARACTER_MENU) {
|
||||
screen_render(characterSelectScreen, gCamera);
|
||||
menu_render(charSelectMenu, gCamera);
|
||||
}
|
||||
else if (gGameState == CREDITS)
|
||||
screen_render(creditsScreen, gCamera);
|
||||
else if (gGameState == SCORE_SCREEN)
|
||||
|
@ -1119,6 +1127,8 @@ void close(void)
|
|||
screen_destroy(creditsScreen);
|
||||
if (scoreScreen)
|
||||
screen_destroy(scoreScreen);
|
||||
if (characterSelectScreen)
|
||||
screen_destroy(characterSelectScreen);
|
||||
if (inGameMenu)
|
||||
menu_destroy(inGameMenu);
|
||||
|
||||
|
|
16
src/screen.c
16
src/screen.c
|
@ -169,6 +169,22 @@ screen_create_hiscore(SDL_Renderer *renderer)
|
|||
return screen;
|
||||
}
|
||||
|
||||
Screen *
|
||||
screen_create_characterselect(SDL_Renderer *renderer)
|
||||
{
|
||||
Screen *screen = screen_create();
|
||||
|
||||
Sprite *s = sprite_create();
|
||||
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 18, 1);
|
||||
texture_load_from_text(s->textures[0], "Choose your class:", C_BLUE, C_WHITE, renderer);
|
||||
s->pos = (Position) { (SCREEN_WIDTH - s->textures[0]->dim.width) >> 1, 80 };
|
||||
s->fixed = true;
|
||||
s->dim = s->textures[0]->dim;
|
||||
|
||||
linkedlist_push(&screen->sprites, s);
|
||||
return screen;
|
||||
}
|
||||
|
||||
void
|
||||
screen_render(Screen *screen, Camera *cam)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,9 @@ screen_create_credits(SDL_Renderer*);
|
|||
Screen *
|
||||
screen_create_hiscore(SDL_Renderer*);
|
||||
|
||||
Screen *
|
||||
screen_create_characterselect(SDL_Renderer*);
|
||||
|
||||
void
|
||||
screen_render(Screen *screen, Camera *cam);
|
||||
|
||||
|
|
Loading…
Reference in New Issue