summaryrefslogtreecommitdiff
path: root/source/modules
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-31 14:34:40 +0800
committerchai <chaifix@163.com>2019-03-31 14:34:40 +0800
commitfb7ae1149a80a22c77014d0ece33f6f4b965b631 (patch)
tree41540b0962be735204eb50eef54bd30e9184234a /source/modules
parent8164adb15b76f537f8b6c78b9992786b61d61cc8 (diff)
*misc
Diffstat (limited to 'source/modules')
-rw-r--r--source/modules/asura-box2d/box2d_module.cpp (renamed from source/modules/asura-box2d/chain_shape.h)0
-rw-r--r--source/modules/asura-box2d/box2d_module.h19
-rw-r--r--source/modules/asura-box2d/physics/binding/_body.cpp (renamed from source/modules/asura-box2d/binding/_body.cpp)1
-rw-r--r--source/modules/asura-box2d/physics/binding/_world.cpp (renamed from source/modules/asura-box2d/binding/_world.cpp)0
-rw-r--r--source/modules/asura-box2d/physics/body.h (renamed from source/modules/asura-box2d/body.h)0
-rw-r--r--source/modules/asura-box2d/physics/chain_shape.h (renamed from source/modules/asura-box2d/circle_shape.h)0
-rw-r--r--source/modules/asura-box2d/physics/circle_shape.h (renamed from source/modules/asura-box2d/contact.h)0
-rw-r--r--source/modules/asura-box2d/physics/contact.h (renamed from source/modules/asura-box2d/debug_draw.h)0
-rw-r--r--source/modules/asura-box2d/physics/debug_draw.h9
-rw-r--r--source/modules/asura-box2d/physics/distance_joint.h (renamed from source/modules/asura-box2d/distance_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/edge_shape.h (renamed from source/modules/asura-box2d/edge_shape.h)0
-rw-r--r--source/modules/asura-box2d/physics/fixture.h (renamed from source/modules/asura-box2d/fixture.h)0
-rw-r--r--source/modules/asura-box2d/physics/friction_joint.h (renamed from source/modules/asura-box2d/friction_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/gear_joint.h (renamed from source/modules/asura-box2d/gear_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/joint.h (renamed from source/modules/asura-box2d/joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/motor_joint.h (renamed from source/modules/asura-box2d/motor_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/mouse_joint.h (renamed from source/modules/asura-box2d/mouse_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/polygon_shape.h (renamed from source/modules/asura-box2d/polygon_shape.h)0
-rw-r--r--source/modules/asura-box2d/physics/prismatic_joint.h (renamed from source/modules/asura-box2d/prismatic_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/pulley_joint.h (renamed from source/modules/asura-box2d/pulley_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/revolute_joint.h (renamed from source/modules/asura-box2d/revolute_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/rope_joint.h (renamed from source/modules/asura-box2d/rope_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/shape.h (renamed from source/modules/asura-box2d/shape.h)0
-rw-r--r--source/modules/asura-box2d/physics/weld_joint.h (renamed from source/modules/asura-box2d/weld_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/wheel_joint.h (renamed from source/modules/asura-box2d/wheel_joint.h)0
-rw-r--r--source/modules/asura-box2d/physics/world.h (renamed from source/modules/asura-box2d/world.h)0
-rw-r--r--source/modules/asura-core/core_config.h4
-rw-r--r--source/modules/asura-core/core_module.cpp9
-rw-r--r--source/modules/asura-core/core_module.h5
-rw-r--r--source/modules/asura-core/graphics/binding/_image.cpp51
-rw-r--r--source/modules/asura-core/graphics/binding/_texture.cpp86
-rw-r--r--source/modules/asura-core/graphics/binding/_window.cpp103
-rw-r--r--source/modules/asura-core/graphics/canvas.cpp4
-rw-r--r--source/modules/asura-core/graphics/canvas.h2
-rw-r--r--source/modules/asura-core/graphics/color32.cpp16
-rw-r--r--source/modules/asura-core/graphics/color32.h7
-rw-r--r--source/modules/asura-core/graphics/image.cpp5
-rw-r--r--source/modules/asura-core/graphics/image.h10
-rw-r--r--source/modules/asura-core/graphics/shader.cpp2
-rw-r--r--source/modules/asura-core/graphics/shader.h27
-rw-r--r--source/modules/asura-core/graphics/shader_source.h30
-rw-r--r--source/modules/asura-core/graphics/texture.cpp8
-rw-r--r--source/modules/asura-core/graphics/texture.h25
-rw-r--r--source/modules/asura-core/input/cursor.defs25
-rw-r--r--source/modules/asura-core/input/cursor.h25
-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_sdl.h (renamed from source/modules/asura-core/window/window_impl_glew.cpp)0
-rw-r--r--source/modules/asura-core/input/equeue_impl_win32.h (renamed from source/modules/asura-core/window/window_impl_glew.h)0
-rw-r--r--source/modules/asura-core/input/event_manager.h24
-rw-r--r--source/modules/asura-core/input/keyboard.h2
-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.defs7
-rw-r--r--source/modules/asura-core/input/mouse.h7
-rw-r--r--source/modules/asura-core/threading/thread_ex.cpp2
-rw-r--r--source/modules/asura-core/window/window.cpp50
-rw-r--r--source/modules/asura-core/window/window.h90
-rw-r--r--source/modules/asura-core/wnd/binding/_window.cpp180
-rw-r--r--source/modules/asura-core/wnd/window.cpp108
-rw-r--r--source/modules/asura-core/wnd/window.h149
-rw-r--r--source/modules/asura-core/wnd/window_impl_glew.cpp (renamed from source/modules/asura-core/window/window_impl_glut.cpp)0
-rw-r--r--source/modules/asura-core/wnd/window_impl_glew.h (renamed from source/modules/asura-core/window/window_impl_glut.h)0
-rw-r--r--source/modules/asura-core/wnd/window_impl_glut.cpp (renamed from source/modules/asura-core/window/window_impl_sdl.cpp)0
-rw-r--r--source/modules/asura-core/wnd/window_impl_glut.h (renamed from source/modules/asura-core/window/window_impl_sdl.h)0
-rw-r--r--source/modules/asura-core/wnd/window_impl_sdl.cpp141
-rw-r--r--source/modules/asura-core/wnd/window_impl_sdl.h39
-rw-r--r--source/modules/asura-json/json/json.cpp (renamed from source/modules/asura-json/json.cpp)0
-rw-r--r--source/modules/asura-json/json/json.h (renamed from source/modules/asura-json/json.h)0
-rw-r--r--source/modules/asura-network/network_module.h (renamed from source/modules/asura-openal/audio.cpp)0
-rw-r--r--source/modules/asura-openal/audio/audio.cpp (renamed from source/modules/asura-openal/audio.h)0
-rw-r--r--source/modules/asura-openal/audio/audio.h (renamed from source/modules/asura-openal/mpg123_decoder.cpp)0
-rw-r--r--source/modules/asura-openal/audio/mpg123_decoder.cpp (renamed from source/modules/asura-openal/mpg123_decoder.h)0
-rw-r--r--source/modules/asura-openal/audio/mpg123_decoder.h (renamed from source/modules/asura-openal/sound.cpp)0
-rw-r--r--source/modules/asura-openal/audio/sound.cpp (renamed from source/modules/asura-openal/sound_data.cpp)0
-rw-r--r--source/modules/asura-openal/audio/sound.h (renamed from source/modules/asura-openal/sound.h)0
-rw-r--r--source/modules/asura-openal/audio/sound_data.cpp (renamed from source/modules/asura-openal/sound_data.h)0
-rw-r--r--source/modules/asura-openal/audio/sound_data.h (renamed from source/modules/asura-openal/sound_decode_task.cpp)0
-rw-r--r--source/modules/asura-openal/audio/sound_decode_task.cpp (renamed from source/modules/asura-openal/source.cpp)0
-rw-r--r--source/modules/asura-openal/audio/sound_decode_task.h (renamed from source/modules/asura-openal/sound_decode_task.h)0
-rw-r--r--source/modules/asura-openal/audio/sound_decoder.cpp (renamed from source/modules/asura-openal/sound_decoder.cpp)0
-rw-r--r--source/modules/asura-openal/audio/sound_decoder.h (renamed from source/modules/asura-openal/sound_decoder.h)0
-rw-r--r--source/modules/asura-openal/audio/source.cpp (renamed from source/modules/asura-openal/source.h)0
-rw-r--r--source/modules/asura-openal/audio/source.h (renamed from source/modules/asura-openal/vorbis_decoder.cpp)0
-rw-r--r--source/modules/asura-openal/audio/vorbis_decoder.cpp (renamed from source/modules/asura-openal/vorbis_decoder.h)0
-rw-r--r--source/modules/asura-openal/audio/vorbis_decoder.h0
-rw-r--r--source/modules/asura-utils/threading/thread_impl_posix.cpp2
-rw-r--r--source/modules/asura-utils/type.h2
87 files changed, 1018 insertions, 337 deletions
diff --git a/source/modules/asura-box2d/chain_shape.h b/source/modules/asura-box2d/box2d_module.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/chain_shape.h
+++ b/source/modules/asura-box2d/box2d_module.cpp
diff --git a/source/modules/asura-box2d/box2d_module.h b/source/modules/asura-box2d/box2d_module.h
new file mode 100644
index 0000000..052078a
--- /dev/null
+++ b/source/modules/asura-box2d/box2d_module.h
@@ -0,0 +1,19 @@
+#ifndef __ASURA_BOX2D_MODULE_H__
+#define __ASURA_BOX2D_MODULE_H__
+
+#include <asura-utils/module.h>
+
+namespace AsuraEngine
+{
+
+ class Box2DModule ASURA_FINAL : public Module
+ {
+ public:
+
+
+
+ };
+
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-box2d/binding/_body.cpp b/source/modules/asura-box2d/physics/binding/_body.cpp
index 51cc0ab..68f3aaf 100644
--- a/source/modules/asura-box2d/binding/_body.cpp
+++ b/source/modules/asura-box2d/physics/binding/_body.cpp
@@ -45,6 +45,7 @@ namespace AsuraEngine
LUAX_IMPL_METHOD(Body, _GetType)
{
LUAX_PREPARE(L, Body);
+
return 0;
}
diff --git a/source/modules/asura-box2d/binding/_world.cpp b/source/modules/asura-box2d/physics/binding/_world.cpp
index 6edd193..6edd193 100644
--- a/source/modules/asura-box2d/binding/_world.cpp
+++ b/source/modules/asura-box2d/physics/binding/_world.cpp
diff --git a/source/modules/asura-box2d/body.h b/source/modules/asura-box2d/physics/body.h
index 57295c6..57295c6 100644
--- a/source/modules/asura-box2d/body.h
+++ b/source/modules/asura-box2d/physics/body.h
diff --git a/source/modules/asura-box2d/circle_shape.h b/source/modules/asura-box2d/physics/chain_shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/circle_shape.h
+++ b/source/modules/asura-box2d/physics/chain_shape.h
diff --git a/source/modules/asura-box2d/contact.h b/source/modules/asura-box2d/physics/circle_shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/contact.h
+++ b/source/modules/asura-box2d/physics/circle_shape.h
diff --git a/source/modules/asura-box2d/debug_draw.h b/source/modules/asura-box2d/physics/contact.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/debug_draw.h
+++ b/source/modules/asura-box2d/physics/contact.h
diff --git a/source/modules/asura-box2d/physics/debug_draw.h b/source/modules/asura-box2d/physics/debug_draw.h
new file mode 100644
index 0000000..cff682b
--- /dev/null
+++ b/source/modules/asura-box2d/physics/debug_draw.h
@@ -0,0 +1,9 @@
+#ifndef __ASURA_BOX2D_DEBUG_DRAW_H__
+#define __ASURA_BOX2D_DEBUG_DRAW_H__
+
+namespace AsuraEngine
+{
+
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-box2d/distance_joint.h b/source/modules/asura-box2d/physics/distance_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/distance_joint.h
+++ b/source/modules/asura-box2d/physics/distance_joint.h
diff --git a/source/modules/asura-box2d/edge_shape.h b/source/modules/asura-box2d/physics/edge_shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/edge_shape.h
+++ b/source/modules/asura-box2d/physics/edge_shape.h
diff --git a/source/modules/asura-box2d/fixture.h b/source/modules/asura-box2d/physics/fixture.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/fixture.h
+++ b/source/modules/asura-box2d/physics/fixture.h
diff --git a/source/modules/asura-box2d/friction_joint.h b/source/modules/asura-box2d/physics/friction_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/friction_joint.h
+++ b/source/modules/asura-box2d/physics/friction_joint.h
diff --git a/source/modules/asura-box2d/gear_joint.h b/source/modules/asura-box2d/physics/gear_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/gear_joint.h
+++ b/source/modules/asura-box2d/physics/gear_joint.h
diff --git a/source/modules/asura-box2d/joint.h b/source/modules/asura-box2d/physics/joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/joint.h
+++ b/source/modules/asura-box2d/physics/joint.h
diff --git a/source/modules/asura-box2d/motor_joint.h b/source/modules/asura-box2d/physics/motor_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/motor_joint.h
+++ b/source/modules/asura-box2d/physics/motor_joint.h
diff --git a/source/modules/asura-box2d/mouse_joint.h b/source/modules/asura-box2d/physics/mouse_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/mouse_joint.h
+++ b/source/modules/asura-box2d/physics/mouse_joint.h
diff --git a/source/modules/asura-box2d/polygon_shape.h b/source/modules/asura-box2d/physics/polygon_shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/polygon_shape.h
+++ b/source/modules/asura-box2d/physics/polygon_shape.h
diff --git a/source/modules/asura-box2d/prismatic_joint.h b/source/modules/asura-box2d/physics/prismatic_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/prismatic_joint.h
+++ b/source/modules/asura-box2d/physics/prismatic_joint.h
diff --git a/source/modules/asura-box2d/pulley_joint.h b/source/modules/asura-box2d/physics/pulley_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/pulley_joint.h
+++ b/source/modules/asura-box2d/physics/pulley_joint.h
diff --git a/source/modules/asura-box2d/revolute_joint.h b/source/modules/asura-box2d/physics/revolute_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/revolute_joint.h
+++ b/source/modules/asura-box2d/physics/revolute_joint.h
diff --git a/source/modules/asura-box2d/rope_joint.h b/source/modules/asura-box2d/physics/rope_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/rope_joint.h
+++ b/source/modules/asura-box2d/physics/rope_joint.h
diff --git a/source/modules/asura-box2d/shape.h b/source/modules/asura-box2d/physics/shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/shape.h
+++ b/source/modules/asura-box2d/physics/shape.h
diff --git a/source/modules/asura-box2d/weld_joint.h b/source/modules/asura-box2d/physics/weld_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/weld_joint.h
+++ b/source/modules/asura-box2d/physics/weld_joint.h
diff --git a/source/modules/asura-box2d/wheel_joint.h b/source/modules/asura-box2d/physics/wheel_joint.h
index e69de29..e69de29 100644
--- a/source/modules/asura-box2d/wheel_joint.h
+++ b/source/modules/asura-box2d/physics/wheel_joint.h
diff --git a/source/modules/asura-box2d/world.h b/source/modules/asura-box2d/physics/world.h
index 0aac0c8..0aac0c8 100644
--- a/source/modules/asura-box2d/world.h
+++ b/source/modules/asura-box2d/physics/world.h
diff --git a/source/modules/asura-core/core_config.h b/source/modules/asura-core/core_config.h
index 06eecc7..2286189 100644
--- a/source/modules/asura-core/core_config.h
+++ b/source/modules/asura-core/core_config.h
@@ -1,8 +1,6 @@
#ifndef __ASURA_CORE_CONFIG_H__
#define __ASURA_CORE_CONFIG_H__
-#define ASURA_CORE_SDL 1
-#define ASURA_CORE_GLUT 0
-#define ASURA_CORE_GLFW 0
+#define ASURA_WINDOW_SDL 1
#endif \ No newline at end of file
diff --git a/source/modules/asura-core/core_module.cpp b/source/modules/asura-core/core_module.cpp
index 6f484c0..e6b0dac 100644
--- a/source/modules/asura-core/core_module.cpp
+++ b/source/modules/asura-core/core_module.cpp
@@ -1,14 +1,21 @@
#include "core_module.h"
using namespace AEThreading;
+using namespace AEGraphics;
+using namespace AEWnd;
namespace AsuraEngine
{
void CoreModule::Initialize(Luax::LuaxState& state)
{
+ // Graphics
+ LUAX_REGISTER_ABSTRACT_FACTORY(state, Texture);
+ LUAX_REGISTER_FACTORY(state, Image);
+ // Wnd
+ LUAX_REGISTER_SINGLETON(state, Window);
// Threading
- LUAX_REGISTER_FACTORY(state, ThreadEx);
+ //LUAX_REGISTER_FACTORY(state, ThreadEx);
}
void CoreModule::Finalize(Luax::LuaxState& state)
diff --git a/source/modules/asura-core/core_module.h b/source/modules/asura-core/core_module.h
index a295b18..613a806 100644
--- a/source/modules/asura-core/core_module.h
+++ b/source/modules/asura-core/core_module.h
@@ -3,6 +3,11 @@
#include <asura-utils/module.h>
+#include "graphics/image.h"
+#include "graphics/texture.h"
+
+#include "wnd/window.h"
+
#include "threading/thread_ex.h"
namespace AsuraEngine
diff --git a/source/modules/asura-core/graphics/binding/_image.cpp b/source/modules/asura-core/graphics/binding/_image.cpp
index 1d43067..cc9a669 100644
--- a/source/modules/asura-core/graphics/binding/_image.cpp
+++ b/source/modules/asura-core/graphics/binding/_image.cpp
@@ -9,6 +9,8 @@ namespace AsuraEngine
LUAX_REGISTRY(Image)
{
+ LUAX_INHERIT(state, Texture);
+
LUAX_REGISTER_METHODS(state,
{ "New", _New },
{ "Refresh", _Refresh },
@@ -22,55 +24,68 @@ namespace AsuraEngine
LUAX_POSTPROCESS(Image)
{
-
}
- // Image.New()
+ // image = Image.New()
LUAX_IMPL_METHOD(Image, _New)
{
LUAX_STATE(L);
-
- return 0;
+ Image* img = new Image();
+ img->PushLuaxUserdata(state);
+ return 1;
}
- // image:Refresh()
+ // successed = image:Refresh(imgData)
LUAX_IMPL_METHOD(Image, _Refresh)
{
LUAX_PREPARE(L, Image);
-
- return 0;
+ ImageData* imgData = state.CheckUserdata<ImageData>(2);
+ bool successed = self->Refresh(imgData);
+ if (successed)
+ self->SetLuaxMemberRef(state, self->mImageDataRef, 2);
+ state.Push(successed);
+ return 1;
}
- // image:GetWidth()
+ // width = image:GetWidth()
LUAX_IMPL_METHOD(Image, _GetWidth)
{
LUAX_PREPARE(L, Image);
-
- return 0;
+ state.Push(self->GetWidth());
+ return 1;
}
- // image:GetHeight()
+ // height = image:GetHeight()
LUAX_IMPL_METHOD(Image, _GetHeight)
{
LUAX_PREPARE(L, Image);
-
- return 0;
+ state.Push(self->GetHeight());
+ return 1;
}
- // image:GetSize()
+ // width, height = image:GetSize()
LUAX_IMPL_METHOD(Image, _GetSize)
{
LUAX_PREPARE(L, Image);
-
- return 0;
+ int width = self->GetWidth();
+ int height = self->GetHeight();
+ state.Push(width);
+ state.Push(height);
+ return 2;
}
- // image:GetPixel()
+ // color32 = image:GetPixel(x, y)
LUAX_IMPL_METHOD(Image, _GetPixel)
{
LUAX_PREPARE(L, Image);
- return 0;
+ uint x, y;
+ x = state.CheckValue<uint>(2);
+ y = state.CheckValue<uint>(3);
+ Color32* c32 = new Color32();
+ c32->Set(self->GetPixel(x, y));
+ c32->PushLuaxUserdata(state);
+ return 1;
}
// image:Render()
diff --git a/source/modules/asura-core/graphics/binding/_texture.cpp b/source/modules/asura-core/graphics/binding/_texture.cpp
new file mode 100644
index 0000000..489d362
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_texture.cpp
@@ -0,0 +1,86 @@
+#include "../texture.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Texture)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "SetFilterMode", _SetFilterMode },
+ { "SetWrapMode", _SetWrapMode },
+ { "GetFilterMode", _GetFilterMode },
+ { "GetWrapMode", _GetWrapMode },
+ { "IsGenMipmap", _IsGenMipmap }
+ );
+ }
+
+ LUAX_POSTPROCESS(Texture)
+ {
+ LUAX_REGISTER_ENUM(state, "EColorFormat",
+ { "UNKNOWN", COLOR_FORMAT_UNKNOWN },
+ { "RGBA8", COLOR_FORMAT_RGBA8 },
+ { "RGBA32F", COLOR_FORMAT_RGBA32F }
+ );
+ LUAX_REGISTER_ENUM(state, "EFilterMode",
+ { "NEAREST", FILTER_MODE_NEAREST },
+ { "LINEAR", FILTER_MODE_LINEAR }
+ );
+ LUAX_REGISTER_ENUM(state, "EWrapMode",
+ { "REPEAT", WRAP_MODE_REPEAT },
+ { "MIRROR", WRAP_MODE_MIRROR },
+ { "CLAMPTOEDGE", WRAP_MODE_CLAMPTOEDGE },
+ { "CLAMPTOBORDER", WRAP_MODE_CLAMPTOBORDER }
+ );
+
+ }
+
+ // texture:SetFilterMode(minFilter, magFilter)
+ LUAX_IMPL_METHOD(Texture, _SetFilterMode)
+ {
+ LUAX_PREPARE(L, Texture);
+ FilterMode min = (FilterMode)state.CheckValue<int>(2);
+ FilterMode mag = (FilterMode)state.CheckValue<int>(3);
+ self->SetFilterMode(min, mag);
+ return 0;
+ }
+
+ // texture:SetWrapMode(wrap_mode)
+ LUAX_IMPL_METHOD(Texture, _SetWrapMode)
+ {
+ LUAX_PREPARE(L, Texture);
+ WrapMode wrap_mode = (WrapMode)state.CheckValue<int>(2);
+ self->SetWrapMode(wrap_mode);
+ return 0;
+ }
+
+ // min, mag = texture:GetFilterMode()
+ LUAX_IMPL_METHOD(Texture, _GetFilterMode)
+ {
+ LUAX_PREPARE(L, Texture);
+ state.Push((int)self->mMinFilter);
+ state.Push((int)self->mMagFilter);
+ return 2;
+ }
+
+ // wrapmode= texture:GetWrapMode()
+ LUAX_IMPL_METHOD(Texture, _GetWrapMode)
+ {
+ LUAX_PREPARE(L, Texture);
+ state.Push((int)self->mWrapMode);
+ return 1;
+ }
+
+ // texture:IsGenMipmap()
+ LUAX_IMPL_METHOD(Texture, _IsGenMipmap)
+ {
+ LUAX_PREPARE(L, Texture);
+ state.Push(self->IsGenMipmap());
+ return 1;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/binding/_window.cpp b/source/modules/asura-core/graphics/binding/_window.cpp
deleted file mode 100644
index fc74d6c..0000000
--- a/source/modules/asura-core/graphics/binding/_window.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "../window.h"
-
-using namespace std;
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- LUAX_REGISTRY(Window)
- {
- LUAX_REGISTER_METHODS(state,
- { "Show", _Show },
- { "Hide", _Hide },
- { "SetResolution", _SetResolution },
- { "SetFullScreen", _SetFullScreen },
- { "SetTitle", _SetTitle },
- { "SetWindowStyle", _SetWindowStyle },
- { "Clear", _Clear },
- { "Draw", _Draw },
- { "SwapRenderBuffer", _SwapRenderBuffer }
- );
- }
-
- LUAX_POSTPROCESS(Window)
- {
-
- }
-
- // window:Show()
- LUAX_IMPL_METHOD(Window, _Show)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:Hide()
- LUAX_IMPL_METHOD(Window, _Hide)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:SetResolution()
- LUAX_IMPL_METHOD(Window, _SetResolution)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:SetFullScreen()
- LUAX_IMPL_METHOD(Window, _SetFullScreen)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:SetTitle()
- LUAX_IMPL_METHOD(Window, _SetTitle)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:SetWindowStyle()
- LUAX_IMPL_METHOD(Window, _SetWindowStyle)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:Clear()
- LUAX_IMPL_METHOD(Window, _Clear)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:Draw()
- LUAX_IMPL_METHOD(Window, _Draw)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- // window:SwapRenderBuffer()
- LUAX_IMPL_METHOD(Window, _SwapRenderBuffer)
- {
- LUAX_PREPARE(L, Window);
-
- return 0;
- }
-
- }
-}
diff --git a/source/modules/asura-core/graphics/canvas.cpp b/source/modules/asura-core/graphics/canvas.cpp
index e54ba1f..8b556d9 100644
--- a/source/modules/asura-core/graphics/canvas.cpp
+++ b/source/modules/asura-core/graphics/canvas.cpp
@@ -14,7 +14,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, mTexHandle, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTex, 0);
glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
}
@@ -22,7 +22,7 @@ namespace AsuraEngine
{
GLint current_tex;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_tex);
- glBindTexture(GL_TEXTURE_2D, mTexHandle);
+ glBindTexture(GL_TEXTURE_2D, mTex);
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 d1412da..f0b71e2 100644
--- a/source/modules/asura-core/graphics/canvas.h
+++ b/source/modules/asura-core/graphics/canvas.h
@@ -62,7 +62,7 @@ namespace AsuraEngine
//----------------------------------------------------------------------------//
- LUAX_DECL_FACTORY(SimCanvas);
+ LUAX_DECL_FACTORY(Canvas);
LUAX_DECL_METHOD(_SetSize);
LUAX_DECL_METHOD(_Bind);
diff --git a/source/modules/asura-core/graphics/color32.cpp b/source/modules/asura-core/graphics/color32.cpp
index 0ebc77c..28260d5 100644
--- a/source/modules/asura-core/graphics/color32.cpp
+++ b/source/modules/asura-core/graphics/color32.cpp
@@ -6,6 +6,14 @@ namespace AsuraEngine
namespace Graphics
{
+#if ASURA_LITTLE_ENDIAN
+ // СˣֽڵAlphaڸߵַ
+ const uint32 Color32::RMASK = 0x000000ff;
+ const uint32 Color32::GMASK = 0x0000ff00;
+ const uint32 Color32::BMASK = 0x00ff0000;
+ const uint32 Color32::AMASK = 0xff000000;
+#endif
+
Color32::Color32()
{
r = g = b = a = 0;
@@ -35,5 +43,13 @@ namespace AsuraEngine
this->a = a;
}
+ void Color32::Set(const Color32& c32)
+ {
+ r = c32.r;
+ g = c32.g;
+ b = c32.b;
+ a = c32.a;
+ }
+
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/color32.h b/source/modules/asura-core/graphics/color32.h
index 2b13d1a..5b10931 100644
--- a/source/modules/asura-core/graphics/color32.h
+++ b/source/modules/asura-core/graphics/color32.h
@@ -22,6 +22,11 @@ namespace AsuraEngine
LUAX_DECL_FACTORY(Color32);
+ static const uint32 RMASK;
+ static const uint32 GMASK;
+ static const uint32 BMASK;
+ static const uint32 AMASK;
+
Color32();
~Color32();
@@ -32,6 +37,8 @@ namespace AsuraEngine
Color32(byte r, byte g, byte b, byte a);
+ void Set(const Color32& c32);
+
byte r, g, b, a;
LUAX_DECL_METHOD(_ToColor);
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp
index e0528eb..bdd8c3d 100644
--- a/source/modules/asura-core/graphics/image.cpp
+++ b/source/modules/asura-core/graphics/image.cpp
@@ -26,16 +26,13 @@ namespace AsuraEngine
ImageData* imgData = static_cast<ImageData*>(data);
ASSERT(imgData);
- glBindTexture(GL_TEXTURE_2D, mTexHandle);
+ glBindTexture(GL_TEXTURE_2D, mTex);
imgData->Lock();
-
int width = imgData->width;
int height = imgData->height;
-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgData->pixels);
mImageData = imgData;
-
imgData->Unlock();
glBindTexture(GL_TEXTURE_2D, 0);
diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h
index 377e002..06108ed 100644
--- a/source/modules/asura-core/graphics/image.h
+++ b/source/modules/asura-core/graphics/image.h
@@ -33,7 +33,7 @@ namespace AsuraEngine
{
public:
- LUAX_DECL_FACTORY(SimImage);
+ LUAX_DECL_FACTORY(Image);
Image();
@@ -46,11 +46,9 @@ namespace AsuraEngine
bool Refresh(AEIO::DecodedData* decodeData) override;
bool Refresh(AEIO::DecodedData* decodeData, const AEMath::Recti& rect);
-
- uint GetWidth();
- uint GetHeight();
- Math::Vector2u GetSize();
- Color32 GetPixel(uint x, uint y);
+ uint GetWidth();
+ uint GetHeight();
+ Color32 GetPixel(uint x, uint y);
void Render(const RenderTarget* rt, const RenderState& state) override;
diff --git a/source/modules/asura-core/graphics/shader.cpp b/source/modules/asura-core/graphics/shader.cpp
index 1a85866..c0c6f75 100644
--- a/source/modules/asura-core/graphics/shader.cpp
+++ b/source/modules/asura-core/graphics/shader.cpp
@@ -27,7 +27,7 @@ namespace AsuraEngine
GLuint Shader::GetGLProgramHandle()
{
- return mProgramHandle;
+ return mProgram;
}
void Shader::Use()
diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h
index 8c21ab2..df0fcca 100644
--- a/source/modules/asura-core/graphics/shader.h
+++ b/source/modules/asura-core/graphics/shader.h
@@ -13,6 +13,7 @@
#include <asura-utils/stringmap.hpp>
#include <asura-utils/manager.hpp>
+#include "shader_source.h"
#include "color.h"
#include "texture.h"
#include "gl.h"
@@ -23,8 +24,9 @@ namespace AsuraEngine
{
///
- /// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩuniformsuseɫķ༭
- /// ÿshaderͨshaderҵuniforms¶frameworkmaterialá
+ /// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩ
+ /// uniformsuseɫķ༭ÿshaderͨshaderҵuniforms
+ /// ¶frameworkmaterialá
///
class Shader ASURA_FINAL
: public Scripting::Portable<Shader>
@@ -32,15 +34,18 @@ namespace AsuraEngine
{
public:
+ LUAX_DECL_FACTORY(Shader);
+
Shader();
~Shader();
///
- /// ӴshaderʱȼǷϴλuniforms location mapʹglAttachShader±ɫ
- /// ɫ
+ /// ӴshaderʱȼǷϴλuniforms location mapʹ
+ /// glAttachShader±ɫɫ
///
- bool Load(const std::string& vertexShader, const std::string& fragmentShader);
+ //bool Load(const std::string& vertexShader, const std::string& fragmentShader);
+ bool Refresh(AEIO::DecodedData* decodeData) override;
///
/// shaderΪ
@@ -92,13 +97,13 @@ namespace AsuraEngine
///
/// OpenGL shader program handle.
///
- GLuint mProgramHandle;
+ GLuint mProgram;
- //------------------------------------------------------------------------------//
+ Luax::LuaxMemberRef mCodeRef;
- public:
+ private:
- LUAX_DECL_FACTORY(SimShader);
+ //----------------------------------------------------------------------------//
LUAX_DECL_METHOD(_New);
LUAX_DECL_METHOD(_Use);
@@ -114,9 +119,7 @@ namespace AsuraEngine
LUAX_DECL_METHOD(_SetUniformVector4);
LUAX_DECL_METHOD(_SetUniformColor);
- private:
-
- Luax::LuaxMemberRef mCodeLuaRef;
+ //----------------------------------------------------------------------------//
};
diff --git a/source/modules/asura-core/graphics/shader_source.h b/source/modules/asura-core/graphics/shader_source.h
new file mode 100644
index 0000000..b3e815c
--- /dev/null
+++ b/source/modules/asura-core/graphics/shader_source.h
@@ -0,0 +1,30 @@
+#ifndef __ASURA_SHADER_SOURCE_H__
+#define __ASURA_SHADER_SOURCE_H__
+
+#include <string>
+
+#include <asura-utils/io/decoded_data.h>
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ ///
+ /// Asura EngineʹõshaderԴ룬GLSL
+ ///
+ class ShaderSouce : public AEIO::DecodedData
+ {
+ public:
+ void Decode(AEIO::DataBuffer& buffer) override;
+
+ private:
+ std::string mVert;
+ std::string mFrag;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp
index 0897702..c260ce9 100644
--- a/source/modules/asura-core/graphics/texture.cpp
+++ b/source/modules/asura-core/graphics/texture.cpp
@@ -6,20 +6,20 @@ namespace AsuraEngine
{
Texture::Texture()
- : mTexHandle(0)
+ : mTex(0)
{
// GL texture
- glGenTextures(1, &mTexHandle);
+ glGenTextures(1, &mTex);
}
Texture::~Texture()
{
- glDeleteTextures(1, &mTexHandle);
+ glDeleteTextures(1, &mTex);
}
GLuint Texture::GetGLTextureHandle() const
{
- return mTexHandle;
+ return mTex;
}
}
diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h
index a76e1d4..02d3407 100644
--- a/source/modules/asura-core/graphics/texture.h
+++ b/source/modules/asura-core/graphics/texture.h
@@ -22,7 +22,6 @@ namespace AsuraEngine
WRAP_MODE_MIRROR,
WRAP_MODE_CLAMPTOEDGE,
WRAP_MODE_CLAMPTOBORDER,
- //WRAP_MODE_PERAXIS, // UVвͬ4ֵ
};
enum FilterMode
@@ -47,11 +46,11 @@ namespace AsuraEngine
/// ϲԵѿϵΪ׼EditorҲϽΪԭ㣬Ϊ
/// 㡣
///
- ASURA_ABSTRACT class Texture
+ ASURA_ABSTRACT class Texture : virtual public AEScripting::NativeAccessor
{
public:
- LUAX_DECL_ABSTRACT_FACTORY();
+ LUAX_DECL_ABSTRACT_FACTORY(Texture);
Texture();
virtual ~Texture();
@@ -67,7 +66,7 @@ namespace AsuraEngine
///
/// UVfilterΪ
///
- void IsGenMipmap();
+ bool IsGenMipmap();
///
/// ȾtexturertϣԭϽǣң
@@ -81,11 +80,21 @@ namespace AsuraEngine
protected:
- LUAX_DECL_ENUM(ColorFormat);
- LUAX_DECL_ENUM(FilterMode);
- LUAX_DECL_ENUM(WrapMode);
+ //----------------------------------------------------------------------------//
- GLuint mTexHandle;
+ LUAX_DECL_ENUM(ColorFormat, 1);
+ LUAX_DECL_ENUM(FilterMode, 1);
+ LUAX_DECL_ENUM(WrapMode, 1);
+
+ LUAX_DECL_METHOD(_SetFilterMode);
+ LUAX_DECL_METHOD(_SetWrapMode);
+ LUAX_DECL_METHOD(_GetFilterMode);
+ LUAX_DECL_METHOD(_GetWrapMode);
+ LUAX_DECL_METHOD(_IsGenMipmap);
+
+ //----------------------------------------------------------------------------//
+
+ GLuint mTex;
FilterMode mMinFilter;
FilterMode mMagFilter;
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/window/window_impl_glew.cpp b/source/modules/asura-core/input/equeue_impl_sdl.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glew.cpp
+++ b/source/modules/asura-core/input/equeue_impl_sdl.h
diff --git a/source/modules/asura-core/window/window_impl_glew.h b/source/modules/asura-core/input/equeue_impl_win32.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glew.h
+++ 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:
diff --git a/source/modules/asura-core/threading/thread_ex.cpp b/source/modules/asura-core/threading/thread_ex.cpp
index 18b9fc7..334e58b 100644
--- a/source/modules/asura-core/threading/thread_ex.cpp
+++ b/source/modules/asura-core/threading/thread_ex.cpp
@@ -5,7 +5,7 @@ namespace AsuraEngine
namespace Threading
{
- void ThreadEx::Process()
+ int ThreadEx::Process()
{
}
diff --git a/source/modules/asura-core/window/window.cpp b/source/modules/asura-core/window/window.cpp
deleted file mode 100644
index 83a4f53..0000000
--- a/source/modules/asura-core/window/window.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "Config.h"
-#include "Window.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- Window::Window(WindowStyle style)
- {
- }
-
- Window::~Window()
- {
-
- }
-
- void Window::SetPosition(int x, int y)
- {
- ASSERT(mWindowHandle);
- SDL_SetWindowPosition(mWindowHandle, x, y);
- }
-
- void Window::SetTitle(const std::string& title)
- {
-
- }
-
- void Window::Show()
- {
-
- }
-
- void Window::Hide()
- {
-
- }
-
- void Window::SetWindowStyle(WindowStyle style)
- {
-
- }
-
- void Window::SwapRenderBuffer()
- {
-
- }
-
- }
-}
diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h
deleted file mode 100644
index 052e1ee..0000000
--- a/source/modules/asura-core/window/window.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef __ASURA_ENGINE_WINDOW_H__
-#define __ASURA_ENGINE_WINDOW_H__
-
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/math/vector2.hpp>
-
-#include "../graphics/render_state.h"
-#include "../graphics/render_target.h"
-
-namespace AsuraEngine
-{
- namespace Graphics
- {
-
- class WindowImpl;
-
- enum WindowStyle
- {
- WINDOW_STYLE_FULLSCREEN = 1 << 1,
- };
-
- ///
- /// ϷĵڣrunnerֻҪһڡͬĿͻʵִ˽ӿڲֶעᵽlua༭ᵼ࣬޽ӵ༭
- /// ⴰϡ
- ///
- class Window
- : public RenderTarget
- , public AEScripting::Portable<Window>
- {
- public:
-
- LUAX_DECL_SINGLETON(Window);
-
- Window(WindowStyle style);
-
- ~Window();
-
- void SetSize(uint width, uint height);
-
- void SetPosition(int x, int y);
-
- void SetTitle(const std::string& title);
-
- void SetWindowStyle(WindowStyle style);
-
- void Show();
-
- void Hide();
-
- ///
- /// ǿ˫ĴڣҪչʾǰ̨
- ///
- void SwapRenderBuffer();
-
- void Clear(const Color& col = Color::Black);
-
- void Clear(const Math::Recti& quad, const Color& col = Color::Black);
-
- void Draw(const Drawable* texture, const RenderState& state);
-
- void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state);
-
- protected:
-
- WindowImpl* mImpl;
-
- LUAX_DECL_METHOD(_Show);
- LUAX_DECL_METHOD(_Hide);
- LUAX_DECL_METHOD(_SetResolution);
- LUAX_DECL_METHOD(_SetFullScreen);
- LUAX_DECL_METHOD(_SetTitle);
- LUAX_DECL_METHOD(_SetWindowStyle);
- LUAX_DECL_METHOD(_Clear);
- LUAX_DECL_METHOD(_Draw);
- LUAX_DECL_METHOD(_SwapRenderBuffer);
-
- };
-
- using RenderWindow = Window;
-
- ASURA_ABSTRACT class WindowImpl
- {
- public:
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/wnd/binding/_window.cpp b/source/modules/asura-core/wnd/binding/_window.cpp
new file mode 100644
index 0000000..eb92de8
--- /dev/null
+++ b/source/modules/asura-core/wnd/binding/_window.cpp
@@ -0,0 +1,180 @@
+#include "../../graphics/image_data.h"
+
+#include "../window.h"
+
+using namespace std;
+using namespace AEGraphics;
+
+namespace AsuraEngine
+{
+ namespace Wnd
+ {
+
+ LUAX_REGISTRY(Window)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "Init", _Init },
+ { "Exit", _Exit },
+ { "Show", _Show },
+ { "Hide", _Hide },
+ { "SetSize", _SetSize },
+ { "SetPosition", _SetPosition },
+ { "SetTitle", _SetTitle },
+ { "SetIcon", _SetIcon },
+ { "SwapRenderBuffer", _SwapRenderBuffer },
+ { "Clear", _Clear },
+ { "Draw", _Draw }
+ );
+ }
+
+ LUAX_POSTPROCESS(Window)
+ {
+ LUAX_REGISTER_ENUM(state, "EWindowFlag",
+ { "FULLSCREEN", WINDOW_FULLSCREEN },
+ { "OPENGL", WINDOW_OPENGL },
+ { "SHOWN", WINDOW_SHOWN },
+ { "HIDDEN", WINDOW_HIDDEN },
+ { "BORDERLESS", WINDOW_BORDERLESS },
+ { "RESIZABLE", WINDOW_RESIZABLE },
+ { "MINIMIZED", WINDOW_MINIMIZED },
+ { "MAXIMIZED", WINDOW_MAXIMIZED },
+ { "INPUT_GRABBED", WINDOW_INPUT_GRABBED },
+ { "INPUT_FOCUS", WINDOW_INPUT_FOCUS },
+ { "MOUSE_FOCUS", WINDOW_MOUSE_FOCUS },
+ { "ALLOW_HIGHDPI", WINDOW_ALLOW_HIGHDPI },
+ { "MOUSE_CAPTURE", WINDOW_MOUSE_CAPTURE },
+ { "ALWAYS_ON_TOP", WINDOW_ALWAYS_ON_TOP }
+ );
+
+ }
+
+ // Window.Init(config_table)
+ LUAX_IMPL_METHOD(Window, _Init)
+ {
+ LUAX_PREPARE(L, Window);
+
+ WindowConfig config;
+
+ if (!state.IsType(1, LUA_TTABLE))
+ return state.ErrorType(1, "window config table");
+
+ config.width = state.GetField(1, "width", 0);
+ config.height = state.GetField(1, "height", 0);
+ config.x = state.GetField(1, "x", 0);
+ config.y = state.GetField(1, "y", 0);
+ config.flag = state.GetField(1, "flag", WINDOW_OPENGL);
+ config.title = state.GetField(1, "title", "");
+ config.vsync = state.GetField(1, "vsync", true);
+ config.show = state.GetField(1, "show", true);
+
+ // try set window icon
+ state.GetField(1, "icon");
+ if (state.IsType(1, LUA_TUSERDATA))
+ {
+ ImageData* data = state.CheckUserdata<ImageData>(-1);
+ if (data)
+ {
+ data->Lock();
+ config.icon = data;
+ Window::Get()->Init(config);
+ data->Unlock();
+ return 0;
+ }
+ }
+ else
+ state.Pop();
+
+ Window::Get()->Init(config);
+
+ return 0;
+ }
+
+ // Window.Exit()
+ LUAX_IMPL_METHOD(Window, _Exit)
+ {
+ LUAX_PREPARE(L, Window);
+ Window::Get()->Exit();
+ return 0;
+ }
+
+ // Window.Show()
+ LUAX_IMPL_METHOD(Window, _Show)
+ {
+ LUAX_PREPARE(L, Window);
+ Window::Get()->Show();
+ return 0;
+ }
+
+ // Window.Hide()
+ LUAX_IMPL_METHOD(Window, _Hide)
+ {
+ LUAX_PREPARE(L, Window);
+ Window::Get()->Hide();
+ return 0;
+ }
+
+ // Window.SetSize(w, h)
+ LUAX_IMPL_METHOD(Window, _SetSize)
+ {
+ LUAX_PREPARE(L, Window);
+ uint w = state.CheckValue<uint>(1);
+ uint h = state.CheckValue<uint>(2);
+ Window::Get()->SetSize(w, h);
+ return 0;
+ }
+
+ // Window.SetPosition(x, y)
+ LUAX_IMPL_METHOD(Window, _SetPosition)
+ {
+ LUAX_PREPARE(L, Window);
+ int x = state.CheckValue<int>(1);
+ int y = state.CheckValue<int>(2);
+ Window::Get()->SetPosition(x, y);
+ return 0;
+ }
+
+ // Window.SetTitle(title)
+ LUAX_IMPL_METHOD(Window, _SetTitle)
+ {
+ LUAX_PREPARE(L, Window);
+ std::string title = state.CheckValue<string>(1);
+ Window::Get()->SetTitle(title);
+ return 0;
+ }
+
+ // Window.SetIcon(imageData)
+ LUAX_IMPL_METHOD(Window, _SetIcon)
+ {
+ LUAX_PREPARE(L, Window);
+ ImageData* imgData = state.CheckUserdata<ImageData>(1);
+ imgData->Lock();
+ Window::Get()->SetIcon(imgData);
+ imgData->Unlock();
+ return 0;
+ }
+
+ // Window.SwapRenderBuffer()
+ LUAX_IMPL_METHOD(Window, _SwapRenderBuffer)
+ {
+ LUAX_PREPARE(L, Window);
+ Window::Get()->SwapRenderBuffer();
+ return 0;
+ }
+
+ // Window.Clear()
+ LUAX_IMPL_METHOD(Window, _Clear)
+ {
+ LUAX_PREPARE(L, Window);
+ Window::Get()->Clear();
+ return 0;
+ }
+
+ // Window.Draw()
+ LUAX_IMPL_METHOD(Window, _Draw)
+ {
+ LUAX_PREPARE(L, Window);
+ return 0;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/source/modules/asura-core/wnd/window.cpp b/source/modules/asura-core/wnd/window.cpp
new file mode 100644
index 0000000..174d04e
--- /dev/null
+++ b/source/modules/asura-core/wnd/window.cpp
@@ -0,0 +1,108 @@
+#include <asura-utils/exceptions/exception.h>
+
+#include "window.h"
+
+#include "window_impl_sdl.h"
+#include "window_impl_glew.h"
+#include "window_impl_glut.h"
+
+namespace AsuraEngine
+{
+ namespace Wnd
+ {
+
+ Window::Window()
+ : mImpl(nullptr)
+ {
+ }
+
+ Window::~Window()
+ {
+ if (mImpl)
+ delete mImpl;
+ }
+
+#define try_init_window(impl) \
+ if (!mImpl) \
+ { \
+ try \
+ { \
+ mImpl = new impl(config); \
+ } \
+ catch (Exception& e) \
+ { \
+ mImpl = nullptr; \
+ } \
+ }
+
+ bool Window::Init(const WindowConfig& config)
+ {
+ ASSERT(!mImpl);
+#if ASURA_WINDOW_SDL
+ try_init_window(WindowImplSDL);
+#endif
+ ASSERT(mImpl);
+ }
+
+ void Window::Exit()
+ {
+ if (mImpl)
+ delete mImpl;
+ }
+
+ void Window::SetPosition(int x, int y)
+ {
+ ASSERT(mImpl);
+ mImpl->SetPosition(x, y);
+ }
+
+ void Window::SetTitle(const std::string& title)
+ {
+ ASSERT(mImpl);
+ mImpl->SetTitils(title);
+ }
+
+ void Window::Show()
+ {
+ ASSERT(mImpl);
+ mImpl->Show();
+ }
+
+ void Window::Hide()
+ {
+ ASSERT(mImpl);
+ mImpl->Hide();
+ }
+
+ void Window::SwapRenderBuffer()
+ {
+ ASSERT(mImpl);
+ mImpl->SwapRenderBuffer();
+ }
+
+ void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
+ {
+ ASSERT(mImpl);
+
+ }
+
+ void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
+ {
+ ASSERT(mImpl);
+
+ }
+
+ void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state)
+ {
+ ASSERT(mImpl);
+
+ }
+
+ void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state)
+ {
+ ASSERT(mImpl);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/wnd/window.h b/source/modules/asura-core/wnd/window.h
new file mode 100644
index 0000000..1ecb934
--- /dev/null
+++ b/source/modules/asura-core/wnd/window.h
@@ -0,0 +1,149 @@
+#ifndef __ASURA_ENGINE_WINDOW_H__
+#define __ASURA_ENGINE_WINDOW_H__
+
+#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/math/vector2.hpp>
+#include <asura-utils/singleton.hpp>
+
+#include "../graphics/image.h"
+#include "../graphics/render_state.h"
+#include "../graphics/render_target.h"
+
+namespace AsuraEngine
+{
+ namespace Wnd
+ {
+
+ class WindowImpl;
+
+ ///
+ /// SDLģһЩõġ
+ ///
+ enum WindowFlag
+ {
+ WINDOW_FULLSCREEN = 1 << 1, /**< fullscreen window */
+ WINDOW_OPENGL = 1 << 2, /**< window usable with OpenGL context */
+ WINDOW_SHOWN = 1 << 3, /**< window is visible */
+ WINDOW_HIDDEN = 1 << 4, /**< window is not visible */
+ WINDOW_BORDERLESS = 1 << 5, /**< no window decoration */
+ WINDOW_RESIZABLE = 1 << 6, /**< window can be resized */
+ WINDOW_MINIMIZED = 1 << 7, /**< window is minimized */
+ WINDOW_MAXIMIZED = 1 << 8, /**< window is maximized */
+ WINDOW_INPUT_GRABBED = 1 << 9, /**< window has grabbed input focus */
+ WINDOW_INPUT_FOCUS = 1 << 10, /**< window has input focus */
+ WINDOW_MOUSE_FOCUS = 1 << 11, /**< window has mouse focus */
+ WINDOW_ALLOW_HIGHDPI = 1 << 12, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
+ WINDOW_MOUSE_CAPTURE = 1 << 13, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+ WINDOW_ALWAYS_ON_TOP = 1 << 14, /**< window should always be above others */
+ };
+
+ ///
+ /// Windowʼ
+ ///
+ struct WindowConfig
+ {
+ uint width, height; ///< ߴ
+ int x, y; ///< ڳʼ
+ std::string title; ///<
+ bool vsync; ///< ֱͬ
+ AEGraphics::ImageData* icon; ///< ͼ
+ bool show; ///< Ƿʾ
+ int flag; ///< ڱ
+ };
+
+ ///
+ /// ϷĵڣrunnerֻҪһڡͬĿͻʵִ˽ӿڲֶעᵽlua༭
+ /// ᵼ࣬޽ӵ༭ⴰϡ
+ ///
+ class Window ASURA_FINAL
+ : public AEGraphics::RenderTarget
+ , public AEScripting::Portable<Window>
+ , public Singleton<Window>
+ {
+ public:
+
+ ///
+ /// ϷʱĴΨһģ༭õࡣ
+ ///
+ LUAX_DECL_SINGLETON(Window);
+
+ Window();
+ ~Window();
+
+ ///
+ /// ڡ
+ ///
+ bool Init(const WindowConfig& config);
+ void Exit();
+
+ void SetSize(uint width, uint height);
+ void SetPosition(int x, int y);
+ void SetTitle(const std::string& title);
+ void SetIcon(AEGraphics::ImageData* imgData);
+
+ void Show();
+ void Hide();
+
+ ///
+ /// ǿ˫ĴڣҪչʾǰ̨
+ ///
+ void SwapRenderBuffer();
+
+ void Clear(const AEGraphics::Color& col = AEGraphics::Color::Black) override;
+ void Clear(const Math::Recti& quad, const AEGraphics::Color& col = AEGraphics::Color::Black) override;
+
+ void Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) override;
+ void Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) override;
+
+ private:
+
+ //----------------------------------------------------------------------------//
+
+ LUAX_DECL_ENUM(WindowFlag, 0);
+
+ LUAX_DECL_METHOD(_Init);
+ LUAX_DECL_METHOD(_Exit);
+ LUAX_DECL_METHOD(_Show);
+ LUAX_DECL_METHOD(_Hide);
+ LUAX_DECL_METHOD(_SetSize);
+ LUAX_DECL_METHOD(_SetPosition);
+ LUAX_DECL_METHOD(_SetTitle);
+ LUAX_DECL_METHOD(_SetIcon);
+ LUAX_DECL_METHOD(_SwapRenderBuffer);
+ LUAX_DECL_METHOD(_Clear);
+ LUAX_DECL_METHOD(_Draw);
+
+ //----------------------------------------------------------------------------//
+
+ WindowImpl* mImpl;
+
+ };
+
+ using RenderWindow = Window;
+
+ ASURA_ABSTRACT class WindowImpl
+ {
+ public:
+
+ WindowImpl() {};
+ virtual ~WindowImpl() {};
+
+ virtual void SetSize(uint width, uint height) = 0;
+ virtual void SetPosition(int x, int y) = 0;
+ virtual void SetTitils(const std::string& title) = 0;
+
+ virtual void Show();
+ virtual void Hide();
+
+ virtual void SwapRenderBuffer() = 0;
+
+ };
+
+ }
+}
+
+namespace AEWnd = AsuraEngine::Wnd;
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/window/window_impl_glut.cpp b/source/modules/asura-core/wnd/window_impl_glew.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glut.cpp
+++ b/source/modules/asura-core/wnd/window_impl_glew.cpp
diff --git a/source/modules/asura-core/window/window_impl_glut.h b/source/modules/asura-core/wnd/window_impl_glew.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glut.h
+++ b/source/modules/asura-core/wnd/window_impl_glew.h
diff --git a/source/modules/asura-core/window/window_impl_sdl.cpp b/source/modules/asura-core/wnd/window_impl_glut.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_sdl.cpp
+++ b/source/modules/asura-core/wnd/window_impl_glut.cpp
diff --git a/source/modules/asura-core/window/window_impl_sdl.h b/source/modules/asura-core/wnd/window_impl_glut.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_sdl.h
+++ b/source/modules/asura-core/wnd/window_impl_glut.h
diff --git a/source/modules/asura-core/wnd/window_impl_sdl.cpp b/source/modules/asura-core/wnd/window_impl_sdl.cpp
new file mode 100644
index 0000000..bbbef9a
--- /dev/null
+++ b/source/modules/asura-core/wnd/window_impl_sdl.cpp
@@ -0,0 +1,141 @@
+#include <SDL2/SDL.h>
+
+#include <asura-utils/exceptions/exception.h>
+
+#include "window_impl_sdl.h"
+
+using namespace AEGraphics;
+
+namespace AsuraEngine
+{
+ namespace Wnd
+ {
+
+#define asura_flag_to_sdl_flag(flag, _flag, _sdl_flag) \
+ if ((flag & _flag) != 0) \
+ flag |= _sdl_flag
+
+ WindowImplSDL::WindowImplSDL(const WindowConfig& config)
+ : mWnd(nullptr)
+ , mGLContext(0)
+ {
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ throw Exception("Cant init sdl video.");
+
+ int flag = 0x0;
+ asura_flag_to_sdl_flag(flag, WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN);
+ asura_flag_to_sdl_flag(flag, WINDOW_OPENGL, SDL_WINDOW_OPENGL);
+ asura_flag_to_sdl_flag(flag, WINDOW_SHOWN, SDL_WINDOW_SHOWN);
+ asura_flag_to_sdl_flag(flag, WINDOW_HIDDEN, SDL_WINDOW_HIDDEN);
+ asura_flag_to_sdl_flag(flag, WINDOW_BORDERLESS, SDL_WINDOW_BORDERLESS);
+ asura_flag_to_sdl_flag(flag, WINDOW_RESIZABLE, SDL_WINDOW_RESIZABLE);
+ asura_flag_to_sdl_flag(flag, WINDOW_MINIMIZED, SDL_WINDOW_MINIMIZED);
+ asura_flag_to_sdl_flag(flag, WINDOW_MAXIMIZED, SDL_WINDOW_MAXIMIZED);
+ asura_flag_to_sdl_flag(flag, WINDOW_INPUT_GRABBED, SDL_WINDOW_INPUT_GRABBED);
+ asura_flag_to_sdl_flag(flag, WINDOW_INPUT_FOCUS, SDL_WINDOW_INPUT_FOCUS);
+ asura_flag_to_sdl_flag(flag, WINDOW_MOUSE_FOCUS, SDL_WINDOW_MOUSE_FOCUS);
+ asura_flag_to_sdl_flag(flag, WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_ALLOW_HIGHDPI);
+ asura_flag_to_sdl_flag(flag, WINDOW_MOUSE_CAPTURE, SDL_WINDOW_MOUSE_CAPTURE);
+ asura_flag_to_sdl_flag(flag, WINDOW_ALWAYS_ON_TOP, SDL_WINDOW_ALWAYS_ON_TOP);
+
+ // Set GL window / framebuffer attributes.
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
+
+ mWnd = SDL_CreateWindow(config.title.c_str(), config.x, config.y, config.width, config.height, flag);
+
+ if (!mWnd)
+ throw Exception("Cant create SDL window.");
+
+ // ͼ
+ try
+ {
+ if (config.icon)
+ {
+ ImageData* img = config.icon;
+ if (img->format == COLOR_FORMAT_RGBA8)
+ {
+ SDL_Surface *surface;
+
+ img->Lock();
+
+ int w = img->width, h = img->height;
+ surface = SDL_CreateRGBSurfaceFrom(
+ img->pixels,
+ w, h,
+ 32,
+ w * 4,
+ Color32::RMASK,
+ Color32::GMASK,
+ Color32::BMASK,
+ Color32::AMASK
+ );
+
+ img->Unlock();
+
+ SDL_SetWindowIcon(mWnd, surface);
+ SDL_FreeSurface(surface);
+ }
+ }
+ } catch (...)
+ {
+ }
+
+ mGLContext = SDL_GL_CreateContext(mWnd);
+
+ if (!mGLContext)
+ {
+ SDL_DestroyWindow(mWnd);
+ throw Exception("Cant create SDL GL Context.");
+ }
+
+ SDL_GL_MakeCurrent(mWnd, mGLContext);
+ SDL_GL_SetSwapInterval(config.vsync ? 1 : 0);
+ }
+
+ WindowImplSDL::~WindowImplSDL()
+ {
+ SDL_GL_DeleteContext(mGLContext);
+ SDL_DestroyWindow(mWnd);
+ SDL_FlushEvent(SDL_WINDOWEVENT);
+ }
+
+ void WindowImplSDL::SetSize(uint width, uint height)
+ {
+ SDL_SetWindowSize(mWnd, width, height);
+ }
+
+ void WindowImplSDL::SetPosition(int x, int y)
+ {
+ SDL_SetWindowPosition(mWnd, x, y);
+ }
+
+ void WindowImplSDL::SetTitils(const std::string& title)
+ {
+ SDL_SetWindowTitle(mWnd, title.c_str());
+ }
+
+ void WindowImplSDL::Show()
+ {
+ SDL_ShowWindow(mWnd);
+ }
+
+ void WindowImplSDL::Hide()
+ {
+ SDL_HideWindow(mWnd);
+ }
+
+ void WindowImplSDL::SwapRenderBuffer()
+ {
+ SDL_GL_SwapWindow(mWnd);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/source/modules/asura-core/wnd/window_impl_sdl.h b/source/modules/asura-core/wnd/window_impl_sdl.h
new file mode 100644
index 0000000..03e6579
--- /dev/null
+++ b/source/modules/asura-core/wnd/window_impl_sdl.h
@@ -0,0 +1,39 @@
+#ifndef __ASURA_WINDOW_SDL_H_
+#define __ASURA_WINDOW_SDL_H_
+
+#include <SDL2/SDL.h>
+
+#include "window.h"
+
+namespace AsuraEngine
+{
+ namespace Wnd
+ {
+
+ class WindowImplSDL ASURA_FINAL : public WindowImpl
+ {
+ public:
+
+ WindowImplSDL(const WindowConfig& config);
+ ~WindowImplSDL();
+
+ void SetSize(uint width, uint height);
+ void SetPosition(int x, int y);
+ void SetTitils(const std::string& title);
+
+ void Show();
+ void Hide();
+
+ void SwapRenderBuffer();
+
+ private:
+
+ SDL_Window* mWnd;
+ SDL_GLContext mGLContext;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-json/json.cpp b/source/modules/asura-json/json/json.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-json/json.cpp
+++ b/source/modules/asura-json/json/json.cpp
diff --git a/source/modules/asura-json/json.h b/source/modules/asura-json/json/json.h
index 2bdaf53..2bdaf53 100644
--- a/source/modules/asura-json/json.h
+++ b/source/modules/asura-json/json/json.h
diff --git a/source/modules/asura-openal/audio.cpp b/source/modules/asura-network/network_module.h
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/audio.cpp
+++ b/source/modules/asura-network/network_module.h
diff --git a/source/modules/asura-openal/audio.h b/source/modules/asura-openal/audio/audio.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/audio.h
+++ b/source/modules/asura-openal/audio/audio.cpp
diff --git a/source/modules/asura-openal/mpg123_decoder.cpp b/source/modules/asura-openal/audio/audio.h
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/mpg123_decoder.cpp
+++ b/source/modules/asura-openal/audio/audio.h
diff --git a/source/modules/asura-openal/mpg123_decoder.h b/source/modules/asura-openal/audio/mpg123_decoder.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/mpg123_decoder.h
+++ b/source/modules/asura-openal/audio/mpg123_decoder.cpp
diff --git a/source/modules/asura-openal/sound.cpp b/source/modules/asura-openal/audio/mpg123_decoder.h
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/sound.cpp
+++ b/source/modules/asura-openal/audio/mpg123_decoder.h
diff --git a/source/modules/asura-openal/sound_data.cpp b/source/modules/asura-openal/audio/sound.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/sound_data.cpp
+++ b/source/modules/asura-openal/audio/sound.cpp
diff --git a/source/modules/asura-openal/sound.h b/source/modules/asura-openal/audio/sound.h
index 2b0eab0..2b0eab0 100644
--- a/source/modules/asura-openal/sound.h
+++ b/source/modules/asura-openal/audio/sound.h
diff --git a/source/modules/asura-openal/sound_data.h b/source/modules/asura-openal/audio/sound_data.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/sound_data.h
+++ b/source/modules/asura-openal/audio/sound_data.cpp
diff --git a/source/modules/asura-openal/sound_decode_task.cpp b/source/modules/asura-openal/audio/sound_data.h
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/sound_decode_task.cpp
+++ b/source/modules/asura-openal/audio/sound_data.h
diff --git a/source/modules/asura-openal/source.cpp b/source/modules/asura-openal/audio/sound_decode_task.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/source.cpp
+++ b/source/modules/asura-openal/audio/sound_decode_task.cpp
diff --git a/source/modules/asura-openal/sound_decode_task.h b/source/modules/asura-openal/audio/sound_decode_task.h
index 9587276..9587276 100644
--- a/source/modules/asura-openal/sound_decode_task.h
+++ b/source/modules/asura-openal/audio/sound_decode_task.h
diff --git a/source/modules/asura-openal/sound_decoder.cpp b/source/modules/asura-openal/audio/sound_decoder.cpp
index ad9f761..ad9f761 100644
--- a/source/modules/asura-openal/sound_decoder.cpp
+++ b/source/modules/asura-openal/audio/sound_decoder.cpp
diff --git a/source/modules/asura-openal/sound_decoder.h b/source/modules/asura-openal/audio/sound_decoder.h
index e28a5a9..e28a5a9 100644
--- a/source/modules/asura-openal/sound_decoder.h
+++ b/source/modules/asura-openal/audio/sound_decoder.h
diff --git a/source/modules/asura-openal/source.h b/source/modules/asura-openal/audio/source.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/source.h
+++ b/source/modules/asura-openal/audio/source.cpp
diff --git a/source/modules/asura-openal/vorbis_decoder.cpp b/source/modules/asura-openal/audio/source.h
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/vorbis_decoder.cpp
+++ b/source/modules/asura-openal/audio/source.h
diff --git a/source/modules/asura-openal/vorbis_decoder.h b/source/modules/asura-openal/audio/vorbis_decoder.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-openal/vorbis_decoder.h
+++ b/source/modules/asura-openal/audio/vorbis_decoder.cpp
diff --git a/source/modules/asura-openal/audio/vorbis_decoder.h b/source/modules/asura-openal/audio/vorbis_decoder.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-openal/audio/vorbis_decoder.h
diff --git a/source/modules/asura-utils/threading/thread_impl_posix.cpp b/source/modules/asura-utils/threading/thread_impl_posix.cpp
index d2ad7af..d689353 100644
--- a/source/modules/asura-utils/threading/thread_impl_posix.cpp
+++ b/source/modules/asura-utils/threading/thread_impl_posix.cpp
@@ -5,5 +5,7 @@ namespace AsuraEngine
namespace Threading
{
+
+
}
} \ No newline at end of file
diff --git a/source/modules/asura-utils/type.h b/source/modules/asura-utils/type.h
index 1ed2d42..bd09bc4 100644
--- a/source/modules/asura-utils/type.h
+++ b/source/modules/asura-utils/type.h
@@ -80,6 +80,8 @@ namespace AsuraEngine
#define ASURA_SDL_HOST 1
+#define ASURA_LITTLE_ENDIAN 1
+
} // namespace AsuraEngine
#endif // __ASURA_CONFIG_H__ \ No newline at end of file