88 lines
2.2 KiB
C++
88 lines
2.2 KiB
C++
#pragma once
|
|
#include "render/Renderer.h"
|
|
#include "Environment.h"
|
|
#include "render/TextureManager.h"
|
|
#include "UiManager.h"
|
|
|
|
namespace ZL {
|
|
|
|
extern const char* CONST_ZIP_FILE;
|
|
|
|
enum class GameState {
|
|
MainMenu,
|
|
AboutMenu,
|
|
ShipSelectionSingle,
|
|
ShipSelectionMulti,
|
|
Connecting,
|
|
ConnectionFailed,
|
|
Gameplay,
|
|
GameOver,
|
|
HelpScreen,
|
|
ConnectionLost
|
|
};
|
|
|
|
class MenuManager {
|
|
protected:
|
|
Renderer& renderer;
|
|
/*
|
|
// Pre-loaded UI roots (loaded once in setupMenu)
|
|
std::shared_ptr<UiNode> mainMenuRoot;
|
|
std::shared_ptr<UiNode> aboutMenuRoot;
|
|
std::shared_ptr<UiNode> shipSelectionRoot;
|
|
std::shared_ptr<UiNode> connectingRoot;
|
|
std::shared_ptr<UiNode> connectionFailedRoot;
|
|
std::shared_ptr<UiNode> gameplayRoot;
|
|
std::shared_ptr<UiNode> gameOverRoot;
|
|
std::shared_ptr<UiNode> helpScreenRoot;
|
|
std::shared_ptr<UiNode> connectionLostRoot;
|
|
|
|
// Stored for multiplayer retry
|
|
std::string pendingMultiNick;
|
|
int pendingMultiShipType = 0;
|
|
|
|
GameState state = GameState::MainMenu;
|
|
|
|
// State transition methods
|
|
void enterMainMenu();
|
|
void enterAboutMenu();
|
|
void enterShipSelectionSingle();
|
|
void enterShipSelectionMulti();
|
|
void enterConnecting();
|
|
void enterConnectionFailed();
|
|
void enterGameplay();
|
|
void enterGameOver(int score);
|
|
void enterHelp();
|
|
void enterConnectionLost();
|
|
*/
|
|
public:
|
|
UiManager uiManager;
|
|
|
|
MenuManager(Renderer& iRenderer);
|
|
|
|
//void setupMenu();
|
|
|
|
/*
|
|
// Returns true for states where Space should render and run (Gameplay, GameOver, ConnectionLost)
|
|
bool shouldRenderSpace() const;
|
|
GameState getState() const { return state; }
|
|
|
|
// Called by game events
|
|
void showGameOver(int score);
|
|
void showConnectionLost();
|
|
void notifyConnected();
|
|
void notifyConnectionFailed();
|
|
|
|
// Callbacks set by Game/Space
|
|
std::function<void()> onMainMenuEntered;
|
|
std::function<void()> onRestartPressed;
|
|
std::function<void(float)> onVelocityChanged;
|
|
std::function<void()> onFirePressed;
|
|
std::function<void()> onTakeButtonPressed;
|
|
std::function<void(const std::string&, int)> onSingleplayerPressed;
|
|
std::function<void(const std::string&, int)> onMultiplayerPressed;
|
|
std::function<void()> onShowPlayersPressed;
|
|
|
|
std::function<void()> forceSetupSpaceUICallback;*/
|
|
};
|
|
|
|
} // namespace ZL
|