bettola/client/src/game_state.h

51 lines
1.3 KiB
C++

#pragma once
#include <memory>
#include "gfx/types.h"
class DebugOverlay;
class ClientNetwork;
class Desktop;
class LoginScreen;
class BootSequence;
class MainMenu;
class ShapeRenderer;
class TextRenderer;
union SDL_Event;
enum class Screen {
LOGIN,
MAIN_MENU,
BOOTING,
DESKTOP
};
class GameState {
public:
GameState(void);
~GameState(void);
void init(int screen_width, int screen_height);
void start_single_player_now(int screen_width, int screen_height);
void handle_event(SDL_Event* event, int screen_width, int screen_height);
void update(float dt, int draw_calls, int shape_verts, int text_verts);
void render(const RenderContext& context);
private:
std::unique_ptr<ClientNetwork> _network;
std::unique_ptr<Desktop> _desktop;
std::unique_ptr<BootSequence> _boot_sequence;
std::unique_ptr<LoginScreen> _login_screen;
std::unique_ptr<MainMenu> _main_menu;
std::unique_ptr<DebugOverlay> _debug_overlay;
bool _show_debug_overlay;
Screen _current_screen;
int _screen_width;
int _screen_height;
bool _is_single_player;
void _init_desktop(void);
void _run_server(void);
};