2022-05-11 13:35:03 -04:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Lib/ImGui/imgui.h"
|
|
|
|
#include <map>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
enum class OverlayType {
|
2022-05-11 19:07:35 -04:00
|
|
|
TEXT, IMAGE, NOTIFICATION
|
2022-05-11 13:35:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Overlay {
|
|
|
|
OverlayType type;
|
|
|
|
const char* value;
|
2022-05-11 19:07:35 -04:00
|
|
|
float fadeTime;
|
|
|
|
float duration;
|
2022-05-11 13:35:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace Ship {
|
|
|
|
class GameOverlay {
|
|
|
|
public:
|
2022-05-11 19:07:35 -04:00
|
|
|
std::unordered_map<std::string, Overlay*> RegisteredOverlays;
|
2022-05-11 13:35:03 -04:00
|
|
|
std::unordered_map<std::string, ImFont*> Fonts;
|
|
|
|
std::string CurrentFont = "Default";
|
|
|
|
void Init();
|
|
|
|
void Draw();
|
|
|
|
void DrawSettings();
|
|
|
|
static float GetScreenWidth();
|
|
|
|
static float GetScreenHeight();
|
|
|
|
static float GetStringWidth(const char* text);
|
|
|
|
static ImVec2 CalculateTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
2022-05-11 19:07:35 -04:00
|
|
|
void TextDraw(float x, float y, bool shadow, ImVec4 color, const char* text, ...);
|
|
|
|
void TextDrawNotification(float duration, bool shadow, const char* fmt, ...);
|
2022-05-11 13:35:03 -04:00
|
|
|
private:
|
2022-05-12 20:44:50 -04:00
|
|
|
bool NeedsCleanup = false;
|
|
|
|
void CleanupNotifications();
|
2022-05-11 13:35:03 -04:00
|
|
|
void LoadFont(const std::string& name, const std::string& path, float fontSize);
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool OverlayCommand(const std::vector<std::string>& args);
|
|
|
|
}
|