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 Camera *gCamera = NULL;
|
||||||
static Screen *creditsScreen = NULL;
|
static Screen *creditsScreen = NULL;
|
||||||
static Screen *scoreScreen = NULL;
|
static Screen *scoreScreen = NULL;
|
||||||
|
static Screen *characterSelectScreen = NULL;
|
||||||
static Sprite *new_skill_tooltip = NULL;
|
static Sprite *new_skill_tooltip = NULL;
|
||||||
static Sprite *howto_tooltip = NULL;
|
static Sprite *howto_tooltip = NULL;
|
||||||
static Sprite *new_artifact_tooltip = NULL;
|
static Sprite *new_artifact_tooltip = NULL;
|
||||||
|
@ -474,6 +475,7 @@ initMainMenu(void)
|
||||||
mixer_play_music(MENU_MUSIC);
|
mixer_play_music(MENU_MUSIC);
|
||||||
creditsScreen = screen_create_credits(gRenderer);
|
creditsScreen = screen_create_credits(gRenderer);
|
||||||
scoreScreen = screen_create_hiscore(gRenderer);
|
scoreScreen = screen_create_hiscore(gRenderer);
|
||||||
|
characterSelectScreen = screen_create_characterselect(gRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -505,6 +507,10 @@ resetGame(void)
|
||||||
screen_destroy(scoreScreen);
|
screen_destroy(scoreScreen);
|
||||||
scoreScreen = NULL;
|
scoreScreen = NULL;
|
||||||
|
|
||||||
|
if (characterSelectScreen)
|
||||||
|
screen_destroy(characterSelectScreen);
|
||||||
|
characterSelectScreen = NULL;
|
||||||
|
|
||||||
if (inGameMenu)
|
if (inGameMenu)
|
||||||
menu_destroy(inGameMenu);
|
menu_destroy(inGameMenu);
|
||||||
inGameMenu = NULL;
|
inGameMenu = NULL;
|
||||||
|
@ -1007,8 +1013,10 @@ run_menu(void)
|
||||||
|
|
||||||
if (gGameState == MENU)
|
if (gGameState == MENU)
|
||||||
menu_render(mainMenu, gCamera);
|
menu_render(mainMenu, gCamera);
|
||||||
if (gGameState == CHARACTER_MENU)
|
if (gGameState == CHARACTER_MENU) {
|
||||||
|
screen_render(characterSelectScreen, gCamera);
|
||||||
menu_render(charSelectMenu, gCamera);
|
menu_render(charSelectMenu, gCamera);
|
||||||
|
}
|
||||||
else if (gGameState == CREDITS)
|
else if (gGameState == CREDITS)
|
||||||
screen_render(creditsScreen, gCamera);
|
screen_render(creditsScreen, gCamera);
|
||||||
else if (gGameState == SCORE_SCREEN)
|
else if (gGameState == SCORE_SCREEN)
|
||||||
|
@ -1119,6 +1127,8 @@ void close(void)
|
||||||
screen_destroy(creditsScreen);
|
screen_destroy(creditsScreen);
|
||||||
if (scoreScreen)
|
if (scoreScreen)
|
||||||
screen_destroy(scoreScreen);
|
screen_destroy(scoreScreen);
|
||||||
|
if (characterSelectScreen)
|
||||||
|
screen_destroy(characterSelectScreen);
|
||||||
if (inGameMenu)
|
if (inGameMenu)
|
||||||
menu_destroy(inGameMenu);
|
menu_destroy(inGameMenu);
|
||||||
|
|
||||||
|
|
16
src/screen.c
16
src/screen.c
|
@ -169,6 +169,22 @@ screen_create_hiscore(SDL_Renderer *renderer)
|
||||||
return screen;
|
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
|
void
|
||||||
screen_render(Screen *screen, Camera *cam)
|
screen_render(Screen *screen, Camera *cam)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,9 @@ screen_create_credits(SDL_Renderer*);
|
||||||
Screen *
|
Screen *
|
||||||
screen_create_hiscore(SDL_Renderer*);
|
screen_create_hiscore(SDL_Renderer*);
|
||||||
|
|
||||||
|
Screen *
|
||||||
|
screen_create_characterselect(SDL_Renderer*);
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_render(Screen *screen, Camera *cam);
|
screen_render(Screen *screen, Camera *cam);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue