37 lines
681 B
C++
37 lines
681 B
C++
#ifndef GUI_MODULE_H_
|
|
#define GUI_MODULE_H_
|
|
#include <flecs.h>
|
|
namespace OgreBites
|
|
{
|
|
class InputListener;
|
|
}
|
|
namespace ECS
|
|
{
|
|
struct GUI {
|
|
bool enabled;
|
|
bool grab;
|
|
bool grabChanged;
|
|
OgreBites::InputListener *mGuiInpitListener;
|
|
static void setWindowGrab(bool g = true)
|
|
{
|
|
ECS::GUI &gui = ECS::get().get_mut<ECS::GUI>();
|
|
if (gui.grab != g) {
|
|
gui.grab = g;
|
|
gui.grabChanged = true;
|
|
ECS::get().modified<ECS::GUI>();
|
|
}
|
|
}
|
|
static void finish()
|
|
{
|
|
ECS::GUI &gui = ECS::get().get_mut<ECS::GUI>();
|
|
gui.enabled = false;
|
|
ECS::get().modified<ECS::GUI>();
|
|
setWindowGrab(true);
|
|
}
|
|
};
|
|
struct GUIModule {
|
|
flecs::entity ui_wait;
|
|
GUIModule(flecs::world &ecs);
|
|
};
|
|
}
|
|
#endif |