Add Main menu screen
This commit is contained in:
11
game/main.c
11
game/main.c
@@ -152,6 +152,7 @@ bool init(void *userData) {
|
||||
ecs_singleton_set(ECS, Game, {});
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
game->screen = SCREEN_MAIN_MENU;
|
||||
game->font = LoadFontEx("assets/fonts/CompassPro.ttf", 92, NULL, 0);
|
||||
|
||||
ECS_COMPONENT_DEFINE(ECS, InputState);
|
||||
ecs_singleton_set(ECS, InputState, {});
|
||||
@@ -248,6 +249,8 @@ void deinit(void *userData) {
|
||||
|
||||
bzUIDestroy(UI);
|
||||
UI = NULL;
|
||||
|
||||
UnloadFont(game->font);
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +322,7 @@ static void renderMainMenu(Game *game, float dt) {
|
||||
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
||||
.flags = BZ_UI_FLEX_DIR_COLUMN | BZ_UI_FLEX_JUSTIFY_CENTER | BZ_UI_FLEX_ALIGN_CENTER
|
||||
});
|
||||
uiLargeLabel("PixelDefense");
|
||||
uiMainMenuLabel("Pixel Defense");
|
||||
bzUIPopParent(UI);
|
||||
|
||||
uiPushDivParentPercentage(1.0f, 0.6f);
|
||||
@@ -327,14 +330,14 @@ static void renderMainMenu(Game *game, float dt) {
|
||||
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
||||
.flags = BZ_UI_FLEX_DIR_COLUMN | BZ_UI_FLEX_ALIGN_CENTER
|
||||
});
|
||||
if (uiLargeTextButton("Play")) {
|
||||
if (uiMainMenuButton("Play")) {
|
||||
bzLogInfo("Play");
|
||||
game->screen = SCREEN_GAME;
|
||||
}
|
||||
if (uiLargeTextButton("Settings")) {
|
||||
if (uiMainMenuButton("Settings")) {
|
||||
bzLogInfo("Settings");
|
||||
}
|
||||
if (uiLargeTextButton("Exit")) {
|
||||
if (uiMainMenuButton("Exit")) {
|
||||
bzLogInfo("Bye");
|
||||
bzGameExit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user