examples/input/InputExample: Adding support for Event based mouse movement.
This commit is contained in:
parent
085d593b66
commit
962c18fcac
2 changed files with 35 additions and 1 deletions
|
|
@ -5,13 +5,14 @@
|
|||
#include <Spectre/Scene/Camera2D.h>
|
||||
#include <Spectre/Graphics/Texture.h>
|
||||
#include <Spectre/Graphics/Sprite.h>
|
||||
#include <Spectre/System/EventListener.h>
|
||||
#include <Spectre/Game.h>
|
||||
|
||||
namespace sp {
|
||||
class Renderer2D;
|
||||
}
|
||||
|
||||
class InputExample : public sp::Game
|
||||
class InputExample : public sp::Game, sp::EventListener
|
||||
{
|
||||
protected :
|
||||
|
||||
|
|
@ -21,12 +22,19 @@ protected :
|
|||
|
||||
void render();
|
||||
|
||||
void onSizeChanged(sp::Display* display, int width, int height);
|
||||
|
||||
void onEvent(const sp::Event& event);
|
||||
|
||||
private :
|
||||
sp::Camera2D m_camera;
|
||||
sp::Renderer2D *m_renderer;
|
||||
|
||||
sp::Sprite m_kb_sprite;
|
||||
sp::Sprite m_mouse_sprite;
|
||||
sp::Sprite m_mouse_event_sprite;
|
||||
|
||||
bool m_right_mouse_down;
|
||||
|
||||
sp::Texture m_tux_texture;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue