summaryrefslogtreecommitdiff
path: root/source/modules/asura-core
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core')
-rw-r--r--source/modules/asura-core/graphics/canvas.cpp12
-rw-r--r--source/modules/asura-core/graphics/canvas.h2
-rw-r--r--source/modules/asura-core/graphics/image.cpp10
-rw-r--r--source/modules/asura-core/graphics/texture.cpp14
-rw-r--r--source/modules/asura-core/graphics/texture.h19
-rw-r--r--source/modules/asura-core/graphics/vertex_buffer.h3
-rw-r--r--source/modules/asura-core/input/button.h32
-rw-r--r--source/modules/asura-core/input/clipboard.h35
-rw-r--r--source/modules/asura-core/input/cursor.h81
-rw-r--r--source/modules/asura-core/input/equeue.cpp28
-rw-r--r--source/modules/asura-core/input/equeue.h51
-rw-r--r--source/modules/asura-core/input/equeue_impl_win32.h0
-rw-r--r--source/modules/asura-core/input/event.h45
-rw-r--r--source/modules/asura-core/input/event_manager.h24
-rw-r--r--source/modules/asura-core/input/input_device.cpp (renamed from source/modules/asura-core/input/cursor.cpp)0
-rw-r--r--source/modules/asura-core/input/input_device.h41
-rw-r--r--source/modules/asura-core/input/input_device.hpp31
-rw-r--r--source/modules/asura-core/input/input_manager.cpp (renamed from source/modules/asura-core/input/cursor_impl_sdl.cpp)0
-rw-r--r--source/modules/asura-core/input/input_manager.h25
-rw-r--r--source/modules/asura-core/input/joypad.h0
-rw-r--r--source/modules/asura-core/input/joystick_state.h (renamed from source/modules/asura-core/input/cursor_impl_sdl.h)0
-rw-r--r--source/modules/asura-core/input/keyboard.cpp0
-rw-r--r--source/modules/asura-core/input/keyboard.h73
-rw-r--r--source/modules/asura-core/input/keyboard_state.h39
-rw-r--r--source/modules/asura-core/input/mouse.cpp0
-rw-r--r--source/modules/asura-core/input/mouse.h63
-rw-r--r--source/modules/asura-core/input/mouse_state.h (renamed from source/modules/asura-core/input/equeue_impl_sdl.h)0
-rw-r--r--source/modules/asura-core/window/window.h16
28 files changed, 163 insertions, 481 deletions
diff --git a/source/modules/asura-core/graphics/canvas.cpp b/source/modules/asura-core/graphics/canvas.cpp
index 0543461..0a17085 100644
--- a/source/modules/asura-core/graphics/canvas.cpp
+++ b/source/modules/asura-core/graphics/canvas.cpp
@@ -15,7 +15,7 @@ namespace AsuraEngine
//GLint current_fbo;
//glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);
//glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
- //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTex, 0);
+ //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexID, 0);
//glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
}
@@ -27,21 +27,21 @@ namespace AsuraEngine
if (mFBO == 0)
throw Exception("OpenGL glGenFramebuffers cannot generate frame buffer object.");
//
- if (mTex == 0)
+ if (mTexID == 0)
{
- glGenTextures(1, &mTex);
- if (mTex == 0)
+ glGenTextures(1, &mTexID);
+ if (mTexID == 0)
throw Exception("OpenGL glGenTextures cannot generate texture.");
}
GLint current_fbo;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTex, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexID, 0);
glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
}
GLint current_tex;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_tex);
- glBindTexture(GL_TEXTURE_2D, mTex);
+ glBindTexture(GL_TEXTURE_2D, mTexID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_2D, current_tex);
}
diff --git a/source/modules/asura-core/graphics/canvas.h b/source/modules/asura-core/graphics/canvas.h
index 03326df..e2e713c 100644
--- a/source/modules/asura-core/graphics/canvas.h
+++ b/source/modules/asura-core/graphics/canvas.h
@@ -49,7 +49,7 @@ namespace AsuraEngine
GLuint mFBO;
- GLuint mTex;
+ GLuint mTexID;
uint mWidth, mHeight;
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp
index ef01730..1d74d27 100644
--- a/source/modules/asura-core/graphics/image.cpp
+++ b/source/modules/asura-core/graphics/image.cpp
@@ -28,14 +28,14 @@ namespace AsuraEngine
{
if (!imgData) return false;
- if (mTex == 0)
+ if (mTexID == 0)
{
- glGenTextures(1, &mTex);
- if (mTex == 0)
+ glGenTextures(1, &mTexID);
+ if (mTexID == 0)
throw Exception("OpenGL glGenTextures failed.");
}
- glBindTexture(GL_TEXTURE_2D, mTex);
+ glBindTexture(GL_TEXTURE_2D, mTexID);
imgData->Lock();
int width = imgData->width;
int height = imgData->height;
@@ -66,7 +66,7 @@ namespace AsuraEngine
{
if (!imgData) return false;
- glBindTexture(GL_TEXTURE_2D, mTex);
+ glBindTexture(GL_TEXTURE_2D, mTexID);
imgData->Lock();
int width = imgData->width;
int height = imgData->height;
diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp
index 3438334..240a5f8 100644
--- a/source/modules/asura-core/graphics/texture.cpp
+++ b/source/modules/asura-core/graphics/texture.cpp
@@ -8,24 +8,20 @@ namespace AsuraEngine
{
Texture::Texture()
- : mTex(0)
+ : mTexID(0)
{
- // Fix: ҪʱԴ
- //glGenTextures(1, &mTex);
- //if(mTex == 0)
- // throw Exception("Cannot create texture.");
}
Texture::~Texture()
{
// ͷԴ
- if(mTex != 0)
- glDeleteTextures(1, &mTex);
+ if(mTexID != 0)
+ glDeleteTextures(1, &mTexID);
}
GLuint Texture::GetGLTexture() const
{
- return mTex;
+ return mTexID;
}
TextureFormat Texture::ConvertColorFormat(const ColorFormat& colorformat)
@@ -44,7 +40,7 @@ namespace AsuraEngine
t.type = GL_FLOAT;
break;
default:
- ASSERT(false); // cant reach here
+ ASSERT(false);
}
return t;
}
diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h
index 7cfddec..e16990c 100644
--- a/source/modules/asura-core/graphics/texture.h
+++ b/source/modules/asura-core/graphics/texture.h
@@ -16,6 +16,7 @@ namespace AsuraEngine
class RenderTarget;
+ /// UVʽ
enum WrapMode
{
WRAP_MODE_REPEAT,
@@ -24,38 +25,32 @@ namespace AsuraEngine
WRAP_MODE_CLAMPTOBORDER,
};
+ /// ˲ģʽ
enum FilterMode
{
FILTER_MODE_NEAREST,
FILTER_MODE_LINEAR,
};
- ///
/// ͼݵɫʽ
- ///
enum ColorFormat
{
COLOR_FORMAT_UNKNOWN,
-
COLOR_FORMAT_RGBA8, ///< RGBA8bits int
COLOR_FORMAT_RGBA32F, ///< RGBA32bits float
};
- ///
/// ʽGPUڲCPUⲿʽ
- ///
struct TextureFormat
{
GLenum internalformat; ///< GPUڲʽ
-
GLenum externalformat; ///< CPUⲿʽ
GLenum type; ///< ⲿʽÿchannelֵ
};
///
- /// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷ
- /// ϲԵѿϵΪ׼EditorҲϽΪԭ㣬Ϊ
- /// 㡣
+ /// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿ
+ /// ϵΪ׼EditorҲϽΪԭ㣬Ϊ˷㡣
///
ASURA_ABSTRACT class Texture : public AEScripting::Object
{
@@ -74,19 +69,15 @@ namespace AsuraEngine
void GetFilterMode();
void GetWrapMode();
- ///
/// UVfilterΪ
- ///
bool IsGenMipmap();
protected:
- ///
/// תcolor formatΪtexture format
- ///
TextureFormat ConvertColorFormat(const ColorFormat& colorformat);
- GLuint mTex;
+ GLuint mTexID;
FilterMode mMinFilter;
FilterMode mMagFilter;
WrapMode mWrapMode;
diff --git a/source/modules/asura-core/graphics/vertex_buffer.h b/source/modules/asura-core/graphics/vertex_buffer.h
index 83ca4d1..c16c6d2 100644
--- a/source/modules/asura-core/graphics/vertex_buffer.h
+++ b/source/modules/asura-core/graphics/vertex_buffer.h
@@ -11,8 +11,7 @@ namespace AsuraEngine
{
///
- /// frameworkṩ˴Դ滺Ĺܣֱû壬ܶͨ
- /// ֱöݡ
+ /// frameworkṩ˴Դ滺Ĺܣֱû壬ֱܶͨöݡ
///
class VertexBuffer ASURA_FINAL
: public AEScripting::Portable<VertexBuffer>
diff --git a/source/modules/asura-core/input/button.h b/source/modules/asura-core/input/button.h
new file mode 100644
index 0000000..0df8ed2
--- /dev/null
+++ b/source/modules/asura-core/input/button.h
@@ -0,0 +1,32 @@
+#ifndef __BUTTON_H__
+#define __BUTTON_H__
+
+namespace AsuraEngine
+{
+ namespace Input
+ {
+
+ /// keyboard button \ mouse button \ joystick button
+ class Button
+ {
+ public:
+ inline Button(int key, bool state) :
+ key(key),
+ state(state)
+ {
+ }
+
+ inline int GetKey(void) const { return this->key; }
+ inline bool GetState(void) const { return this->state; }
+
+ private:
+ int key;
+ bool state;
+
+ };
+
+ }
+}
+
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/clipboard.h b/source/modules/asura-core/input/clipboard.h
index 1b7c2b8..e69de29 100644
--- a/source/modules/asura-core/input/clipboard.h
+++ b/source/modules/asura-core/input/clipboard.h
@@ -1,35 +0,0 @@
-#ifndef __ASURA_ENGINE_CLIPBOARD_H__
-#define __ASURA_ENGINE_CLIPBOARD_H__
-
-#include "Text/String.hpp"
-#include "InputDevice.hpp"
-
-namespace AsuraEngine
-{
- namespace Input
- {
-
- class Clipboard ASURA_FINAL : public InputDevice<Clipboard>
- {
- public:
-
- Clipboard();
-
- Text::String GetString();
-
- void SetString(const Text::String& text);
-
- private:
-
- ~Clipboard();
-
- luaxport:
-
- LUAX_DECL_SINGLETON(Clipboard);
-
- };
-
- };
-}
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/cursor.h b/source/modules/asura-core/input/cursor.h
deleted file mode 100644
index e3df7ee..0000000
--- a/source/modules/asura-core/input/cursor.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef __ASURA_ENGINE_CURSOR_H__
-#define __ASURA_ENGINE_CURSOR_H__
-
-#include <SDL2/SDL.h>
-
-#include <asura-utils/scripting/portable.hpp>
-
-#include "../graphics/image_data.h"
-
-#include "input_device.hpp"
-
-namespace AsuraEngine
-{
- namespace Input
- {
-
- 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"
-
- class Cursor
- : public AEScripting::Portable<Cursor>
- {
- public:
-
- Cursor(Graphics::ImageData& imageData, int hotx, int hoty);
- Cursor(SystemCursor cursortype);
-
- ~Cursor();
-
- SDL_Cursor* GetHandle() const;
- CursorType GetType() const;
- SystemCursor GetSystemType() const;
-
- private:
-
- CursorType mType;
- SystemCursor mSystemType;
- CursorImpl* mImpl;
-
- luaxport:
-
- LUAX_DECL_FACTORY(Cursor);
-
- };
-
- ASURA_ABSTRACT class CursorImpl
- {
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/equeue.cpp b/source/modules/asura-core/input/equeue.cpp
deleted file mode 100644
index e165393..0000000
--- a/source/modules/asura-core/input/equeue.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#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
deleted file mode 100644
index 495c869..0000000
--- a/source/modules/asura-core/input/equeue.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#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_win32.h b/source/modules/asura-core/input/equeue_impl_win32.h
deleted file mode 100644
index e69de29..0000000
--- a/source/modules/asura-core/input/equeue_impl_win32.h
+++ /dev/null
diff --git a/source/modules/asura-core/input/event.h b/source/modules/asura-core/input/event.h
deleted file mode 100644
index a24e806..0000000
--- a/source/modules/asura-core/input/event.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef __ASURA_ENGINE_EVENT_H__
-#define __ASURA_ENGINE_EVENT_H__
-
-namespace AsuraEngine
-{
- namespace Input
- {
-
- enum EventType
- {
- EVENT_BEGIN_MOUSE__ ,
- EVENT_LEFT_DOWN ,
- EVENT_LEFT_UP ,
- EVENT_LEFT_DCLICK ,
- EVENT_MIDDLE_DOWN ,
- EVENT_MIDDLE_UP ,
- EVENT_MIDDLE_DCLICK ,
- EVENT_RIGHT_DOWN ,
- EVENT_RIGHT_UP ,
- EVENT_RIGHT_DCLICK ,
- EVENT_MOTION ,
- EVENT_END_MOUSE__ ,
- EVENT_ENTER_WINDOW ,
- EVENT_LEAVE_WINDOW ,
- EVENT_MOUSEWHEEL
- };
-
- struct Event
- {
- int type;
- union
- {
- // 갴¼
- struct {
- int id;
- } button;
- };
- };
-
- }
-}
-
-namespace AEInput = AsuraEngine::Input;
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/event_manager.h b/source/modules/asura-core/input/event_manager.h
deleted file mode 100644
index b81b7ff..0000000
--- a/source/modules/asura-core/input/event_manager.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#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/cursor.cpp b/source/modules/asura-core/input/input_device.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/cursor.cpp
+++ b/source/modules/asura-core/input/input_device.cpp
diff --git a/source/modules/asura-core/input/input_device.h b/source/modules/asura-core/input/input_device.h
new file mode 100644
index 0000000..7082ea3
--- /dev/null
+++ b/source/modules/asura-core/input/input_device.h
@@ -0,0 +1,41 @@
+#ifndef __ASURA_ENGINE_INPUT_BASE_H__
+#define __ASURA_ENGINE_INPUT_BASE_H__
+
+#include <asura-utils/math/vector2.hpp>
+#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/singleton.hpp>
+
+#include "../core_config.h"
+
+#include "keyboard_state.h"
+
+namespace AsuraEngine
+{
+ namespace Input
+ {
+
+ /// ͬƽ̨̳ಢʵhandleӿ
+ ASURA_ABSTRACT class InputDevice : public Singleton<InputDevice>
+ {
+ protected:
+
+ void OnKeyDown(int key);
+ void OnKeyUp(int key);
+
+ void OnMouseMove(const AEMath::Vector2f& position);
+
+ void OnMouseButtonDown(int key);
+ void OnMouseButtonUp(int key);
+
+ void OnMouseWheel();
+
+ void OnInputChar();
+
+ };
+
+ }
+}
+
+namespace AEInput = AsuraEngine::Input;
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/input_device.hpp b/source/modules/asura-core/input/input_device.hpp
deleted file mode 100644
index 4d82343..0000000
--- a/source/modules/asura-core/input/input_device.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __ASURA_ENGINE_INPUT_BASE_H__
-#define __ASURA_ENGINE_INPUT_BASE_H__
-
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/singleton.hpp>
-
-#include "../core_config.h"
-
-namespace AsuraEngine
-{
- namespace Input
- {
-
- ///
- /// 豸һ
- ///
- template<class T>
- ASURA_ABSTRACT class InputDevice
- : virtual public Scripting::Portable<T>
- , virtual public Singleton<T>
- {
- public:
- InputDevice();
- virtual ~InputDevice();
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/cursor_impl_sdl.cpp b/source/modules/asura-core/input/input_manager.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/cursor_impl_sdl.cpp
+++ b/source/modules/asura-core/input/input_manager.cpp
diff --git a/source/modules/asura-core/input/input_manager.h b/source/modules/asura-core/input/input_manager.h
new file mode 100644
index 0000000..4597d39
--- /dev/null
+++ b/source/modules/asura-core/input/input_manager.h
@@ -0,0 +1,25 @@
+#ifndef __INPUT_MAMANGER_H__
+#define __INPUT_MAMANGER_H__
+
+#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/singleton.hpp>
+
+namespace AsuraEngine
+{
+ namespace Input
+ {
+
+ /// ߼
+ class InputManager : public Singleton<InputManager>
+ {
+ public :
+
+
+ private :
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/joypad.h b/source/modules/asura-core/input/joypad.h
deleted file mode 100644
index e69de29..0000000
--- a/source/modules/asura-core/input/joypad.h
+++ /dev/null
diff --git a/source/modules/asura-core/input/cursor_impl_sdl.h b/source/modules/asura-core/input/joystick_state.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/cursor_impl_sdl.h
+++ b/source/modules/asura-core/input/joystick_state.h
diff --git a/source/modules/asura-core/input/keyboard.cpp b/source/modules/asura-core/input/keyboard.cpp
deleted file mode 100644
index e69de29..0000000
--- a/source/modules/asura-core/input/keyboard.cpp
+++ /dev/null
diff --git a/source/modules/asura-core/input/keyboard.h b/source/modules/asura-core/input/keyboard.h
deleted file mode 100644
index d1d7b48..0000000
--- a/source/modules/asura-core/input/keyboard.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//#ifndef __ASURA_INPUT_KEYBOARD_H__
-//#define __ASURA_INPUT_KEYBOARD_H__
-//
-//#include <SDL2/SDL.h>
-//
-//#include "InputDevice.hpp"
-//#include "Scripting/Portable.h"
-//
-//namespace AsuraEngine
-//{
-// namespace Input
-// {
-//
-// class Keyboard ASURA_FINAL : public InputDevice<Keyboard>
-// {
-// public:
-//
-// // صö
-// #include "keys.h"
-//
-// Keyboard();
-//
-// void SetKeyRepeat(bool enable);
-// bool HasKeyRepeat() const;
-// bool IsDown(const std::vector<Key> &keylist) const;
-// bool IsScancodeDown(const std::vector<Scancode> &scancodelist) const;
-//
-// Key GetKeyFromScancode(Scancode scancode) const;
-// Scancode GetScancodeFromKey(Key key) const;
-//
-// void SetTextInput(bool enable);
-// void SetTextInput(bool enable, double x, double y, double w, double h);
-// bool HasTextInput() const;
-// bool HasScreenKeyboard() const;
-//
-// bool GetConstant(Scancode in, SDL_Scancode &out);
-// bool GetConstant(SDL_Scancode in, Scancode &out);
-//
-// private:
-//
-// ~Keyboard();
-//
-// public:
-//
-// //----------------------------------------------------------------------------//
-//
-// LUAX_DECL_SINGLETON(Keyboard); // ͨAsuraEngine.KeyboardֱӷʣûNew
-//
-// LUAX_DECL_ENUM(Key);
-// LUAX_DECL_ENUM(ScanCode);
-//
-// LUAX_DECL_METHOD(SetKeyRepeat);
-// LUAX_DECL_METHOD(HasKeyRepeat);
-// LUAX_DECL_METHOD(IsDown);
-// LUAX_DECL_METHOD(IsScancodeDown);
-//
-// LUAX_DECL_METHOD(GetKeyFromScancode);
-// LUAX_DECL_METHOD(GetScancodeFromKey);
-//
-// LUAX_DECL_METHOD(SetTextInput);
-// LUAX_DECL_METHOD(HasTextInput);
-// LUAX_DECL_METHOD(HasScreenKeyboard);
-//
-// LUAX_DECL_METHOD(GetConstant);
-//
-// //----------------------------------------------------------------------------//
-//
-// };
-//
-// }
-//}
-//
-//#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/keyboard_state.h b/source/modules/asura-core/input/keyboard_state.h
new file mode 100644
index 0000000..f6aa5ea
--- /dev/null
+++ b/source/modules/asura-core/input/keyboard_state.h
@@ -0,0 +1,39 @@
+#ifndef __KEYBOARD_STATE_H__
+#define __KEYBOARD_STATE_H__
+
+#include <vector>
+
+#include "button.h"
+
+namespace AsuraEngine
+{
+ namespace Input
+ {
+
+ typedef std::vector<Button> Buttons;
+
+ class KeyboardState
+ {
+ private:
+ Buttons buttons;
+
+ public:
+ inline KeyboardState(void)
+ {
+ this->buttons.reserve(256);
+ }
+
+ inline const Buttons &GetButtons(void) const { return this->buttons; }
+ inline void AddButton(int key, bool state) { this->buttons.push_back(Button(key, state)); }
+
+ void Reset(bool full)
+ {
+ this->buttons.clear();
+ }
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/mouse.cpp b/source/modules/asura-core/input/mouse.cpp
deleted file mode 100644
index e69de29..0000000
--- a/source/modules/asura-core/input/mouse.cpp
+++ /dev/null
diff --git a/source/modules/asura-core/input/mouse.h b/source/modules/asura-core/input/mouse.h
deleted file mode 100644
index 4a5a4ba..0000000
--- a/source/modules/asura-core/input/mouse.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __ASURA_ENGINE_MOUSE_H__
-#define __ASURA_ENGINE_MOUSE_H__
-
-#include "cursor.h"
-#include "input_device.hpp"
-
-namespace AsuraEngine
-{
- namespace Input
- {
-
- enum MouseButton
- {
- MOUSE_BUTTON_LEFT,
- MOUSE_BUTTON_MIDDLE,
- MOUSE_BUTTON_RIGHT,
- };
-
- class Mouse : public InputDevice<Mouse>
- {
- public:
-
- ///
- /// ͼƬйָʹϵͳָ
- ///
- Cursor *CreateCursor(Graphics::ImageData *data, int hotx, int hoty);
- Cursor *GetSystemCursor(Cursor::SystemCursor cursortype);
-
- void SetCursor(Cursor *cursor);
- void SetCursor() ;
-
- Cursor* GetCursor() const;
-
- bool IsCursorSupported() const;
-
- double GetX() const;
- double GetY() const;
- void GetPosition(double &x, double &y) const;
- void GetX(double x) ;
- void SetY(double y) ;
- void SetPosition(double x, double y) ;
- void SetVisible(bool visible) ;
- bool IsDown(const std::vector<int> &buttons) const;
- bool IsVisible() const;
- void SetGrabbed(bool grab) ;
- bool IsGrabbed() const;
- bool SetRelativeMode(bool relative) ;
- bool GetRelativeMode() const;
-
- //----------------------------------------------------------------------------//
-
- LUAX_DECL_SINGLETON(Mouse);
-
- //----------------------------------------------------------------------------//
-
- private:
-
- };
-
- }
-}
-
-#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/mouse_state.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/equeue_impl_sdl.h
+++ b/source/modules/asura-core/input/mouse_state.h
diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h
index d0f62c1..835535d 100644
--- a/source/modules/asura-core/window/window.h
+++ b/source/modules/asura-core/window/window.h
@@ -39,9 +39,7 @@ namespace AsuraEngine
WINDOW_ALWAYS_ON_TOP = 1 << 14, ///< window should always be above others
};
- ///
/// Windowʼ
- ///
struct WindowConfig
{
uint width, height; ///< ߴ
@@ -63,17 +61,13 @@ namespace AsuraEngine
{
public:
- ///
/// ϷʱĴΨһģ༭õࡣ
- ///
LUAX_DECL_SINGLETON(Window);
Window();
~Window();
- ///
/// ڡ
- ///
bool Init(const WindowConfig& config);
void Exit();
@@ -85,9 +79,7 @@ namespace AsuraEngine
void Show();
void Hide();
- ///
/// ǿ˫ĴڣҪչʾǰ̨
- ///
void SwapRenderBuffer();
void Clear(const AEGraphics::Color& col = AEGraphics::Color::Black) override;
@@ -98,7 +90,9 @@ namespace AsuraEngine
private:
- //----------------------------------------------------------------------------//
+ WindowImpl* mImpl;
+
+ luaxport:
LUAX_DECL_ENUM(WindowFlag, 0);
@@ -114,10 +108,6 @@ namespace AsuraEngine
LUAX_DECL_METHOD(_Clear);
LUAX_DECL_METHOD(_Draw);
- //----------------------------------------------------------------------------//
-
- WindowImpl* mImpl;
-
};
using RenderWindow = Window;