2013-01-13 22:59:42 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
|
|
|
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ENTRY_H__
|
|
|
|
#define __ENTRY_H__
|
|
|
|
|
|
|
|
namespace entry
|
|
|
|
{
|
|
|
|
struct MouseButton
|
|
|
|
{
|
|
|
|
enum Enum
|
|
|
|
{
|
2013-01-18 11:22:38 +04:00
|
|
|
None,
|
2013-01-13 22:59:42 +04:00
|
|
|
Left,
|
|
|
|
Middle,
|
|
|
|
Right,
|
|
|
|
|
|
|
|
Count
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Modifier
|
|
|
|
{
|
|
|
|
enum Enum
|
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
LeftAlt = 0x01,
|
|
|
|
RightAlt = 0x02,
|
|
|
|
LeftCtrl = 0x04,
|
|
|
|
RightCtrl = 0x08,
|
|
|
|
LeftShift = 0x10,
|
|
|
|
RightShift = 0x20,
|
|
|
|
LeftMeta = 0x40,
|
|
|
|
RightMeta = 0x80,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Key
|
|
|
|
{
|
|
|
|
enum Enum
|
|
|
|
{
|
2013-01-18 10:38:13 +04:00
|
|
|
None = 0,
|
2013-01-13 22:59:42 +04:00
|
|
|
Esc,
|
|
|
|
Return,
|
|
|
|
Tab,
|
|
|
|
Space,
|
|
|
|
Backspace,
|
|
|
|
Up,
|
|
|
|
Down,
|
|
|
|
Left,
|
|
|
|
Right,
|
|
|
|
PageUp,
|
|
|
|
PageDown,
|
|
|
|
Home,
|
|
|
|
End,
|
|
|
|
Print,
|
|
|
|
Plus,
|
|
|
|
Minus,
|
|
|
|
F1,
|
|
|
|
F2,
|
|
|
|
F3,
|
|
|
|
F4,
|
|
|
|
F5,
|
|
|
|
F6,
|
|
|
|
F7,
|
|
|
|
F8,
|
|
|
|
F9,
|
|
|
|
F10,
|
|
|
|
F11,
|
|
|
|
F12,
|
|
|
|
NumPad0,
|
|
|
|
NumPad1,
|
|
|
|
NumPad2,
|
|
|
|
NumPad3,
|
|
|
|
NumPad4,
|
|
|
|
NumPad5,
|
|
|
|
NumPad6,
|
|
|
|
NumPad7,
|
|
|
|
NumPad8,
|
|
|
|
NumPad9,
|
|
|
|
Key0,
|
|
|
|
Key1,
|
|
|
|
Key2,
|
|
|
|
Key3,
|
|
|
|
Key4,
|
|
|
|
Key5,
|
|
|
|
Key6,
|
|
|
|
Key7,
|
|
|
|
Key8,
|
|
|
|
Key9,
|
|
|
|
KeyA,
|
|
|
|
KeyB,
|
|
|
|
KeyC,
|
|
|
|
KeyD,
|
|
|
|
KeyE,
|
|
|
|
KeyF,
|
|
|
|
KeyG,
|
|
|
|
KeyH,
|
|
|
|
KeyI,
|
|
|
|
KeyJ,
|
|
|
|
KeyK,
|
|
|
|
KeyL,
|
|
|
|
KeyM,
|
|
|
|
KeyN,
|
|
|
|
KeyO,
|
|
|
|
KeyP,
|
|
|
|
KeyQ,
|
|
|
|
KeyR,
|
|
|
|
KeyS,
|
|
|
|
KeyT,
|
|
|
|
KeyU,
|
|
|
|
KeyV,
|
|
|
|
KeyW,
|
|
|
|
KeyX,
|
|
|
|
KeyY,
|
|
|
|
KeyZ,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Event
|
|
|
|
{
|
|
|
|
enum Enum
|
|
|
|
{
|
|
|
|
Exit,
|
2013-01-17 10:44:51 +04:00
|
|
|
Key,
|
|
|
|
Mouse,
|
|
|
|
Size,
|
2013-01-13 22:59:42 +04:00
|
|
|
};
|
2013-01-17 10:44:51 +04:00
|
|
|
|
|
|
|
Event::Enum m_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct KeyEvent : public Event
|
|
|
|
{
|
|
|
|
Key::Enum m_key;
|
|
|
|
uint8_t m_modifiers;
|
|
|
|
bool m_down;
|
2013-01-13 22:59:42 +04:00
|
|
|
};
|
|
|
|
|
2013-01-17 10:44:51 +04:00
|
|
|
struct MouseEvent : public Event
|
|
|
|
{
|
|
|
|
int32_t m_mx;
|
|
|
|
int32_t m_my;
|
|
|
|
MouseButton::Enum m_button;
|
|
|
|
bool m_down;
|
2013-01-18 11:22:38 +04:00
|
|
|
bool m_move;
|
2013-01-17 10:44:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SizeEvent : public Event
|
|
|
|
{
|
|
|
|
uint32_t m_width;
|
|
|
|
uint32_t m_height;
|
|
|
|
};
|
|
|
|
|
|
|
|
const Event* poll();
|
|
|
|
void release(const Event* _event);
|
|
|
|
|
|
|
|
void setWindowSize(uint32_t _width, uint32_t _height);
|
|
|
|
void toggleWindowFrame();
|
2013-01-19 12:22:25 +04:00
|
|
|
void setMouseLock(bool _lock);
|
2013-01-13 22:59:42 +04:00
|
|
|
|
|
|
|
} // namespace entry
|
|
|
|
|
|
|
|
#endif // __ENTRY_H__
|