46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <SDL.h>
|
|
#include <imgui.h>
|
|
#include "../common/std.hpp"
|
|
#include "../common/time.hpp"
|
|
|
|
/// converts hex color to float vector
|
|
#define RGBAHexToF(R8,G8,B8,A8) ImVec4(((u8)35)/255.0f, ((u8)35)/255.0f, ((u8)50)/255.0f, ((u8)255)/255.0f)
|
|
/// converts float vector to hex color
|
|
#define RGBAFToHex(VEC4) {(u8)(VEC4.x*255), (u8)(VEC4.y*255), (u8)(VEC4.z*255), (u8)(VEC4.w*255)}
|
|
|
|
namespace ougge::gui {
|
|
|
|
#define default_font "DroidSans"
|
|
|
|
class MainWindow {
|
|
public:
|
|
i32 fps_max = 60;
|
|
f32 default_font_size = 14.0f;
|
|
ImVec4 clear_color = RGBAHexToF(35,35,50,255);
|
|
SDL_Window* sdl_window = nullptr;
|
|
SDL_Renderer* sdl_renderer = nullptr;
|
|
|
|
private:
|
|
bool show_debug_window = true;
|
|
bool show_demo_window = false;
|
|
bool show_metrics_window = false;
|
|
|
|
public:
|
|
void open(const std::string& window_title);
|
|
void close();
|
|
|
|
/// process io events happened since previous frame
|
|
void pollEvents(bool* loopRunning);
|
|
void beginFrame();
|
|
void endFrame();
|
|
|
|
f32 getDPI();
|
|
private:
|
|
void draw_debug_window();
|
|
void draw_bg_window();
|
|
};
|
|
|
|
}
|