mirror of
https://github.com/coah80/LegacyVulkEdition.git
synced 2026-07-19 06:58:07 +00:00
693 lines
23 KiB
C++
693 lines
23 KiB
C++
#include "stdafx.h"
|
|
#include "../Common/UI/UIScene.h"
|
|
#include "../Common/UI/UIEnums.h"
|
|
#include "User.h"
|
|
#include "StringHelpers.h"
|
|
|
|
#define NK_INCLUDE_FIXED_TYPES
|
|
#define NK_INCLUDE_STANDARD_IO
|
|
#define NK_INCLUDE_STANDARD_VARARGS
|
|
#define NK_INCLUDE_DEFAULT_ALLOCATOR
|
|
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
|
#define NK_INCLUDE_FONT_BAKING
|
|
#define NK_INCLUDE_DEFAULT_FONT
|
|
#include "nuklear.h"
|
|
|
|
#include "MenuScreens.h"
|
|
#include "NuklearBridge.h"
|
|
#include "NkCoreMenus.h"
|
|
#include "NkSettingsMenus.h"
|
|
#include "NkHUD.h"
|
|
#include "NkWorldMenus.h"
|
|
#include "NkInventoryMenus.h"
|
|
#include "NkContainerMenus.h"
|
|
#include "NkMiscMenus.h"
|
|
#include "NkBrowseMenus.h"
|
|
#include "NkGameMenus.h"
|
|
#include "NkScrollingMenus.h"
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
#include <cstdlib>
|
|
|
|
namespace lve { namespace ui {
|
|
|
|
static const float BASE_W = 1280.0f;
|
|
static const float BASE_H = 720.0f;
|
|
|
|
static const float LOGO_Y = 56.0f;
|
|
static const float LOGO_W = 1280.0f;
|
|
static const float LOGO_H = 138.0f;
|
|
|
|
static const float BUTTON_W = 600.0f;
|
|
static const float BUTTON_X = (1280.0f - BUTTON_W) * 0.5f;
|
|
static const float BUTTON_H = 40.0f;
|
|
static const float BUTTON_Y_START = 250.0f;
|
|
static const float BUTTON_Y_STEP = 50.0f;
|
|
|
|
enum MainMenuButton {
|
|
kButton_PlayGame = 0,
|
|
kButton_Leaderboards,
|
|
kButton_Achievements,
|
|
kButton_HelpAndOptions,
|
|
kButton_DLC,
|
|
kButton_QuitGame,
|
|
kButton_Count
|
|
};
|
|
|
|
static const char *kMainMenuLabels[kButton_Count] = {
|
|
"Play Game",
|
|
"Leaderboards",
|
|
"Achievements",
|
|
"Help & Options",
|
|
"Downloadable Content",
|
|
"Quit Game"
|
|
};
|
|
|
|
static struct nk_image imageFromSlot(const MenuTextureSlot &slot)
|
|
{
|
|
return nk_image_id(slot.id);
|
|
}
|
|
|
|
static void handlePlayGamePressed() {}
|
|
static void handleHelpAndOptionsPressed() {}
|
|
|
|
static MenuTextureSlot loadSlot(const char *path)
|
|
{
|
|
int w = 0, h = 0;
|
|
struct nk_image img = loadTextureWithSize(path, &w, &h);
|
|
return {img.handle.id, w, h};
|
|
}
|
|
|
|
static void zeroSlot(MenuTextureSlot &s)
|
|
{
|
|
s = {0, 0, 0};
|
|
}
|
|
|
|
NuklearSceneRenderer::NuklearSceneRenderer()
|
|
: m_textures()
|
|
, m_invTextures()
|
|
, m_containerTextures()
|
|
, m_browseTextures()
|
|
, m_hudTextures()
|
|
, m_state(kMenuState_MainMenu)
|
|
, m_stateStackDepth(0)
|
|
, m_createWorldState()
|
|
, m_loadMenuState()
|
|
, m_joinMenuState()
|
|
, m_hostOptionsState()
|
|
, m_playerOptionsState()
|
|
, m_inGameInfoState()
|
|
, m_signEntryState()
|
|
, m_teleportMenuState()
|
|
, m_launchMoreOptionsState()
|
|
, m_reinstallMenuState()
|
|
, m_debugOptionsState()
|
|
, m_debugOverlayState()
|
|
, m_timerState()
|
|
, m_keyboardState()
|
|
, m_quadrantSigninState()
|
|
, m_introState()
|
|
, m_messageBoxConfig()
|
|
, m_eulaState()
|
|
, m_connectingProgressState()
|
|
, m_fullscreenProgressState()
|
|
, m_creditsState()
|
|
, m_endPoemState()
|
|
, m_quit(false)
|
|
{
|
|
m_textures.loaded = false;
|
|
zeroSlot(m_textures.dirtTile);
|
|
zeroSlot(m_textures.logo);
|
|
zeroSlot(m_textures.buttonNormal);
|
|
zeroSlot(m_textures.buttonHover);
|
|
zeroSlot(m_textures.buttonOutline);
|
|
zeroSlot(m_textures.controllerA);
|
|
zeroSlot(m_textures.controllerB);
|
|
zeroSlot(m_textures.panorama);
|
|
zeroSlot(m_textures.sliderTrackActive);
|
|
zeroSlot(m_textures.sliderTrackInactive);
|
|
zeroSlot(m_textures.sliderThumb);
|
|
zeroSlot(m_textures.sliderBackground);
|
|
zeroSlot(m_textures.checkboxBackground);
|
|
zeroSlot(m_textures.checkboxHover);
|
|
zeroSlot(m_textures.checkboxTick);
|
|
|
|
m_invTextures.loaded = false;
|
|
m_containerTextures.loaded = false;
|
|
m_browseTextures.loaded = false;
|
|
m_hudTextures.loaded = false;
|
|
|
|
memset(m_stateStack, 0, sizeof(m_stateStack));
|
|
memset(&m_createWorldState, 0, sizeof(m_createWorldState));
|
|
memset(&m_loadMenuState, 0, sizeof(m_loadMenuState));
|
|
memset(&m_joinMenuState, 0, sizeof(m_joinMenuState));
|
|
memset(&m_hostOptionsState, 0, sizeof(m_hostOptionsState));
|
|
memset(&m_playerOptionsState, 0, sizeof(m_playerOptionsState));
|
|
memset(&m_inGameInfoState, 0, sizeof(m_inGameInfoState));
|
|
memset(&m_signEntryState, 0, sizeof(m_signEntryState));
|
|
memset(&m_teleportMenuState, 0, sizeof(m_teleportMenuState));
|
|
memset(&m_launchMoreOptionsState, 0, sizeof(m_launchMoreOptionsState));
|
|
memset(&m_reinstallMenuState, 0, sizeof(m_reinstallMenuState));
|
|
memset(&m_debugOptionsState, 0, sizeof(m_debugOptionsState));
|
|
memset(&m_debugOverlayState, 0, sizeof(m_debugOverlayState));
|
|
memset(&m_timerState, 0, sizeof(m_timerState));
|
|
memset(&m_keyboardState, 0, sizeof(m_keyboardState));
|
|
memset(&m_quadrantSigninState, 0, sizeof(m_quadrantSigninState));
|
|
memset(&m_messageBoxConfig, 0, sizeof(m_messageBoxConfig));
|
|
memset(&m_connectingProgressState, 0, sizeof(m_connectingProgressState));
|
|
memset(&m_fullscreenProgressState, 0, sizeof(m_fullscreenProgressState));
|
|
|
|
m_introState = createIntroState();
|
|
m_eulaState = createEulaState();
|
|
m_creditsState = createCreditsState();
|
|
m_endPoemState = createEndPoemState();
|
|
|
|
m_createWorldState.survivalMode = true;
|
|
m_createWorldState.difficulty = 1;
|
|
snprintf(m_createWorldState.worldName, sizeof(m_createWorldState.worldName), "My World");
|
|
}
|
|
|
|
bool NuklearSceneRenderer::init()
|
|
{
|
|
m_textures.dirtTile = loadSlot("../Assets/ui/skinHDGraphics/164_Dirt_Tile.png");
|
|
m_textures.logo = loadSlot("../Assets/ui/skinHDWin/180_MenuTitle.png");
|
|
m_textures.buttonNormal = loadSlot("../Assets/ui/skinHDGraphics/191_FJ_MainMenuButton_Norm.png");
|
|
m_textures.buttonHover = loadSlot("../Assets/ui/skinHDGraphics/189_MainMenuButton_Over.png");
|
|
m_textures.buttonOutline = loadSlot("../Assets/ui/skinHDGraphics/190_MainMenuButton_Outline.png");
|
|
m_textures.controllerA = loadSlot("../Assets/ui/skinHDWin/204_ButtonA.png");
|
|
m_textures.controllerB = loadSlot("../Assets/ui/skinHDWin/203_ButtonB.png");
|
|
m_textures.panorama = loadSlot("../Assets/ui/skinHDWin/205_Panorama_Background_S.jpg");
|
|
m_textures.sliderTrackActive = loadSlot("../Assets/ui/skinHDGraphics/99_Slider_Track_TintActive.png");
|
|
m_textures.sliderTrackInactive = loadSlot("../Assets/ui/skinHDGraphics/100_Slider_Track_TintInactive.png");
|
|
m_textures.sliderThumb = loadSlot("../Assets/ui/skinHDGraphics/181_Slider_Graphic.png");
|
|
m_textures.sliderBackground = loadSlot("../Assets/ui/skinHDGraphics/182_FJ_Slider_Background.png");
|
|
m_textures.checkboxBackground = loadSlot("../Assets/ui/skinHDGraphics/178_FJ_Tickbox_Background.png");
|
|
m_textures.checkboxHover = loadSlot("../Assets/ui/skinHDGraphics/176_Tickbox_Over.png");
|
|
m_textures.checkboxTick = loadSlot("../Assets/ui/skinHDGraphics/177_Tick.png");
|
|
m_textures.textInputBg = loadSlot("../Assets/ui/skinHDGraphics/106_TextInputBG.png");
|
|
m_textures.textInputBorder = loadSlot("../Assets/ui/skinHDGraphics/104_TextInputBGBorder.png");
|
|
m_textures.textInputSelectedBorder = loadSlot("../Assets/ui/skinHDGraphics/103_TextInputSelectedBorder.png");
|
|
m_textures.textInputCaret = loadSlot("../Assets/ui/skinHDGraphics/105_Caret.png");
|
|
|
|
m_textures.loaded = (m_textures.dirtTile.w > 0 && m_textures.logo.w > 0 &&
|
|
m_textures.buttonNormal.w > 0 && m_textures.buttonHover.w > 0);
|
|
|
|
if (!m_textures.loaded)
|
|
fprintf(stderr, "[MenuScreens] WARNING: some textures failed to load\n");
|
|
|
|
if (m_textures.panorama.w <= 0 || m_textures.panorama.h <= 0)
|
|
fprintf(stderr, "[MenuScreens] WARNING: panorama texture failed to load from ../Assets/ui/skinHDWin/205_Panorama_Background_S.jpg\n");
|
|
|
|
loadInventoryMenuTextures(m_invTextures);
|
|
loadContainerMenuTextures(m_containerTextures);
|
|
initBrowseMenuTextures(m_browseTextures);
|
|
initHUDTextures(m_hudTextures);
|
|
|
|
return true;
|
|
}
|
|
|
|
void NuklearSceneRenderer::shutdown()
|
|
{
|
|
}
|
|
|
|
bool NuklearSceneRenderer::shouldQuit() const
|
|
{
|
|
return m_quit;
|
|
}
|
|
|
|
void NuklearSceneRenderer::setState(MenuState state)
|
|
{
|
|
m_state = state;
|
|
}
|
|
|
|
MenuState NuklearSceneRenderer::getState() const
|
|
{
|
|
return m_state;
|
|
}
|
|
|
|
void NuklearSceneRenderer::pushState(MenuState state)
|
|
{
|
|
if (m_stateStackDepth < MAX_STATE_STACK) {
|
|
m_stateStack[m_stateStackDepth] = m_state;
|
|
m_stateStackDepth++;
|
|
}
|
|
m_state = state;
|
|
}
|
|
|
|
void NuklearSceneRenderer::popState()
|
|
{
|
|
if (m_stateStackDepth > 0) {
|
|
m_stateStackDepth--;
|
|
m_state = m_stateStack[m_stateStackDepth];
|
|
}
|
|
}
|
|
|
|
static bool isEscapePressed(nk_context *ctx)
|
|
{
|
|
return nk_input_is_key_released(&ctx->input, NK_KEY_BACKSPACE) != 0;
|
|
}
|
|
|
|
void NuklearSceneRenderer::render(int windowW, int windowH)
|
|
{
|
|
nk_context *ctx = getNkContext();
|
|
if (ctx == nullptr) return;
|
|
|
|
float dt = 1.0f / 60.0f;
|
|
|
|
switch (m_state) {
|
|
case kMenuState_MainMenu: {
|
|
MenuAction action = lve::ui::renderMainMenu(ctx, windowW, windowH, m_textures);
|
|
switch (action) {
|
|
case kMenuAction_PlayGame:
|
|
pushState(kMenuState_LoadOrJoin);
|
|
break;
|
|
case kMenuAction_HelpAndOptions:
|
|
pushState(kMenuState_HelpAndOptions);
|
|
break;
|
|
case kMenuAction_Leaderboards:
|
|
pushState(kMenuState_Leaderboards);
|
|
break;
|
|
case kMenuAction_DLC:
|
|
pushState(kMenuState_DLCMain);
|
|
break;
|
|
case kMenuAction_QuitGame:
|
|
m_quit = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
} break;
|
|
|
|
case kMenuState_HelpAndOptions: {
|
|
SettingsAction action = renderHelpAndOptions(ctx, windowW, windowH, m_textures);
|
|
switch (action) {
|
|
case kSettingsAction_ChangeSkin:
|
|
pushState(kMenuState_SkinSelect);
|
|
break;
|
|
case kSettingsAction_HowToPlay:
|
|
pushState(kMenuState_HowToPlay);
|
|
break;
|
|
case kSettingsAction_Controls:
|
|
pushState(kMenuState_Controls);
|
|
break;
|
|
case kSettingsAction_Settings:
|
|
pushState(kMenuState_SettingsHub);
|
|
break;
|
|
case kSettingsAction_Credits:
|
|
m_creditsState = createCreditsState();
|
|
pushState(kMenuState_Credits);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kSettingsAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_SettingsHub: {
|
|
SettingsAction action = renderSettingsHub(ctx, windowW, windowH, m_textures);
|
|
switch (action) {
|
|
case kSettingsAction_Options:
|
|
pushState(kMenuState_SettingsOptions);
|
|
break;
|
|
case kSettingsAction_Audio:
|
|
pushState(kMenuState_SettingsAudio);
|
|
break;
|
|
case kSettingsAction_Control:
|
|
pushState(kMenuState_SettingsControl);
|
|
break;
|
|
case kSettingsAction_Graphics:
|
|
pushState(kMenuState_SettingsGraphics);
|
|
break;
|
|
case kSettingsAction_UserInterface:
|
|
pushState(kMenuState_SettingsUI);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kSettingsAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_SettingsOptions:
|
|
renderSettingsOptions(ctx, windowW, windowH, m_textures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_SettingsAudio:
|
|
renderSettingsAudio(ctx, windowW, windowH, m_textures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_SettingsControl:
|
|
renderSettingsControl(ctx, windowW, windowH, m_textures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_SettingsGraphics:
|
|
renderSettingsGraphics(ctx, windowW, windowH, m_textures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_SettingsUI:
|
|
renderSettingsUI(ctx, windowW, windowH, m_textures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_SkinSelect:
|
|
renderSkinSelectMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_HowToPlay:
|
|
renderHowToPlayMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_HowToPlayPage:
|
|
renderHowToPlayPage(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Controls:
|
|
renderControlsMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Leaderboards:
|
|
renderLeaderboardsMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_DLCMain:
|
|
renderDLCMainMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_DLCOffers:
|
|
renderDLCOffersMenu(ctx, windowW, windowH, m_textures, m_browseTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Credits: {
|
|
ScrollMenuAction action = renderCredits(ctx, windowW, windowH, m_textures, m_creditsState, dt);
|
|
if (action == kScrollAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_EndPoem: {
|
|
ScrollMenuAction action = renderEndPoem(ctx, windowW, windowH, m_textures, m_endPoemState, dt);
|
|
if (action == kScrollAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_LoadOrJoin: {
|
|
WorldMenuAction action = renderLoadOrJoin(ctx, windowW, windowH, m_textures, m_loadMenuState);
|
|
switch (action) {
|
|
case kWorldAction_CreateWorld:
|
|
memset(&m_createWorldState, 0, sizeof(m_createWorldState));
|
|
m_createWorldState.survivalMode = true;
|
|
m_createWorldState.difficulty = 1;
|
|
snprintf(m_createWorldState.worldName, sizeof(m_createWorldState.worldName), "My World");
|
|
pushState(kMenuState_CreateWorld);
|
|
break;
|
|
case kWorldAction_LoadWorld:
|
|
pushState(kMenuState_LoadMenu);
|
|
break;
|
|
case kWorldAction_JoinGame:
|
|
memset(&m_joinMenuState, 0, sizeof(m_joinMenuState));
|
|
pushState(kMenuState_JoinMenu);
|
|
break;
|
|
case kWorldAction_Back:
|
|
popState();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kWorldAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_CreateWorld: {
|
|
WorldMenuAction action = renderCreateWorld(ctx, windowW, windowH, m_textures, m_createWorldState);
|
|
switch (action) {
|
|
case kWorldAction_MoreOptions:
|
|
memset(&m_launchMoreOptionsState, 0, sizeof(m_launchMoreOptionsState));
|
|
pushState(kMenuState_LaunchMoreOptions);
|
|
break;
|
|
case kWorldAction_CreateNewWorld:
|
|
popState();
|
|
break;
|
|
case kWorldAction_Back:
|
|
popState();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kWorldAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_LoadMenu: {
|
|
WorldMenuAction action = renderLoadMenu(ctx, windowW, windowH, m_textures, m_loadMenuState);
|
|
if (action == kWorldAction_PlayGame || action == kWorldAction_LoadWorld ||
|
|
action == kWorldAction_Back)
|
|
popState();
|
|
if (action == kWorldAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_JoinMenu: {
|
|
WorldMenuAction action = renderJoinMenu(ctx, windowW, windowH, m_textures, m_joinMenuState);
|
|
if (action == kWorldAction_JoinGame || action == kWorldAction_SelectServer ||
|
|
action == kWorldAction_Back)
|
|
popState();
|
|
if (action == kWorldAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_LaunchMoreOptions: {
|
|
GameMenuAction action = renderLaunchMoreOptions(ctx, windowW, windowH, m_textures, m_launchMoreOptionsState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_PauseMenu: {
|
|
MenuAction action = renderPauseMenu(ctx, windowW, windowH, m_textures);
|
|
switch (action) {
|
|
case kMenuAction_ResumeGame:
|
|
popState();
|
|
break;
|
|
case kMenuAction_HelpAndOptions:
|
|
pushState(kMenuState_HelpAndOptions);
|
|
break;
|
|
case kMenuAction_Leaderboards:
|
|
pushState(kMenuState_Leaderboards);
|
|
break;
|
|
case kMenuAction_SaveGame:
|
|
break;
|
|
case kMenuAction_ExitGame:
|
|
m_stateStackDepth = 0;
|
|
m_state = kMenuState_MainMenu;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kMenuAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_DeathMenu: {
|
|
MenuAction action = renderDeathMenu(ctx, windowW, windowH, m_textures);
|
|
switch (action) {
|
|
case kMenuAction_Respawn:
|
|
popState();
|
|
break;
|
|
case kMenuAction_ExitGame:
|
|
m_stateStackDepth = 0;
|
|
m_state = kMenuState_MainMenu;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
} break;
|
|
|
|
case kMenuState_HUD:
|
|
renderHUD(ctx, windowW, windowH, m_hudTextures);
|
|
break;
|
|
|
|
case kMenuState_Inventory:
|
|
renderInventory(ctx, windowW, windowH, m_textures, m_invTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Crafting2x2:
|
|
renderCrafting2x2(ctx, windowW, windowH, m_textures, m_invTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Crafting3x3:
|
|
renderCrafting3x3(ctx, windowW, windowH, m_textures, m_invTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Creative:
|
|
renderCreative(ctx, windowW, windowH, m_textures, m_invTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Furnace:
|
|
renderFurnace(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Container:
|
|
renderContainer(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Anvil:
|
|
renderAnvil(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_BrewingStand:
|
|
renderBrewingStand(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Enchanting:
|
|
renderEnchanting(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Trading:
|
|
renderTrading(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_Dispenser:
|
|
renderDispenser(ctx, windowW, windowH, m_textures, m_containerTextures);
|
|
if (isEscapePressed(ctx)) popState();
|
|
break;
|
|
|
|
case kMenuState_HostOptions: {
|
|
GameMenuAction action = renderHostOptions(ctx, windowW, windowH, m_textures, m_hostOptionsState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_PlayerOptions: {
|
|
GameMenuAction action = renderPlayerOptions(ctx, windowW, windowH, m_textures, m_playerOptionsState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_InGameInfo: {
|
|
GameMenuAction action = renderInGameInfo(ctx, windowW, windowH, m_textures, m_inGameInfoState);
|
|
switch (action) {
|
|
case kGameAction_HostOptions:
|
|
pushState(kMenuState_HostOptions);
|
|
break;
|
|
case kGameAction_TeleportSelect:
|
|
pushState(kMenuState_TeleportMenu);
|
|
break;
|
|
case kGameAction_Back:
|
|
popState();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (action == kGameAction_None && isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_SignEntry: {
|
|
GameMenuAction action = renderSignEntry(ctx, windowW, windowH, m_textures, m_signEntryState);
|
|
if (action == kGameAction_SignDone || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_TeleportMenu: {
|
|
GameMenuAction action = renderTeleportMenu(ctx, windowW, windowH, m_textures, m_teleportMenuState);
|
|
if (action == kGameAction_Back || action == kGameAction_TeleportToPlayer ||
|
|
action == kGameAction_TeleportToMe || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_ReinstallMenu: {
|
|
GameMenuAction action = renderReinstallMenu(ctx, windowW, windowH, m_textures, m_reinstallMenuState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_DebugOptions: {
|
|
GameMenuAction action = renderDebugOptions(ctx, windowW, windowH, m_textures, m_debugOptionsState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_DebugOverlay: {
|
|
GameMenuAction action = renderDebugOverlay(ctx, windowW, windowH, m_textures, m_debugOverlayState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_Timer: {
|
|
GameMenuAction action = renderTimerScreen(ctx, windowW, windowH, m_textures, m_timerState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_Keyboard: {
|
|
GameMenuAction action = renderKeyboardScreen(ctx, windowW, windowH, m_textures, m_keyboardState);
|
|
if (action == kGameAction_KeyboardDone || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_QuadrantSignin: {
|
|
GameMenuAction action = renderQuadrantSignin(ctx, windowW, windowH, m_textures, m_quadrantSigninState);
|
|
if (action == kGameAction_Back || isEscapePressed(ctx))
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_Intro: {
|
|
MiscMenuAction action = renderIntro(ctx, windowW, windowH, m_textures, m_introState, dt);
|
|
if (action == kMiscAction_Continue)
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_MessageBox: {
|
|
MiscMenuAction action = renderMessageBox(ctx, windowW, windowH, m_textures, m_messageBoxConfig);
|
|
if (action != kMiscAction_None)
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_Eula: {
|
|
MiscMenuAction action = renderEula(ctx, windowW, windowH, m_textures, m_eulaState);
|
|
if (action == kMiscAction_Accept || action == kMiscAction_Decline)
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_SaveMessage: {
|
|
MiscMenuAction action = renderSaveMessage(ctx, windowW, windowH, m_textures);
|
|
if (action == kMiscAction_Continue)
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_ConnectingProgress: {
|
|
MiscMenuAction action = renderConnectingProgress(ctx, windowW, windowH, m_textures, m_connectingProgressState);
|
|
if (action == kMiscAction_Cancel)
|
|
popState();
|
|
} break;
|
|
|
|
case kMenuState_FullscreenProgress: {
|
|
MiscMenuAction action = renderFullscreenProgress(ctx, windowW, windowH, m_textures, m_fullscreenProgressState);
|
|
if (action == kMiscAction_Cancel)
|
|
popState();
|
|
} break;
|
|
}
|
|
}
|
|
|
|
}}
|