2022-03-21 21:52:44 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-31 21:52:10 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void enableBetaQuest();
|
|
|
|
void disableBetaQuest();
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-05-11 13:35:03 -04:00
|
|
|
#include "GameOverlay.h"
|
2022-04-17 11:24:43 -04:00
|
|
|
#include "Lib/ImGui/imgui.h"
|
2022-06-27 19:43:28 -04:00
|
|
|
#include "Console.h"
|
2022-07-13 23:12:11 -04:00
|
|
|
#include "InputEditor.h"
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
struct GameAsset {
|
|
|
|
uint32_t textureId;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace SohImGui {
|
|
|
|
enum class Backend {
|
|
|
|
DX11,
|
2022-08-14 22:57:24 -04:00
|
|
|
SDL,
|
|
|
|
GX2,
|
2022-03-21 21:52:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class Dialogues {
|
|
|
|
dConsole,
|
|
|
|
dMenubar,
|
|
|
|
dLoadSettings,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Backend backend;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
void* window;
|
|
|
|
void* device_context;
|
|
|
|
void* device;
|
|
|
|
} dx11;
|
|
|
|
struct {
|
|
|
|
void* window;
|
|
|
|
void* context;
|
|
|
|
} sdl;
|
2022-08-14 22:57:24 -04:00
|
|
|
struct {
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
} gx2;
|
2022-03-21 21:52:44 -04:00
|
|
|
};
|
|
|
|
} WindowImpl;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
void* handle;
|
|
|
|
int msg;
|
|
|
|
int wparam;
|
|
|
|
int lparam;
|
|
|
|
} win32;
|
|
|
|
struct {
|
|
|
|
void* event;
|
|
|
|
} sdl;
|
2022-08-14 22:57:24 -04:00
|
|
|
struct {
|
|
|
|
void* input;
|
|
|
|
} gx2;
|
2022-03-21 21:52:44 -04:00
|
|
|
} EventImpl;
|
|
|
|
|
2022-04-03 15:47:24 -04:00
|
|
|
extern WindowImpl impl;
|
|
|
|
|
|
|
|
using WindowDrawFunc = void(*)(bool& enabled);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bool enabled;
|
|
|
|
WindowDrawFunc drawFunc;
|
|
|
|
} CustomWindow;
|
|
|
|
|
2022-08-09 23:15:07 -04:00
|
|
|
extern std::shared_ptr<Ship::Console> console;
|
2022-07-13 23:12:11 -04:00
|
|
|
extern Ship::InputEditor* controller;
|
2022-05-11 13:35:03 -04:00
|
|
|
extern Ship::GameOverlay* overlay;
|
|
|
|
extern bool needs_save;
|
2022-03-21 21:52:44 -04:00
|
|
|
void Init(WindowImpl window_impl);
|
|
|
|
void Update(EventImpl event);
|
2022-05-29 12:57:09 -04:00
|
|
|
void Tooltip(const char* text);
|
2022-07-13 23:12:11 -04:00
|
|
|
|
2022-05-29 11:47:09 -04:00
|
|
|
void EnhancementRadioButton(const char* text, const char* cvarName, int id);
|
|
|
|
void EnhancementCheckbox(const char* text, const char* cvarName);
|
|
|
|
void EnhancementButton(const char* text, const char* cvarName);
|
2022-07-18 19:26:01 -04:00
|
|
|
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false);
|
|
|
|
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = false);
|
2022-06-06 12:11:12 -04:00
|
|
|
void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue);
|
2022-05-29 12:57:09 -04:00
|
|
|
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
|
2022-06-16 20:40:27 -04:00
|
|
|
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
|
2022-05-02 18:24:12 -04:00
|
|
|
|
2022-08-08 19:52:34 -04:00
|
|
|
void applyEnhancementPresets(void);
|
|
|
|
void applyEnhancementPresetDefault(void);
|
|
|
|
void applyEnhancementPresetVanillaPlus(void);
|
|
|
|
void applyEnhancementPresetEnhanced(void);
|
|
|
|
void applyEnhancementPresetRandomizer(void);
|
|
|
|
|
2022-04-18 05:37:47 -04:00
|
|
|
void DrawMainMenuAndCalculateGameSize(void);
|
2022-07-13 23:12:11 -04:00
|
|
|
|
2022-04-18 05:37:47 -04:00
|
|
|
void DrawFramebufferAndGameInput(void);
|
|
|
|
void Render(void);
|
|
|
|
void CancelFrame(void);
|
2022-03-21 21:52:44 -04:00
|
|
|
void ShowCursor(bool hide, Dialogues w);
|
2022-07-31 23:36:21 -04:00
|
|
|
void BindCmd(const std::string& cmd, Ship::CommandEntry entry);
|
2022-07-11 21:33:48 -04:00
|
|
|
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false);
|
2022-04-17 11:24:43 -04:00
|
|
|
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1));
|
2022-05-29 12:57:09 -04:00
|
|
|
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false);
|
2022-07-11 21:33:48 -04:00
|
|
|
int ClampFloatToInt(float value, int min, int max);
|
2022-05-29 12:57:09 -04:00
|
|
|
void RandomizeColor(const char* cvarName, ImVec4* colors);
|
|
|
|
void RainbowColor(const char* cvarName, ImVec4* colors);
|
|
|
|
void ResetColor(const char* cvarName, ImVec4* colors, ImVec4 defaultcolors, bool has_alpha);
|
2022-04-03 15:47:24 -04:00
|
|
|
ImTextureID GetTextureByID(int id);
|
|
|
|
ImTextureID GetTextureByName(const std::string& name);
|
2022-07-13 23:12:11 -04:00
|
|
|
void BeginGroupPanel(const char* name, const ImVec2 & size = ImVec2(0.0f, 0.0f));
|
|
|
|
void EndGroupPanel(float minHeight = 0.0f);
|
2022-07-31 21:40:26 -04:00
|
|
|
std::string BreakTooltip(const char* text, int lineLength = 60);
|
|
|
|
std::string BreakTooltip(const std::string& text, int lineLength = 60);
|
2022-08-09 02:16:45 -04:00
|
|
|
void InsertPadding(float extraVerticalPadding = 0.0f);
|
|
|
|
void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f);
|
|
|
|
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true);
|
|
|
|
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true);
|
|
|
|
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
|
|
|
|
std::string GetWindowButtonText(const char* text, bool menuOpen);
|
2022-03-21 21:52:44 -04:00
|
|
|
}
|
2022-07-31 21:52:10 -04:00
|
|
|
|
2022-08-09 02:16:45 -04:00
|
|
|
#endif
|