diff options
Diffstat (limited to 'source/modules/asura-core/input')
-rw-r--r-- | source/modules/asura-core/input/cursor.defs | 25 | ||||
-rw-r--r-- | source/modules/asura-core/input/cursor.h | 25 | ||||
-rw-r--r-- | source/modules/asura-core/input/equeue.cpp | 28 | ||||
-rw-r--r-- | source/modules/asura-core/input/equeue.h | 51 | ||||
-rw-r--r-- | source/modules/asura-core/input/equeue_impl_sdl.h | 0 | ||||
-rw-r--r-- | source/modules/asura-core/input/equeue_impl_win32.h | 0 | ||||
-rw-r--r-- | source/modules/asura-core/input/event_manager.h | 24 | ||||
-rw-r--r-- | source/modules/asura-core/input/keyboard.h | 2 | ||||
-rw-r--r-- | source/modules/asura-core/input/keys.h (renamed from source/modules/asura-core/input/keyboard.defs) | 0 | ||||
-rw-r--r-- | source/modules/asura-core/input/mouse.defs | 7 | ||||
-rw-r--r-- | source/modules/asura-core/input/mouse.h | 7 |
11 files changed, 136 insertions, 33 deletions
diff --git a/source/modules/asura-core/input/cursor.defs b/source/modules/asura-core/input/cursor.defs deleted file mode 100644 index f8b8492..0000000 --- a/source/modules/asura-core/input/cursor.defs +++ /dev/null @@ -1,25 +0,0 @@ - -// Types of system cursors. -enum SystemCursor -{ - CURSOR_ARROW, - CURSOR_IBEAM, - CURSOR_WAIT, - CURSOR_CROSSHAIR, - CURSOR_WAITARROW, - CURSOR_SIZENWSE, - CURSOR_SIZENESW, - CURSOR_SIZEWE, - CURSOR_SIZENS, - CURSOR_SIZEALL, - CURSOR_NO, - CURSOR_HAND, - CURSOR_MAX_ENUM -}; - -enum CursorType -{ - CURSORTYPE_SYSTEM, - CURSORTYPE_IMAGE, - CURSORTYPE_MAX_ENUM -}; diff --git a/source/modules/asura-core/input/cursor.h b/source/modules/asura-core/input/cursor.h index 05503ee..d420d66 100644 --- a/source/modules/asura-core/input/cursor.h +++ b/source/modules/asura-core/input/cursor.h @@ -16,6 +16,31 @@ namespace AsuraEngine class CursorImpl; + // Types of system cursors. + enum SystemCursor + { + CURSOR_ARROW, + CURSOR_IBEAM, + CURSOR_WAIT, + CURSOR_CROSSHAIR, + CURSOR_WAITARROW, + CURSOR_SIZENWSE, + CURSOR_SIZENESW, + CURSOR_SIZEWE, + CURSOR_SIZENS, + CURSOR_SIZEALL, + CURSOR_NO, + CURSOR_HAND, + CURSOR_MAX_ENUM + }; + + enum CursorType + { + CURSORTYPE_SYSTEM, + CURSORTYPE_IMAGE, + CURSORTYPE_MAX_ENUM + }; + // ָö #include "Cursor.defs" diff --git a/source/modules/asura-core/input/equeue.cpp b/source/modules/asura-core/input/equeue.cpp new file mode 100644 index 0000000..e165393 --- /dev/null +++ b/source/modules/asura-core/input/equeue.cpp @@ -0,0 +1,28 @@ +#include "equeue.h" + +namespace AsuraEngine +{ + namespace Input + { + + EQueue::EQueue() + { + // try create queue + + ASSERT(mImpl); + } + + EQueue::~EQueue() + { + if(mImpl) + delete mImpl; + } + + bool EQueue::Poll(const Event& e) + { + ASSERT(mImpl); + return mImpl->Poll(e); + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-core/input/equeue.h b/source/modules/asura-core/input/equeue.h new file mode 100644 index 0000000..495c869 --- /dev/null +++ b/source/modules/asura-core/input/equeue.h @@ -0,0 +1,51 @@ +#ifndef __ASURA_EQUEUE_H__ +#define __ASURA_EQUEUE_H__ + +#include <asura-utils/type.h> + +#include "event.h" + +namespace AsuraEngine +{ + namespace Input + { + + class EQueueImpl; + + /// + /// Event queue. + /// + class EQueue + { + public: + + EQueue(); + ~EQueue(); + + bool Poll(const Event& e); + + private: + + EQueueImpl* mImpl; + + }; + + ASURA_ABSTRACT class EQueueImpl + { + public: + + EQueueImpl() {}; + virtual ~EQueueImpl() {}; + + /// + /// Ӳϵͳ¼óһءзtrue,ûзfalseص + /// װЩͬʵֵ¼ʹͳһתΪAsura event + /// + virtual bool Poll(const Event&) = 0; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/input/equeue_impl_sdl.h b/source/modules/asura-core/input/equeue_impl_sdl.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/input/equeue_impl_sdl.h diff --git a/source/modules/asura-core/input/equeue_impl_win32.h b/source/modules/asura-core/input/equeue_impl_win32.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/input/equeue_impl_win32.h diff --git a/source/modules/asura-core/input/event_manager.h b/source/modules/asura-core/input/event_manager.h new file mode 100644 index 0000000..b81b7ff --- /dev/null +++ b/source/modules/asura-core/input/event_manager.h @@ -0,0 +1,24 @@ +#ifndef __ASURA_EVENT_MANANGER_H__ +#define __ASURA_EVENT_MANANGER_H__ + +#include "equeue.h" + +namespace AsuraEngine +{ + namespace Input + { + + class EventManager + { + public: + + private: + + EQueue mQueue; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/input/keyboard.h b/source/modules/asura-core/input/keyboard.h index 0caf61e..d1d7b48 100644 --- a/source/modules/asura-core/input/keyboard.h +++ b/source/modules/asura-core/input/keyboard.h @@ -16,7 +16,7 @@ // public: // // // صö -// #include "Keyboard.defs" +// #include "keys.h" // // Keyboard(); // diff --git a/source/modules/asura-core/input/keyboard.defs b/source/modules/asura-core/input/keys.h index 8f04dc2..8f04dc2 100644 --- a/source/modules/asura-core/input/keyboard.defs +++ b/source/modules/asura-core/input/keys.h diff --git a/source/modules/asura-core/input/mouse.defs b/source/modules/asura-core/input/mouse.defs deleted file mode 100644 index de1d117..0000000 --- a/source/modules/asura-core/input/mouse.defs +++ /dev/null @@ -1,7 +0,0 @@ - -enum MouseButton -{ - MOUSE_BUTTON_LEFT, - MOUSE_BUTTON_MIDDLE, - MOUSE_BUTTON_RIGHT, -}; diff --git a/source/modules/asura-core/input/mouse.h b/source/modules/asura-core/input/mouse.h index 050100f..4a5a4ba 100644 --- a/source/modules/asura-core/input/mouse.h +++ b/source/modules/asura-core/input/mouse.h @@ -9,6 +9,13 @@ namespace AsuraEngine namespace Input { + enum MouseButton + { + MOUSE_BUTTON_LEFT, + MOUSE_BUTTON_MIDDLE, + MOUSE_BUTTON_RIGHT, + }; + class Mouse : public InputDevice<Mouse> { public: |