Made cursor work
This commit is contained in:
9
Game.cpp
9
Game.cpp
@@ -174,6 +174,7 @@ class KeyboardListener : public OgreBites::InputListener {
|
||||
|
||||
uint32_t control;
|
||||
ECS::Vector2 mouse;
|
||||
ECS::Vector2 mouse_abs;
|
||||
float wheel_y;
|
||||
bool mouse_moved, wheel_moved;
|
||||
float mInitDelay;
|
||||
@@ -187,6 +188,7 @@ public:
|
||||
, fast(false)
|
||||
, control(0)
|
||||
, mouse({ 0, 0 })
|
||||
, mouse_abs({ 0, 0 })
|
||||
, wheel_y(0.0f)
|
||||
, mouse_moved(false)
|
||||
, wheel_moved(false)
|
||||
@@ -264,6 +266,8 @@ public:
|
||||
return false;
|
||||
mouse.x = evt.xrel;
|
||||
mouse.y = evt.yrel;
|
||||
mouse_abs.x = evt.x;
|
||||
mouse_abs.y = evt.y;
|
||||
mouse_moved = true;
|
||||
/* no special mouse handling */
|
||||
return true;
|
||||
@@ -604,7 +608,7 @@ public:
|
||||
ECS::get()
|
||||
.observer<ECS::GUI>("UpdateGrab")
|
||||
.event(flecs::OnSet)
|
||||
.each([this](flecs::entity e, ECS::GUI &gui) {
|
||||
.each([this](ECS::GUI &gui) {
|
||||
if (gui.grabChanged)
|
||||
setWindowGrab(gui.grab);
|
||||
std::cout << "grab: " << gui.grab << "\n";
|
||||
@@ -614,7 +618,7 @@ public:
|
||||
ECS::get()
|
||||
.observer<ECS::App>("UpdateInputListener")
|
||||
.event(flecs::OnSet)
|
||||
.each([this](flecs::entity e, ECS::App &app) {
|
||||
.each([this](ECS::App &app) {
|
||||
if (app.mInput)
|
||||
removeInputListener(app.mInput);
|
||||
delete app.mInput;
|
||||
@@ -774,6 +778,7 @@ void KeyboardListener::frameRendered(const Ogre::FrameEvent &evt)
|
||||
ECS::Input &input = ECS::get().get_mut<ECS::Input>();
|
||||
input.control = control;
|
||||
input.mouse = mouse;
|
||||
input.mouse_abs = mouse_abs;
|
||||
mouse.x = 0;
|
||||
mouse.y = 0;
|
||||
input.wheel_y = wheel_y;
|
||||
|
||||
Reference in New Issue
Block a user