mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 17:47:43 +00:00
Add initial imgui implementation
This commit is contained in:
48
imgui/ImGuiEngine.hpp
Normal file
48
imgui/ImGuiEngine.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include "imgui.h"
|
||||
|
||||
#include <boo/IWindow.hpp>
|
||||
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
class ImGuiEngine {
|
||||
public:
|
||||
static struct Input {
|
||||
boo::SWindowCoord m_mousePos{};
|
||||
std::array<bool, 5> m_mouseButtons{};
|
||||
boo::SScrollDelta m_scrollDelta{};
|
||||
boo::EModifierKey m_modifiers{};
|
||||
std::array<bool, 512> m_keys{};
|
||||
std::vector<unsigned long> m_charCodes{};
|
||||
bool m_mouseIn = true;
|
||||
} Input;
|
||||
|
||||
static void Initialize(boo::IGraphicsDataFactory* factory, const boo::SWindowRect &rect);
|
||||
static void Shutdown();
|
||||
|
||||
static void Begin(float dt);
|
||||
static void End();
|
||||
static void Draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
private:
|
||||
static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx);
|
||||
};
|
||||
|
||||
struct ImGuiWindowCallback : boo::IWindowCallback {
|
||||
static bool m_mouseCaptured;
|
||||
static bool m_keyboardCaptured;
|
||||
|
||||
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) override;
|
||||
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) override;
|
||||
void mouseMove(const boo::SWindowCoord& coord) override;
|
||||
void mouseEnter(const boo::SWindowCoord& coord) override;
|
||||
void mouseLeave(const boo::SWindowCoord& coord) override;
|
||||
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll) override;
|
||||
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat) override;
|
||||
void charKeyUp(unsigned long charCode, boo::EModifierKey mods) override;
|
||||
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat) override;
|
||||
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods) override;
|
||||
void resized(const boo::SWindowRect &rect, bool sync) override;
|
||||
};
|
||||
} // namespace metaforce
|
||||
Reference in New Issue
Block a user