104 lines
2.4 KiB
C++
104 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "character.h"
|
|
#include "save.h"
|
|
#include <imgui.h>
|
|
|
|
constexpr float FONT_NORMAL = 30;
|
|
constexpr float FONT_HEADER_3 = 34;
|
|
constexpr float FONT_HEADER_2 = 40;
|
|
constexpr float FONT_DIALOGUE = 38;
|
|
|
|
class Play;
|
|
|
|
enum Direction
|
|
{
|
|
DIRECTION_UP,
|
|
DIRECTION_DOWN
|
|
};
|
|
|
|
enum Panel
|
|
{
|
|
PANEL_NONE,
|
|
PANEL_STATS,
|
|
PANEL_CATALOG,
|
|
PANEL_SETTINGS,
|
|
PANEL_CHEATS
|
|
};
|
|
|
|
enum ButtonState
|
|
{
|
|
BUTTON_NORMAL,
|
|
BUTTON_ACTIVE,
|
|
BUTTON_DISABLED
|
|
};
|
|
|
|
enum CommandType
|
|
{
|
|
COMMAND_CONTINUE,
|
|
COMMAND_NEW_GAME,
|
|
COMMAND_MENU,
|
|
COMMAND_SAVE,
|
|
COMMAND_RELOAD,
|
|
COMMAND_FULLSCREEN
|
|
};
|
|
|
|
// A request, from the UI or the console, for the game to change what's running. Character names a character's folder.
|
|
struct Command
|
|
{
|
|
std::string character;
|
|
CommandType type = COMMAND_MENU;
|
|
};
|
|
|
|
using Commands = std::vector<Command>;
|
|
|
|
void style_set(Color color);
|
|
|
|
// The taskbar, its windows, the dialogue box, toasts and the select screen.
|
|
class Ui
|
|
{
|
|
public:
|
|
std::vector<Canvas> itemCanvases;
|
|
std::vector<ImVec2> itemSizes;
|
|
Actor previewActor;
|
|
Anm2 iconsDefault;
|
|
Canvas previewCanvas;
|
|
Stats selectedStats;
|
|
Audio* audio = nullptr;
|
|
Character* catalogCharacter = nullptr;
|
|
Character* character = nullptr;
|
|
Commands* commands = nullptr;
|
|
Measurement* measurement = nullptr;
|
|
Renderer* renderer = nullptr;
|
|
float buttonSize = 0;
|
|
float taskbarSlide = 1;
|
|
int characterIndex = 0;
|
|
int selectedIndex = -1;
|
|
int selectedItem = -1;
|
|
Panel panel = PANEL_NONE;
|
|
bool isFullscreen = false;
|
|
bool isNewGameWarning = false;
|
|
bool isPreviewRender = false;
|
|
bool isSelectedSaved = false;
|
|
bool isWindowOpen = false;
|
|
|
|
void play_update(Play& play, Settings& settings);
|
|
void select_update(std::vector<Character>& characters, Settings& settings);
|
|
|
|
private:
|
|
bool is_fx(bool result);
|
|
bool icon_button(const char* icon, const char* tooltip, ButtonState state);
|
|
void icon_draw(const char* name, ImVec2 position, float size, ImU32 tint);
|
|
void command_add(CommandType type, const std::string& key = "");
|
|
void sound_play(SoundId id);
|
|
void taskbar_draw(Play& play, ImVec2 screen);
|
|
bool window_begin(ImVec2 screen, float inset);
|
|
void window_end();
|
|
void stats_draw(Play& play);
|
|
void cheats_draw(Play& play);
|
|
void catalog_draw(Play& play);
|
|
void settings_draw(Settings& settings);
|
|
void text_draw(Play& play, ImVec2 screen);
|
|
void toasts_draw(Play& play);
|
|
};
|