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/Application.cpp23
-rw-r--r--source/modules/asura-core/Application.h81
-rw-r--r--source/modules/asura-core/CoreConfig.h (renamed from source/modules/asura-core/core_config.h)4
-rw-r--r--source/modules/asura-core/CoreModule.cpp (renamed from source/modules/asura-core/core_module.cpp)4
-rw-r--r--source/modules/asura-core/CoreModule.h26
-rw-r--r--source/modules/asura-core/Font/Glyph.cpp (renamed from source/modules/asura-core/graphics/color_palette.h)0
-rw-r--r--source/modules/asura-core/Font/Glyph.h (renamed from source/modules/asura-core/graphics/render_target.cpp)0
-rw-r--r--source/modules/asura-core/Font/String.cpp376
-rw-r--r--source/modules/asura-core/Font/String.hpp595
-rw-r--r--source/modules/asura-core/Font/String.inc (renamed from source/modules/asura-core/font/string.inl)0
-rw-r--r--source/modules/asura-core/Font/TTF.cpp (renamed from source/modules/asura-core/graphics/sprite_batch.cpp)0
-rw-r--r--source/modules/asura-core/Font/TTF.h17
-rw-r--r--source/modules/asura-core/Font/Utf.hpp720
-rw-r--r--source/modules/asura-core/Font/Utf.inc (renamed from source/modules/asura-core/font/utf.inl)0
-rw-r--r--source/modules/asura-core/Graphics/BlendMode.h17
-rw-r--r--source/modules/asura-core/Graphics/Canvas.cpp49
-rw-r--r--source/modules/asura-core/Graphics/Canvas.h73
-rw-r--r--source/modules/asura-core/Graphics/Color.cpp58
-rw-r--r--source/modules/asura-core/Graphics/Color.h75
-rw-r--r--source/modules/asura-core/Graphics/Color32.cpp53
-rw-r--r--source/modules/asura-core/Graphics/Color32.h58
-rw-r--r--source/modules/asura-core/Graphics/ColorPalette.h (renamed from source/modules/asura-core/input/input_device.cpp)0
-rw-r--r--source/modules/asura-core/Graphics/DrawInfo.cpp10
-rw-r--r--source/modules/asura-core/Graphics/DrawInfo.h18
-rw-r--r--source/modules/asura-core/Graphics/GPUBuffer.cpp (renamed from source/modules/asura-core/graphics/gpu_buffer.cpp)2
-rw-r--r--source/modules/asura-core/Graphics/GPUBuffer.h (renamed from source/modules/asura-core/graphics/gpu_buffer.h)10
-rw-r--r--source/modules/asura-core/Graphics/GfxDevice.cpp (renamed from source/modules/asura-core/graphics/gfx_device.cpp)10
-rw-r--r--source/modules/asura-core/Graphics/GfxDevice.h (renamed from source/modules/asura-core/graphics/gfx_device.h)64
-rw-r--r--source/modules/asura-core/Graphics/Image.cpp103
-rw-r--r--source/modules/asura-core/Graphics/Image.h63
-rw-r--r--source/modules/asura-core/Graphics/IndexBuffer.cpp (renamed from source/modules/asura-core/graphics/index_buffer.cpp)2
-rw-r--r--source/modules/asura-core/Graphics/IndexBuffer.h (renamed from source/modules/asura-core/graphics/index_buffer.h)8
-rw-r--r--source/modules/asura-core/Graphics/MatrixStack.cpp (renamed from source/modules/asura-core/graphics/matrix_stack.cpp)2
-rw-r--r--source/modules/asura-core/Graphics/MatrixStack.h (renamed from source/modules/asura-core/graphics/matrix_stack.h)10
-rw-r--r--source/modules/asura-core/Graphics/Mesh2D.cpp (renamed from source/modules/asura-core/input/input_manager.cpp)0
-rw-r--r--source/modules/asura-core/Graphics/Mesh2D.h52
-rw-r--r--source/modules/asura-core/Graphics/Quad.cpp (renamed from source/modules/asura-core/input/joystick_state.h)0
-rw-r--r--source/modules/asura-core/Graphics/Quad.h1
-rw-r--r--source/modules/asura-core/Graphics/RenderState.h (renamed from source/modules/asura-core/graphics/render_state.h)10
-rw-r--r--source/modules/asura-core/Graphics/RenderTarget.cpp (renamed from source/modules/asura-core/input/mouse_state.h)0
-rw-r--r--source/modules/asura-core/Graphics/RenderTarget.h (renamed from source/modules/asura-core/graphics/render_target.h)14
-rw-r--r--source/modules/asura-core/Graphics/Shader.cpp282
-rw-r--r--source/modules/asura-core/Graphics/Shader.h117
-rw-r--r--source/modules/asura-core/Graphics/Shape.cpp (renamed from source/modules/asura-core/mesh/mesh2d_data.cpp)0
-rw-r--r--source/modules/asura-core/Graphics/Shape.h (renamed from source/modules/asura-core/mesh/mesh2d_handler.cpp)0
-rw-r--r--source/modules/asura-core/Graphics/SpriteBatch.cpp (renamed from source/modules/asura-core/mesh/obj_handler.cpp)0
-rw-r--r--source/modules/asura-core/Graphics/SpriteBatch.h (renamed from source/modules/asura-core/graphics/sprite_batch.h)8
-rw-r--r--source/modules/asura-core/Graphics/Texture.cpp47
-rw-r--r--source/modules/asura-core/Graphics/Texture.h101
-rw-r--r--source/modules/asura-core/Graphics/VertexBuffer.cpp (renamed from source/modules/asura-core/graphics/vertex_buffer.cpp)2
-rw-r--r--source/modules/asura-core/Graphics/VertexBuffer.h (renamed from source/modules/asura-core/graphics/vertex_buffer.h)8
-rw-r--r--source/modules/asura-core/Graphics/binding/_canvas.cpp48
-rw-r--r--source/modules/asura-core/Graphics/binding/_color.cpp130
-rw-r--r--source/modules/asura-core/Graphics/binding/_color32.cpp66
-rw-r--r--source/modules/asura-core/Graphics/binding/_gfx_device.cpp151
-rw-r--r--source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp118
-rw-r--r--source/modules/asura-core/Graphics/binding/_image.cpp71
-rw-r--r--source/modules/asura-core/Graphics/binding/_index_buffer.cpp31
-rw-r--r--source/modules/asura-core/Graphics/binding/_mesh2d.cpp20
-rw-r--r--source/modules/asura-core/Graphics/binding/_shader.cpp131
-rw-r--r--source/modules/asura-core/Graphics/binding/_sprite_batch.cpp20
-rw-r--r--source/modules/asura-core/Graphics/binding/_texture.cpp85
-rw-r--r--source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp38
-rw-r--r--source/modules/asura-core/Image/ImageData.cpp (renamed from source/modules/asura-core/image/image_data.cpp)8
-rw-r--r--source/modules/asura-core/Image/ImageData.h (renamed from source/modules/asura-core/image/image_data.h)18
-rw-r--r--source/modules/asura-core/Image/ImageDecodeTask.cpp (renamed from source/modules/asura-core/image/image_decode_task.cpp)2
-rw-r--r--source/modules/asura-core/Image/ImageDecodeTask.h (renamed from source/modules/asura-core/image/image_decode_task.h)10
-rw-r--r--source/modules/asura-core/Image/ImageDecoder.h (renamed from source/modules/asura-core/image/image_decoder.h)8
-rw-r--r--source/modules/asura-core/Image/PngDecoder.cpp (renamed from source/modules/asura-core/image/png_decoder.cpp)2
-rw-r--r--source/modules/asura-core/Image/PngDecoder.h (renamed from source/modules/asura-core/image/png_decoder.h)6
-rw-r--r--source/modules/asura-core/Image/StbDecoder.cpp (renamed from source/modules/asura-core/image/stb_decoder.cpp)4
-rw-r--r--source/modules/asura-core/Image/StbDecoder.h (renamed from source/modules/asura-core/image/stb_decoder.h)6
-rw-r--r--source/modules/asura-core/Image/binding/_image_data.cpp108
-rw-r--r--source/modules/asura-core/Image/binding/_image_decode_task.cpp19
-rw-r--r--source/modules/asura-core/Input/Button.h31
-rw-r--r--source/modules/asura-core/Input/ClipBoard.cpp (renamed from source/modules/asura-core/mesh/obj_handler.h)0
-rw-r--r--source/modules/asura-core/Input/ClipBoard.h (renamed from source/modules/asura-core/profiler/gpu_profiler.cpp)0
-rw-r--r--source/modules/asura-core/Input/InputDevice.cpp (renamed from source/modules/asura-core/profiler/gpu_profiler.h)0
-rw-r--r--source/modules/asura-core/Input/InputDevice.h (renamed from source/modules/asura-core/input/input_device.h)14
-rw-r--r--source/modules/asura-core/Input/InputManager.cpp (renamed from source/modules/asura-core/threading/channel.cpp)0
-rw-r--r--source/modules/asura-core/Input/InputManager.h (renamed from source/modules/asura-core/input/input_manager.h)6
-rw-r--r--source/modules/asura-core/Input/JoystickState.h (renamed from source/modules/asura-core/window/window_impl_glew.cpp)0
-rw-r--r--source/modules/asura-core/Input/KeyboardState.h (renamed from source/modules/asura-core/input/keyboard_state.h)2
-rw-r--r--source/modules/asura-core/Input/Keys.h482
-rw-r--r--source/modules/asura-core/Input/MouseState.h (renamed from source/modules/asura-core/window/window_impl_glew.h)0
-rw-r--r--source/modules/asura-core/Mesh/Am2Handler.cpp (renamed from source/modules/asura-core/mesh/am2_handler.cpp)2
-rw-r--r--source/modules/asura-core/Mesh/Am2Handler.h (renamed from source/modules/asura-core/mesh/am2_handler.h)6
-rw-r--r--source/modules/asura-core/Mesh/Mesh2DData.cpp (renamed from source/modules/asura-core/window/window_impl_glut.cpp)0
-rw-r--r--source/modules/asura-core/Mesh/Mesh2DData.h (renamed from source/modules/asura-core/mesh/mesh2d_data.h)14
-rw-r--r--source/modules/asura-core/Mesh/Mesh2DHandler.cpp (renamed from source/modules/asura-core/window/window_impl_glut.h)0
-rw-r--r--source/modules/asura-core/Mesh/Mesh2DHandler.h (renamed from source/modules/asura-core/mesh/mesh2d_handler.h)10
-rw-r--r--source/modules/asura-core/Mesh/ObjHandler.cpp0
-rw-r--r--source/modules/asura-core/Mesh/ObjHandler.h0
-rw-r--r--source/modules/asura-core/Profiler/GPUProfiler.cpp0
-rw-r--r--source/modules/asura-core/Profiler/GPUProfiler.h0
-rw-r--r--source/modules/asura-core/Profiler/Stats.cpp0
-rw-r--r--source/modules/asura-core/Profiler/Stats.h0
-rw-r--r--source/modules/asura-core/Threads/Channel.cpp0
-rw-r--r--source/modules/asura-core/Threads/Channel.h18
-rw-r--r--source/modules/asura-core/Threads/ThreadEx.cpp (renamed from source/modules/asura-core/threading/thread_ex.cpp)6
-rw-r--r--source/modules/asura-core/Threads/ThreadEx.h (renamed from source/modules/asura-core/threading/thread_ex.h)10
-rw-r--r--source/modules/asura-core/Time/Timer.cpp0
-rw-r--r--source/modules/asura-core/Time/Timer.h0
-rw-r--r--source/modules/asura-core/Type.h11
-rw-r--r--source/modules/asura-core/Window/Window.cpp104
-rw-r--r--source/modules/asura-core/Window/Window.h138
-rw-r--r--source/modules/asura-core/Window/WindowImplGlew.cpp0
-rw-r--r--source/modules/asura-core/Window/WindowImplGlew.h0
-rw-r--r--source/modules/asura-core/Window/WindowImplGlut.h0
-rw-r--r--source/modules/asura-core/Window/WindowImplSDL.cpp (renamed from source/modules/asura-core/window/window_impl_sdl.cpp)6
-rw-r--r--source/modules/asura-core/Window/WindowImplSDL.h (renamed from source/modules/asura-core/window/window_impl_sdl.h)8
-rw-r--r--source/modules/asura-core/Window/WinodwImplGlut.cpp0
-rw-r--r--source/modules/asura-core/Window/binding/_window.cpp179
-rw-r--r--source/modules/asura-core/application.h14
-rw-r--r--source/modules/asura-core/core_module.h28
-rw-r--r--source/modules/asura-core/font/string.hpp6
-rw-r--r--source/modules/asura-core/font/ttf.h4
-rw-r--r--source/modules/asura-core/font/utf.hpp6
-rw-r--r--source/modules/asura-core/graphics/binding/_canvas.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_color.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_color32.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_gfx_device.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_gpu_buffer.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_index_buffer.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_sprite_batch.cpp2
-rw-r--r--source/modules/asura-core/graphics/binding/_vertex_buffer.cpp2
-rw-r--r--source/modules/asura-core/graphics/blend_mode.h17
-rw-r--r--source/modules/asura-core/graphics/canvas.h24
-rw-r--r--source/modules/asura-core/graphics/color.cpp4
-rw-r--r--source/modules/asura-core/graphics/color.h10
-rw-r--r--source/modules/asura-core/graphics/color32.cpp4
-rw-r--r--source/modules/asura-core/graphics/color32.h10
-rw-r--r--source/modules/asura-core/graphics/image.cpp10
-rw-r--r--source/modules/asura-core/graphics/image.h28
-rw-r--r--source/modules/asura-core/graphics/mesh2d.h16
-rw-r--r--source/modules/asura-core/graphics/shader.cpp6
-rw-r--r--source/modules/asura-core/graphics/shader.h34
-rw-r--r--source/modules/asura-core/graphics/texture.cpp2
-rw-r--r--source/modules/asura-core/graphics/texture.h14
-rw-r--r--source/modules/asura-core/image/binding/_image_data.cpp6
-rw-r--r--source/modules/asura-core/image/binding/_image_decode_task.cpp15
-rw-r--r--source/modules/asura-core/input/button.h2
-rw-r--r--source/modules/asura-core/threading/channel.h18
-rw-r--r--source/modules/asura-core/type.h4
-rw-r--r--source/modules/asura-core/window/binding/_window.cpp4
-rw-r--r--source/modules/asura-core/window/window.cpp8
-rw-r--r--source/modules/asura-core/window/window.h16
147 files changed, 5298 insertions, 348 deletions
diff --git a/source/modules/asura-core/Application.cpp b/source/modules/asura-core/Application.cpp
new file mode 100644
index 0000000..2f20e45
--- /dev/null
+++ b/source/modules/asura-core/Application.cpp
@@ -0,0 +1,23 @@
+#include "Application.h"
+
+using namespace Luax;
+
+namespace AsuraEngine
+{
+
+Application::Application()
+{
+
+}
+
+Application::~Application()
+{
+
+}
+
+bool Application::InitSubModules(uint flag)
+{
+ return false;
+}
+
+} \ No newline at end of file
diff --git a/source/modules/asura-core/Application.h b/source/modules/asura-core/Application.h
new file mode 100644
index 0000000..ea5faa7
--- /dev/null
+++ b/source/modules/asura-core/Application.h
@@ -0,0 +1,81 @@
+#ifndef _ASURA_ENGINE_APPLICATION_H_
+#define _ASURA_ENGINE_APPLICATION_H_
+
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Module.h>
+#include <asura-utils/Classes.h>
+#include <queue>
+
+#include "CoreConfig.h"
+
+namespace_begin(AsuraEngine)
+
+/// ģ
+enum SubModules
+{
+ ASURA_MODULE_NONE = 0X00000000U,
+
+ ASURA_MODULE_GRAPHICS = 1 << 1,
+ ASURA_MODULE_AUDIO = 1 << 2,
+ ASURA_MODULE_FONT = 1 << 3,
+ ASURA_MODULE_INPUT = 1 << 4,
+ ASURA_MODULE_MATH = 1 << 5,
+ ASURA_MODULE_PHYSICS = 1 << 6,
+ ASURA_MODULE_TIME = 1 << 7,
+ ASURA_MODULE_WINDOW = 1 << 8,
+
+ ASURA_MODULE_ALL = 0XFFFFFFFFU
+};
+
+///
+/// ѭ
+///
+class Application
+{
+public:
+
+ Application();
+
+ virtual ~Application();
+
+ ///
+ /// ʼǰϵͳ
+ ///
+ bool InitSubModules(uint flag = ASURA_MODULE_ALL);
+
+ ///
+ ///
+ ///
+ virtual void Run(int argc, char* args[]);
+
+ ///
+ /// ˳runʱĴ
+ ///
+ virtual void OnExit();
+
+protected:
+
+ ///
+ /// moduleapplicationӵmoduleȨ
+ ///
+ void EnqueueModule(Module* module);
+
+private:
+
+ ///
+ /// ̵߳lua state handleӦѭСһ˵ֻҪ߳һlua_State̲߳Ҫ̼߳
+ /// lua̫ʹˡC++дȻעһصһ̴߳lua_Stateעắִк󷢻
+ /// ̵߳lua_Stateֻ֤һnativeʵ֮һlua_State󶨡
+ ///
+ Luax::LuaxVM* m_VM;
+
+ ///
+ /// Asura libsᰴն˳ʼ˳ʱִ˳
+ ///
+ std::queue<Module*> m_Modules;
+
+};
+
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/core_config.h b/source/modules/asura-core/CoreConfig.h
index 8a0e8c7..2dd0b03 100644
--- a/source/modules/asura-core/core_config.h
+++ b/source/modules/asura-core/CoreConfig.h
@@ -1,5 +1,5 @@
-#ifndef __ASURA_CORE_CONFIG_H__
-#define __ASURA_CORE_CONFIG_H__
+#ifndef _ASURA_CORE_CONFIG_H_
+#define _ASURA_CORE_CONFIG_H_
#define ASURA_WINDOW_SDL 1
diff --git a/source/modules/asura-core/core_module.cpp b/source/modules/asura-core/CoreModule.cpp
index e91dd8f..93f8ca0 100644
--- a/source/modules/asura-core/core_module.cpp
+++ b/source/modules/asura-core/CoreModule.cpp
@@ -1,4 +1,4 @@
-#include "core_module.h"
+#include "CoreModule.h"
using namespace AEThreading;
using namespace AEGraphics;
@@ -13,7 +13,7 @@ namespace AsuraEngine
LUAX_REGISTER_FACTORY(state, AEGraphics::Image);
// Wnd
LUAX_REGISTER_SINGLETON(state, AEWindow::Window);
- // Threading
+ // Threads
//LUAX_REGISTER_FACTORY(state, ThreadEx);
}
diff --git a/source/modules/asura-core/CoreModule.h b/source/modules/asura-core/CoreModule.h
new file mode 100644
index 0000000..1781885
--- /dev/null
+++ b/source/modules/asura-core/CoreModule.h
@@ -0,0 +1,26 @@
+#ifndef _ASURA_CORE_MODULE_H_
+#define _ASURA_CORE_MODULE_H_
+
+#include <asura-utils/Module.h>
+#include <asura-utils/Classes.h>
+
+#include "graphics/image.h"
+#include "graphics/texture.h"
+#include "window/window.h"
+#include "Threads/ThreadEx.h"
+
+namespace_begin(AsuraEngine)
+
+class CoreModule : public Module
+{
+public:
+
+ void Initialize(Luax::LuaxState& state) override;
+
+ void Finalize(Luax::LuaxState& state) override;
+
+};
+
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/color_palette.h b/source/modules/asura-core/Font/Glyph.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/color_palette.h
+++ b/source/modules/asura-core/Font/Glyph.cpp
diff --git a/source/modules/asura-core/graphics/render_target.cpp b/source/modules/asura-core/Font/Glyph.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/render_target.cpp
+++ b/source/modules/asura-core/Font/Glyph.h
diff --git a/source/modules/asura-core/Font/String.cpp b/source/modules/asura-core/Font/String.cpp
new file mode 100644
index 0000000..1731338
--- /dev/null
+++ b/source/modules/asura-core/Font/String.cpp
@@ -0,0 +1,376 @@
+//#include "String.hpp"
+//#include "Utf.hpp"
+//
+//namespace AsuraEngine
+//{
+// namespace Text
+// {
+//
+//
+// ////////////////////////////////////////////////////////////
+// const std::size_t String::InvalidPos = std::basic_string<uint32>::npos;
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String()
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(char ansiChar, const std::locale& locale)
+// {
+// m_String += Utf32::DecodeAnsi(ansiChar, locale);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(wchar_t wideChar)
+// {
+// m_String += Utf32::DecodeWide(wideChar);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(uint32 utf32Char)
+// {
+// m_String += utf32Char;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const char* ansiString, const std::locale& locale)
+// {
+// if (ansiString)
+// {
+// std::size_t length = strlen(ansiString);
+// if (length > 0)
+// {
+// m_String.reserve(length + 1);
+// Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(m_String), locale);
+// }
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::string& ansiString, const std::locale& locale)
+// {
+// m_String.reserve(ansiString.length() + 1);
+// Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(m_String), locale);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const wchar_t* wideString)
+// {
+// if (wideString)
+// {
+// std::size_t length = std::wcslen(wideString);
+// if (length > 0)
+// {
+// m_String.reserve(length + 1);
+// Utf32::FromWide(wideString, wideString + length, std::back_inserter(m_String));
+// }
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::wstring& wideString)
+// {
+// m_String.reserve(wideString.length() + 1);
+// Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(m_String));
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const uint32* utf32String)
+// {
+// if (utf32String)
+// m_String = utf32String;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::basic_string<uint32>& utf32String) :
+// m_String(utf32String)
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const String& copy) :
+// m_String(copy.mString)
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::operator std::string() const
+// {
+// return ToAnsiString();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::operator std::wstring() const
+// {
+// return ToWideString();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::string String::ToAnsiString(const std::locale& locale) const
+// {
+// // Prepare the output string
+// std::string output;
+// output.reserve(m_String.length() + 1);
+//
+// // Convert
+// Utf32::ToAnsi(m_String.begin(), m_String.end(), std::back_inserter(output), 0, locale);
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::wstring String::ToWideString() const
+// {
+// // Prepare the output string
+// std::wstring output;
+// output.reserve(m_String.length() + 1);
+//
+// // Convert
+// Utf32::ToWide(m_String.begin(), m_String.end(), std::back_inserter(output), 0);
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint8> String::ToUtf8() const
+// {
+// // Prepare the output string
+// std::basic_string<uint8> output;
+// output.reserve(m_String.length());
+//
+// // Convert
+// Utf32::ToUtf8(m_String.begin(), m_String.end(), std::back_inserter(output));
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint16> String::ToUtf16() const
+// {
+// // Prepare the output string
+// std::basic_string<uint16> output;
+// output.reserve(m_String.length());
+//
+// // Convert
+// Utf32::ToUtf16(m_String.begin(), m_String.end(), std::back_inserter(output));
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint32> String::ToUtf32() const
+// {
+// return m_String;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String& String::operator =(const String& right)
+// {
+// m_String = right.mString;
+// return *this;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String& String::operator +=(const String& right)
+// {
+// m_String += right.mString;
+// return *this;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// uint32 String::operator [](std::size_t index) const
+// {
+// return m_String[index];
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// uint32& String::operator [](std::size_t index)
+// {
+// return m_String[index];
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Clear()
+// {
+// m_String.clear();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::size_t String::GetSize() const
+// {
+// return m_String.size();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool String::IsEmpty() const
+// {
+// return m_String.empty();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Erase(std::size_t position, std::size_t count)
+// {
+// m_String.erase(position, count);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Insert(std::size_t position, const String& str)
+// {
+// m_String.insert(position, str.mString);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::size_t String::Find(const String& str, std::size_t start) const
+// {
+// return m_String.find(str.mString, start);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Replace(std::size_t position, std::size_t length, const String& replaceWith)
+// {
+// m_String.replace(position, length, replaceWith.mString);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Replace(const String& searchFor, const String& replaceWith)
+// {
+// std::size_t step = replaceWith.GetSize();
+// std::size_t len = searchFor.GetSize();
+// std::size_t pos = Find(searchFor);
+//
+// // Replace each occurrence of search
+// while (pos != InvalidPos)
+// {
+// Replace(pos, len, replaceWith);
+// pos = Find(searchFor, pos + step);
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String String::Substring(std::size_t position, std::size_t length) const
+// {
+// return m_String.substr(position, length);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// const uint32* String::GetData() const
+// {
+// return m_String.c_str();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::Iterator String::Begin()
+// {
+// return m_String.begin();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::ConstIterator String::Begin() const
+// {
+// return m_String.begin();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::Iterator String::End()
+// {
+// return m_String.end();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::ConstIterator String::End() const
+// {
+// return m_String.end();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator ==(const String& left, const String& right)
+// {
+// return left.mString == right.mString;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator !=(const String& left, const String& right)
+// {
+// return !(left == right);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator <(const String& left, const String& right)
+// {
+// return left.mString < right.mString;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator >(const String& left, const String& right)
+// {
+// return right < left;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator <=(const String& left, const String& right)
+// {
+// return !(right < left);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator >=(const String& left, const String& right)
+// {
+// return !(left < right);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String operator +(const String& left, const String& right)
+// {
+// String string = left;
+// string += right;
+//
+// return string;
+// }
+//
+//
+// }
+//}
diff --git a/source/modules/asura-core/Font/String.hpp b/source/modules/asura-core/Font/String.hpp
new file mode 100644
index 0000000..13a8b2d
--- /dev/null
+++ b/source/modules/asura-core/Font/String.hpp
@@ -0,0 +1,595 @@
+//#ifndef _ASURA_ENGINE_STRING_H_
+//#define _ASURA_ENGINE_STRING_H_
+//
+//#include <asura-utils/type.h>
+//
+//#include <iterator>
+//#include <locale>
+//#include <string>
+//
+//namespace AsuraEngine
+//{
+// namespace Text
+// {
+//
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Utility string class that automatically handles
+// /// conversions between types and encodings
+// ///
+// ////////////////////////////////////////////////////////////
+// class String
+// {
+// public:
+//
+// ////////////////////////////////////////////////////////////
+// // Types
+// ////////////////////////////////////////////////////////////
+// typedef std::basic_string<uint32>::iterator Iterator; ///< Iterator type
+// typedef std::basic_string<uint32>::const_iterator ConstIterator; ///< Read-only iterator type
+//
+// ////////////////////////////////////////////////////////////
+// // Static member data
+// ////////////////////////////////////////////////////////////
+// static const std::size_t InvalidPos; ///< Represents an invalid position in the string
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Default constructor
+// ///
+// /// This constructor creates an empty string.
+// ///
+// ////////////////////////////////////////////////////////////
+// String();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a single ANSI character and a locale
+// ///
+// /// The source character is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiChar ANSI character to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(char ansiChar, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from single wide character
+// ///
+// /// \param wideChar Wide character to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(wchar_t wideChar);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from single UTF-32 character
+// ///
+// /// \param utf32Char UTF-32 character to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(uint utf32Char);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a null-terminated C-style ANSI string and a locale
+// ///
+// /// The source string is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiString ANSI string to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const char* ansiString, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from an ANSI string and a locale
+// ///
+// /// The source string is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiString ANSI string to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::string& ansiString, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from null-terminated C-style wide string
+// ///
+// /// \param wideString Wide string to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const wchar_t* wideString);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a wide string
+// ///
+// /// \param wideString Wide string to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::wstring& wideString);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a null-terminated C-style UTF-32 string
+// ///
+// /// \param utf32String UTF-32 string to assign
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const uint* utf32String);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from an UTF-32 string
+// ///
+// /// \param utf32String UTF-32 string to assign
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::basic_string<uint>& utf32String);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Copy constructor
+// ///
+// /// \param copy Instance to copy
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const String& copy);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-8 encoded string
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-8 sequence
+// /// \param end Forward iterator to the end of the UTF-8 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf16, fromUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf8(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-16 encoded string
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-16 sequence
+// /// \param end Forward iterator to the end of the UTF-16 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf8, fromUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf16(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-32 encoded string
+// ///
+// /// This function is provided for consistency, it is equivalent to
+// /// using the constructors that takes a const sf::uint* or
+// /// a std::basic_string<sf::uint>.
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-32 sequence
+// /// \param end Forward iterator to the end of the UTF-32 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf8, fromUtf16
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf32(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Implicit conversion operator to std::string (ANSI string)
+// ///
+// /// The current global locale is used for conversion. If you
+// /// want to explicitly specify a locale, see toAnsiString.
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// /// This operator is defined for convenience, and is equivalent
+// /// to calling toAnsiString().
+// ///
+// /// \return Converted ANSI string
+// ///
+// /// \see toAnsiString, operator std::wstring
+// ///
+// ////////////////////////////////////////////////////////////
+// operator std::string() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Implicit conversion operator to std::wstring (wide string)
+// ///
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// /// This operator is defined for convenience, and is equivalent
+// /// to calling toWideString().
+// ///
+// /// \return Converted wide string
+// ///
+// /// \see toWideString, operator std::string
+// ///
+// ////////////////////////////////////////////////////////////
+// operator std::wstring() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to an ANSI string
+// ///
+// /// The UTF-32 string is converted to an ANSI string in
+// /// the encoding defined by \a locale.
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// ///
+// /// \param locale Locale to use for conversion
+// ///
+// /// \return Converted ANSI string
+// ///
+// /// \see toWideString, operator std::string
+// ///
+// ////////////////////////////////////////////////////////////
+// std::string ToAnsiString(const std::locale& locale = std::locale()) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a wide string
+// ///
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// ///
+// /// \return Converted wide string
+// ///
+// /// \see toAnsiString, operator std::wstring
+// ///
+// ////////////////////////////////////////////////////////////
+// std::wstring ToWideString() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-8 string
+// ///
+// /// \return Converted UTF-8 string
+// ///
+// /// \see toUtf16, toUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint8> ToUtf8() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-16 string
+// ///
+// /// \return Converted UTF-16 string
+// ///
+// /// \see toUtf8, toUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint16> ToUtf16() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-32 string
+// ///
+// /// This function doesn't perform any conversion, since the
+// /// string is already stored as UTF-32 internally.
+// ///
+// /// \return Converted UTF-32 string
+// ///
+// /// \see toUtf8, toUtf16
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint> ToUtf32() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of assignment operator
+// ///
+// /// \param right Instance to assign
+// ///
+// /// \return Reference to self
+// ///
+// ////////////////////////////////////////////////////////////
+// String& operator =(const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of += operator to append an UTF-32 string
+// ///
+// /// \param right String to append
+// ///
+// /// \return Reference to self
+// ///
+// ////////////////////////////////////////////////////////////
+// String& operator +=(const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of [] operator to access a character by its position
+// ///
+// /// This function provides read-only access to characters.
+// /// Note: the behavior is undefined if \a index is out of range.
+// ///
+// /// \param index Index of the character to get
+// ///
+// /// \return Character at position \a index
+// ///
+// ////////////////////////////////////////////////////////////
+// uint operator [](std::size_t index) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of [] operator to access a character by its position
+// ///
+// /// This function provides read and write access to characters.
+// /// Note: the behavior is undefined if \a index is out of range.
+// ///
+// /// \param index Index of the character to get
+// ///
+// /// \return Reference to the character at position \a index
+// ///
+// ////////////////////////////////////////////////////////////
+// uint& operator [](std::size_t index);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Clear the string
+// ///
+// /// This function removes all the characters from the string.
+// ///
+// /// \see isEmpty, erase
+// ///
+// ////////////////////////////////////////////////////////////
+// void Clear();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Get the size of the string
+// ///
+// /// \return Number of characters in the string
+// ///
+// /// \see isEmpty
+// ///
+// ////////////////////////////////////////////////////////////
+// std::size_t GetSize() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Check whether the string is empty or not
+// ///
+// /// \return True if the string is empty (i.e. contains no character)
+// ///
+// /// \see clear, getSize
+// ///
+// ////////////////////////////////////////////////////////////
+// bool IsEmpty() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Erase one or more characters from the string
+// ///
+// /// This function removes a sequence of \a count characters
+// /// starting from \a position.
+// ///
+// /// \param position Position of the first character to erase
+// /// \param count Number of characters to erase
+// ///
+// ////////////////////////////////////////////////////////////
+// void Erase(std::size_t position, std::size_t count = 1);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Insert one or more characters into the string
+// ///
+// /// This function inserts the characters of \a str
+// /// into the string, starting from \a position.
+// ///
+// /// \param position Position of insertion
+// /// \param str Characters to insert
+// ///
+// ////////////////////////////////////////////////////////////
+// void Insert(std::size_t position, const String& str);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Find a sequence of one or more characters in the string
+// ///
+// /// This function searches for the characters of \a str
+// /// in the string, starting from \a start.
+// ///
+// /// \param str Characters to find
+// /// \param start Where to begin searching
+// ///
+// /// \return Position of \a str in the string, or String::InvalidPos if not found
+// ///
+// ////////////////////////////////////////////////////////////
+// std::size_t Find(const String& str, std::size_t start = 0) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Replace a substring with another string
+// ///
+// /// This function replaces the substring that starts at index \a position
+// /// and spans \a length characters with the string \a replaceWith.
+// ///
+// /// \param position Index of the first character to be replaced
+// /// \param length Number of characters to replace. You can pass InvalidPos to
+// /// replace all characters until the end of the string.
+// /// \param replaceWith String that replaces the given substring.
+// ///
+// ////////////////////////////////////////////////////////////
+// void Replace(std::size_t position, std::size_t length, const String& replaceWith);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Replace all occurrences of a substring with a replacement string
+// ///
+// /// This function replaces all occurrences of \a searchFor in this string
+// /// with the string \a replaceWith.
+// ///
+// /// \param searchFor The value being searched for
+// /// \param replaceWith The value that replaces found \a searchFor values
+// ///
+// ////////////////////////////////////////////////////////////
+// void Replace(const String& searchFor, const String& replaceWith);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return a part of the string
+// ///
+// /// This function returns the substring that starts at index \a position
+// /// and spans \a length characters.
+// ///
+// /// \param position Index of the first character
+// /// \param length Number of characters to include in the substring (if
+// /// the string is shorter, as many characters as possible
+// /// are included). \ref InvalidPos can be used to include all
+// /// characters until the end of the string.
+// ///
+// /// \return String object containing a substring of this object
+// ///
+// ////////////////////////////////////////////////////////////
+// String Substring(std::size_t position, std::size_t length = InvalidPos) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Get a pointer to the C-style array of characters
+// ///
+// /// This functions provides a read-only access to a
+// /// null-terminated C-style representation of the string.
+// /// The returned pointer is temporary and is meant only for
+// /// immediate use, thus it is not recommended to store it.
+// ///
+// /// \return Read-only pointer to the array of characters
+// ///
+// ////////////////////////////////////////////////////////////
+// const uint* GetData() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the beginning of the string
+// ///
+// /// \return Read-write iterator to the beginning of the string characters
+// ///
+// /// \see end
+// ///
+// ////////////////////////////////////////////////////////////
+// Iterator Begin();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the beginning of the string
+// ///
+// /// \return Read-only iterator to the beginning of the string characters
+// ///
+// /// \see end
+// ///
+// ////////////////////////////////////////////////////////////
+// ConstIterator Begin() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the end of the string
+// ///
+// /// The end iterator refers to 1 position past the last character;
+// /// thus it represents an invalid character and should never be
+// /// accessed.
+// ///
+// /// \return Read-write iterator to the end of the string characters
+// ///
+// /// \see begin
+// ///
+// ////////////////////////////////////////////////////////////
+// Iterator End();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the end of the string
+// ///
+// /// The end iterator refers to 1 position past the last character;
+// /// thus it represents an invalid character and should never be
+// /// accessed.
+// ///
+// /// \return Read-only iterator to the end of the string characters
+// ///
+// /// \see begin
+// ///
+// ////////////////////////////////////////////////////////////
+// ConstIterator End() const;
+//
+// private:
+//
+// friend bool operator ==(const String& left, const String& right);
+// friend bool operator <(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// // Member data
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint> m_String; ///< Internal string of UTF-32 characters
+// };
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of == operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if both strings are equal
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator ==(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of != operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if both strings are different
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator !=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of < operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically before \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator <(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of > operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically after \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator >(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of <= operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically before or equivalent to \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator <=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of >= operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically after or equivalent to \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator >=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of binary + operator to concatenate two strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return Concatenated string
+// ///
+// ////////////////////////////////////////////////////////////
+// String operator +(const String& left, const String& right);
+//
+// #include "String.inc"
+//
+// }
+//}
+//
+//#endif \ No newline at end of file
diff --git a/source/modules/asura-core/font/string.inl b/source/modules/asura-core/Font/String.inc
index ef18228..ef18228 100644
--- a/source/modules/asura-core/font/string.inl
+++ b/source/modules/asura-core/Font/String.inc
diff --git a/source/modules/asura-core/graphics/sprite_batch.cpp b/source/modules/asura-core/Font/TTF.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/sprite_batch.cpp
+++ b/source/modules/asura-core/Font/TTF.cpp
diff --git a/source/modules/asura-core/Font/TTF.h b/source/modules/asura-core/Font/TTF.h
new file mode 100644
index 0000000..b83cf76
--- /dev/null
+++ b/source/modules/asura-core/Font/TTF.h
@@ -0,0 +1,17 @@
+#ifndef _ASURA_TTF_H_
+#define _ASURA_TTF_H_
+
+namespace AsuraEngine
+{
+ namespace Text
+ {
+
+ class TTF
+ {
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Font/Utf.hpp b/source/modules/asura-core/Font/Utf.hpp
new file mode 100644
index 0000000..59f62ed
--- /dev/null
+++ b/source/modules/asura-core/Font/Utf.hpp
@@ -0,0 +1,720 @@
+#ifndef _ASURA_UTF_HPP_
+#define _ASURA_UTF_HPP_
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <algorithm>
+#include <locale>
+#include <string>
+#include <cstdlib>
+
+namespace AsuraEngine
+{
+ namespace Text
+ {
+
+ template <unsigned int N>
+ class Utf;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Specialization of the Utf template for UTF-8
+ ///
+ ////////////////////////////////////////////////////////////
+ template <>
+ class Utf<8>
+ {
+ public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Decode a single UTF-8 character
+ ///
+ /// Decoding a character means finding its unique 32-bits
+ /// code (called the codepoint) in the Unicode standard.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Codepoint of the decoded UTF-8 character
+ /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Encode a single UTF-8 character
+ ///
+ /// Encoding a character means converting a unique 32-bits
+ /// code (called the codepoint) in the target encoding, UTF-8.
+ ///
+ /// \param input Codepoint to encode as UTF-8
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to UTF-8 (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename Out>
+ static Out Encode(Uint32 input, Out output, Uint8 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Advance to the next UTF-8 character
+ ///
+ /// This function is necessary for multi-elements encodings, as
+ /// a single character may use more than 1 storage element.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Next(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Count the number of characters of a UTF-8 sequence
+ ///
+ /// This function is necessary for multi-elements encodings, as
+ /// a single character may use more than 1 storage element, thus the
+ /// total size can be different from (begin - end).
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static std::size_t Count(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an ANSI characters range to UTF-8
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a wide characters range to UTF-8
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromWide(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-8
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromLatin1(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-8 characters range to ANSI characters
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them)
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-8 characters range to wide characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-8 characters range to UTF-8
+ ///
+ /// This functions does nothing more than a direct copy;
+ /// it is defined only to provide the same interface as other
+ /// specializations of the sf::Utf<> template, and allow
+ /// generic code to be written on top of it.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf8(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-8 characters range to UTF-16
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf16(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-8 characters range to UTF-32
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf32(In begin, In end, Out output);
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Specialization of the Utf template for UTF-16
+ ///
+ ////////////////////////////////////////////////////////////
+ template <>
+ class Utf<16>
+ {
+ public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Decode a single UTF-16 character
+ ///
+ /// Decoding a character means finding its unique 32-bits
+ /// code (called the codepoint) in the Unicode standard.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Codepoint of the decoded UTF-16 character
+ /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Encode a single UTF-16 character
+ ///
+ /// Encoding a character means converting a unique 32-bits
+ /// code (called the codepoint) in the target encoding, UTF-16.
+ ///
+ /// \param input Codepoint to encode as UTF-16
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to UTF-16 (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename Out>
+ static Out Encode(Uint32 input, Out output, Uint16 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Advance to the next UTF-16 character
+ ///
+ /// This function is necessary for multi-elements encodings, as
+ /// a single character may use more than 1 storage element.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Next(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Count the number of characters of a UTF-16 sequence
+ ///
+ /// This function is necessary for multi-elements encodings, as
+ /// a single character may use more than 1 storage element, thus the
+ /// total size can be different from (begin - end).
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static std::size_t Count(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an ANSI characters range to UTF-16
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a wide characters range to UTF-16
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromWide(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-16
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromLatin1(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-16 characters range to ANSI characters
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them)
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-16 characters range to wide characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-16 characters range to UTF-8
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf8(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-16 characters range to UTF-16
+ ///
+ /// This functions does nothing more than a direct copy;
+ /// it is defined only to provide the same interface as other
+ /// specializations of the sf::Utf<> template, and allow
+ /// generic code to be written on top of it.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf16(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-16 characters range to UTF-32
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf32(In begin, In end, Out output);
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Specialization of the Utf template for UTF-32
+ ///
+ ////////////////////////////////////////////////////////////
+ template <>
+ class Utf<32>
+ {
+ public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Decode a single UTF-32 character
+ ///
+ /// Decoding a character means finding its unique 32-bits
+ /// code (called the codepoint) in the Unicode standard.
+ /// For UTF-32, the character value is the same as the codepoint.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Codepoint of the decoded UTF-32 character
+ /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Encode a single UTF-32 character
+ ///
+ /// Encoding a character means converting a unique 32-bits
+ /// code (called the codepoint) in the target encoding, UTF-32.
+ /// For UTF-32, the codepoint is the same as the character value.
+ ///
+ /// \param input Codepoint to encode as UTF-32
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to UTF-32 (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename Out>
+ static Out Encode(Uint32 input, Out output, Uint32 replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Advance to the next UTF-32 character
+ ///
+ /// This function is trivial for UTF-32, which can store
+ /// every character in a single storage element.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static In Next(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Count the number of characters of a UTF-32 sequence
+ ///
+ /// This function is trivial for UTF-32, which can store
+ /// every character in a single storage element.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ ///
+ /// \return Iterator pointing to one past the last read element of the input sequence
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static std::size_t Count(In begin, In end);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an ANSI characters range to UTF-32
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a wide characters range to UTF-32
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromWide(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-32
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out FromLatin1(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-32 characters range to ANSI characters
+ ///
+ /// The current global locale will be used by default, unless you
+ /// pass a custom one in the \a locale parameter.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them)
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-32 characters range to wide characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-32 characters range to UTF-8
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf8(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-32 characters range to UTF-16
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf16(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Convert a UTF-32 characters range to UTF-32
+ ///
+ /// This functions does nothing more than a direct copy;
+ /// it is defined only to provide the same interface as other
+ /// specializations of the sf::Utf<> template, and allow
+ /// generic code to be written on top of it.
+ ///
+ /// \param begin Iterator pointing to the beginning of the input sequence
+ /// \param end Iterator pointing to the end of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In, typename Out>
+ static Out ToUtf32(In begin, In end, Out output);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Decode a single ANSI character to UTF-32
+ ///
+ /// This function does not exist in other specializations
+ /// of sf::Utf<>, it is defined for convenience (it is used by
+ /// several other conversion functions).
+ ///
+ /// \param input Input ANSI character
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Converted character
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static Uint32 DecodeAnsi(In input, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Decode a single wide character to UTF-32
+ ///
+ /// This function does not exist in other specializations
+ /// of sf::Utf<>, it is defined for convenience (it is used by
+ /// several other conversion functions).
+ ///
+ /// \param input Input wide character
+ ///
+ /// \return Converted character
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename In>
+ static Uint32 DecodeWide(In input);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Encode a single UTF-32 character to ANSI
+ ///
+ /// This function does not exist in other specializations
+ /// of sf::Utf<>, it is defined for convenience (it is used by
+ /// several other conversion functions).
+ ///
+ /// \param codepoint Iterator pointing to the beginning of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement if the input character is not convertible to ANSI (use 0 to skip it)
+ /// \param locale Locale to use for conversion
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename Out>
+ static Out EncodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Encode a single UTF-32 character to wide
+ ///
+ /// This function does not exist in other specializations
+ /// of sf::Utf<>, it is defined for convenience (it is used by
+ /// several other conversion functions).
+ ///
+ /// \param codepoint Iterator pointing to the beginning of the input sequence
+ /// \param output Iterator pointing to the beginning of the output sequence
+ /// \param replacement Replacement if the input character is not convertible to wide (use 0 to skip it)
+ ///
+ /// \return Iterator to the end of the output sequence which has been written
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename Out>
+ static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
+ };
+
+#include "Utf.inc"
+
+ // Make typedefs to get rid of the template syntax
+ typedef Utf<8> Utf8;
+ typedef Utf<16> Utf16;
+ typedef Utf<32> Utf32;
+
+ } // namespace sf
+
+}
+
+
+#endif // SFML_UTF_HPP
diff --git a/source/modules/asura-core/font/utf.inl b/source/modules/asura-core/Font/Utf.inc
index 69a523b..69a523b 100644
--- a/source/modules/asura-core/font/utf.inl
+++ b/source/modules/asura-core/Font/Utf.inc
diff --git a/source/modules/asura-core/Graphics/BlendMode.h b/source/modules/asura-core/Graphics/BlendMode.h
new file mode 100644
index 0000000..7a31eed
--- /dev/null
+++ b/source/modules/asura-core/Graphics/BlendMode.h
@@ -0,0 +1,17 @@
+#ifndef _ASURA_ENGINE_BLEND_MODE_H_
+#define _ASURA_ENGINE_BLEND_MODE_H_
+
+#include <asura-utils/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+enum BlendMode
+{
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Canvas.cpp b/source/modules/asura-core/Graphics/Canvas.cpp
new file mode 100644
index 0000000..60c8f87
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Canvas.cpp
@@ -0,0 +1,49 @@
+#include "Canvas.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+Canvas::Canvas()
+ : m_Width(0)
+ , m_Height(0)
+ , m_FBO(0)
+{
+ // Fix: ôСʼʱframebufferԴ
+ //glGenFramebuffers(1, &m_FBO);
+ //GLint current_fbo;
+ //glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);
+ //glBindFramebuffer(GL_FRAMEBUFFER, m_FBO);
+ //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TexID, 0);
+ //glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
+}
+
+void Canvas::SetSize(uint w, uint h)
+{
+ if (m_FBO == 0)
+ {
+ glGenFramebuffers(1, &m_FBO);
+ if (m_FBO == 0)
+ throw Exception("OpenGL glGenFramebuffers cannot generate frame buffer object.");
+ //
+ if (m_TexID == 0)
+ {
+ glGenTextures(1, &m_TexID);
+ if (m_TexID == 0)
+ throw Exception("OpenGL glGenTextures cannot generate texture.");
+ }
+ GLint current_fbo;
+ glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, m_FBO);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TexID, 0);
+ glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
+ }
+ GLint current_tex;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_tex);
+ glBindTexture(GL_TEXTURE_2D, m_TexID);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glBindTexture(GL_TEXTURE_2D, current_tex);
+}
+
+namespace_end
+
+namespace_end \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Canvas.h b/source/modules/asura-core/Graphics/Canvas.h
new file mode 100644
index 0000000..0ec55bc
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Canvas.h
@@ -0,0 +1,73 @@
+#ifndef _ASURA_ENGINE_CANVAS_H_
+#define _ASURA_ENGINE_CANVAS_H_
+
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "GfxDevice.h"
+#include "Texture.h"
+#include "RenderTarget.h"
+#include "RenderState.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+///
+/// CanvasҲԳΪrender textureҲΪtextureȾ
+///
+class Canvas ASURA_FINAL
+ : public Scripting::Portable<Canvas, RenderTarget>
+{
+public:
+
+ Canvas();
+
+ ~Canvas();
+
+ ///
+ /// render textureĴС
+ ///
+ void SetSize(uint w, uint h) ASURA_THROW(Exception);
+
+ void Clear(const Color& col = Color::Black) override;
+/*
+ void Clear(const Math::Recti& quad, const Color& col = Color::Black) override;
+*/
+ void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot);
+
+ void Render(const RenderTarget* rt, const Math::Rectf& quad, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot);
+
+ void Draw(const Drawable* texture, const RenderState& state);
+
+ void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state);
+
+private:
+
+ GLuint m_FBO;
+
+ GLuint m_TexID;
+
+ uint m_Width, m_Height;
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Canvas, RenderTarget);
+
+ LUAX_DECL_METHOD(_SetSize);
+ LUAX_DECL_METHOD(_Bind);
+ LUAX_DECL_METHOD(_Unbind);
+
+};
+
+///
+/// CanvasΪRenderTexture
+///
+typedef Canvas RenderTexture;
+
+} // Graphics
+} // AsuraEngine
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Color.cpp b/source/modules/asura-core/Graphics/Color.cpp
new file mode 100644
index 0000000..5a66291
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Color.cpp
@@ -0,0 +1,58 @@
+#include "Color.h"
+#include "Color32.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+Color::Color()
+{
+ r = g = b = a = 0;
+}
+
+Color::Color(const Color& c)
+{
+ r = c.r;
+ g = c.g;
+ b = c.b;
+ a = c.a;
+}
+
+Color::Color(float r, float g, float b, float a)
+{
+ this->r = r;
+ this->g = g;
+ this->b = b;
+ this->a = a;
+}
+
+Color::Color(const Color32& c)
+{
+ r = c.r / 255.f;
+ g = c.g / 255.f;
+ b = c.b / 255.f;
+ a = c.a / 255.f;
+}
+
+Color::~Color()
+{
+}
+
+void Color::Set(float r, float g, float b, float a)
+{
+ this->r = r;
+ this->g = g;
+ this->b = b;
+ this->a = a;
+}
+
+//Color Color::operator *(const Color& c)
+//{
+// r *= c.r;
+// g *= c.g;
+// b *= c.b;
+// a *= c.a;
+
+//}
+
+namespace_end
+namespace_end
diff --git a/source/modules/asura-core/Graphics/Color.h b/source/modules/asura-core/Graphics/Color.h
new file mode 100644
index 0000000..a16f17d
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Color.h
@@ -0,0 +1,75 @@
+#ifndef _ASURA_ENGINE_COLOR_H_
+#define _ASURA_ENGINE_COLOR_H_
+
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Classes.h>
+
+#include "../CoreConfig.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+class Color32;
+
+///
+/// 淶ɫColor32иIJԡ
+///
+class Color ASURA_FINAL
+ : public Scripting::Portable<Color>
+{
+public:
+
+ static Color Black;
+ static Color White;
+ static Color Red;
+ static Color Green;
+ static Color Blue;
+
+ Color();
+
+ Color(const Color& c);
+
+ Color(float r, float g, float b, float a);
+
+ Color(const Color32& c);
+
+ ~Color();
+
+ Color operator *(const Color& c);
+
+ void Set(float r, float g, float b, float a);
+
+ GET_SET(float, Red, r);
+ GET_SET(float, Green, g);
+ GET_SET(float, Blue, b);
+ GET_SET(float, Alpha, a);
+
+ float r, g, b, a;
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Color);
+
+ LUAX_DECL_METHOD(_ToColor32);
+ LUAX_DECL_METHOD(_SetColor);
+ LUAX_DECL_METHOD(_GetColor);
+ LUAX_DECL_METHOD(_GetR);
+ LUAX_DECL_METHOD(_GetG);
+ LUAX_DECL_METHOD(_GetB);
+ LUAX_DECL_METHOD(_GetA);
+
+ // Ԫ
+ LUAX_DECL_METHOD(___eq); // __eq
+ LUAX_DECL_METHOD(___add); // __add
+ LUAX_DECL_METHOD(___sub); // __sub
+ LUAX_DECL_METHOD(___mul); // __mul
+ LUAX_DECL_METHOD(___div); // __div
+
+};
+
+namespace_end
+namespace_end
+
+namespace AEGraphics = AsuraEngine::Graphics;
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Color32.cpp b/source/modules/asura-core/Graphics/Color32.cpp
new file mode 100644
index 0000000..f1f0b74
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Color32.cpp
@@ -0,0 +1,53 @@
+#include "Color.h"
+#include "Color32.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(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;
+}
+
+Color32::Color32(const Color32& c)
+{
+ r = c.r;
+ g = c.g;
+ b = c.b;
+ a = c.a;
+}
+
+Color32::Color32(const Color& c)
+{
+ r = 255.f * c.r;
+ g = 255.f * c.g;
+ b = 255.f * c.b;
+ a = 255.f * c.a;
+}
+
+Color32::Color32(byte r, byte g, byte b, byte a)
+{
+ this->r = r;
+ this->g = g;
+ this->b = b;
+ this->a = a;
+}
+
+void Color32::Set(const Color32& c32)
+{
+ r = c32.r;
+ g = c32.g;
+ b = c32.b;
+ a = c32.a;
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Color32.h b/source/modules/asura-core/Graphics/Color32.h
new file mode 100644
index 0000000..aa445fe
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Color32.h
@@ -0,0 +1,58 @@
+#ifndef _ASURA_ENGINE_COLOR32_H__
+#define _ASURA_ENGINE_COLOR32_H__
+
+#include <asura-utils/Classes.h>
+#include <asura-utils/Scripting/Portable.hpp>
+
+#include "../CoreConfig.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+class Color;
+
+///
+/// 32bitsɫ
+///
+class Color32 ASURA_FINAL
+ : public Scripting::Portable<Color32>
+{
+public:
+
+ static const uint32 RMASK;
+ static const uint32 GMASK;
+ static const uint32 BMASK;
+ static const uint32 AMASK;
+
+ Color32();
+
+ ~Color32();
+
+ Color32(const Color32& c);
+
+ Color32(const Color& c);
+
+ Color32(byte r, byte g, byte b, byte a);
+
+ void Set(const Color32& c32);
+
+ byte r, g, b, a;
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Color32);
+
+ LUAX_DECL_METHOD(_ToColor);
+ LUAX_DECL_METHOD(_SetColor);
+ LUAX_DECL_METHOD(_GetColor);
+ LUAX_DECL_METHOD(_GetRed);
+ LUAX_DECL_METHOD(_GetGreen);
+ LUAX_DECL_METHOD(_GetBlue);
+ LUAX_DECL_METHOD(_GetAlpha);
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/input_device.cpp b/source/modules/asura-core/Graphics/ColorPalette.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/input_device.cpp
+++ b/source/modules/asura-core/Graphics/ColorPalette.h
diff --git a/source/modules/asura-core/Graphics/DrawInfo.cpp b/source/modules/asura-core/Graphics/DrawInfo.cpp
new file mode 100644
index 0000000..c7a6912
--- /dev/null
+++ b/source/modules/asura-core/Graphics/DrawInfo.cpp
@@ -0,0 +1,10 @@
+#include "DrawInfo.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+
+
+namespace_end
+namespace_end
diff --git a/source/modules/asura-core/Graphics/DrawInfo.h b/source/modules/asura-core/Graphics/DrawInfo.h
new file mode 100644
index 0000000..f0e375b
--- /dev/null
+++ b/source/modules/asura-core/Graphics/DrawInfo.h
@@ -0,0 +1,18 @@
+#ifndef _ASURA_ENGINE_DRAWINFO_H_
+#define _ASURA_ENGINE_DRAWINFO_H_
+
+#include <asura-utils/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+struct DrawInfo
+{
+
+};
+
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/gpu_buffer.cpp b/source/modules/asura-core/Graphics/GPUBuffer.cpp
index 4271b70..f28b914 100644
--- a/source/modules/asura-core/graphics/gpu_buffer.cpp
+++ b/source/modules/asura-core/Graphics/GPUBuffer.cpp
@@ -1,4 +1,4 @@
-#include "gpu_buffer.h"
+#include "GPUBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/gpu_buffer.h b/source/modules/asura-core/Graphics/GPUBuffer.h
index 3153904..bb40055 100644
--- a/source/modules/asura-core/graphics/gpu_buffer.h
+++ b/source/modules/asura-core/Graphics/GPUBuffer.h
@@ -1,11 +1,11 @@
-#ifndef __ASURA_GPU_BUFFER_H__
-#define __ASURA_GPU_BUFFER_H__
+#ifndef _ASURA_GPU_BUFFER_H_
+#define _ASURA_GPU_BUFFER_H_
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Exceptions/Exception.h>
#include <asura-utils/type.h>
-#include "gfx_device.h"
+#include "GfxDevice.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/gfx_device.cpp b/source/modules/asura-core/Graphics/GfxDevice.cpp
index 2751a9d..ef324e3 100644
--- a/source/modules/asura-core/graphics/gfx_device.cpp
+++ b/source/modules/asura-core/Graphics/GfxDevice.cpp
@@ -1,11 +1,11 @@
#include <asura-utils/type.h>
-#include "../core_config.h"
+#include "../CoreConfig.h"
-#include "gfx_device.h"
-#include "shader.h"
-#include "matrix_stack.h"
-#include "color.h"
+#include "GfxDevice.h"
+#include "Shader.h"
+#include "MatrixStack.h"
+#include "Color.h"
using namespace AEMath;
diff --git a/source/modules/asura-core/graphics/gfx_device.h b/source/modules/asura-core/Graphics/GfxDevice.h
index fa22dd4..1f50b57 100644
--- a/source/modules/asura-core/graphics/gfx_device.h
+++ b/source/modules/asura-core/Graphics/GfxDevice.h
@@ -1,17 +1,17 @@
-#ifndef __ASURA_ENGINE_GFX_DEVICE_H__
-#define __ASURA_ENGINE_GFX_DEVICE_H__
+#ifndef _ASURA_ENGINE_GFX_DEVICE_H_
+#define _ASURA_ENGINE_GFX_DEVICE_H_
#include <stack>
#include <glad/glad.h>
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/math/rect.hpp>
-#include <asura-utils/math/matrix44.h>
-#include <asura-utils/math/vector4.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Math/matrix44.h>
+#include <asura-utils/Math/vector4.h>
-#include "color.h"
-#include "matrix_stack.h"
+#include "Color.h"
+#include "MatrixStack.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
@@ -42,47 +42,47 @@ public:
static GfxDevice& Get();
- int GetParam(GLParams param);
+ int GetParam(GLParams param);
- bool Init(const AEMath::Recti& viewport);
- bool Inited();
+ bool Init(const AEMath::Recti& viewport);
+ bool Inited();
- void SetViewport(const AEMath::Recti viewport);
+ void SetViewport(const AEMath::Recti viewport);
const AEMath::Recti& GetViewport();
- void SetMatrixMode(MatrixMode mode);
+ void SetMatrixMode(MatrixMode mode);
MatrixMode GetMatrixMode();
- void PushMatrix();
- void PopMatrix();
+ void PushMatrix();
+ void PopMatrix();
- void LoadIdentity();
- void Rotate(float angle);
- void Translate(float x, float y);
- void Scale(float x, float y);
- void Ortho(float l, float r, float b, float t, float n, float f);
+ void LoadIdentity();
+ void Rotate(float angle);
+ void Translate(float x, float y);
+ void Scale(float x, float y);
+ void Ortho(float l, float r, float b, float t, float n, float f);
- uint GetMatrixDepth();
- uint GetMatrixIndex();
+ uint GetMatrixDepth();
+ uint GetMatrixIndex();
AEMath::Matrix44& GetMatrix(MatrixMode mode);
AEMath::Matrix44 GetMVPMatrix();
- void SetDrawColor(float r, float g, float b, float a);
- Color& GetDrawColor();
+ void SetDrawColor(float r, float g, float b, float a);
+ Color& GetDrawColor();
- void SetActiveCanvas(Canvas* = NULL);
- Canvas* GetActiveCanvas() const;
+ void SetActiveCanvas(Canvas* = NULL);
+ Canvas* GetActiveCanvas() const;
- void SetActiveShader(Shader* = NULL);
- Shader* GetActiveShader() const;
+ void SetActiveShader(Shader* = NULL);
+ Shader* GetActiveShader() const;
- void DrawArrays(GLenum mode, GLint first, GLsizei count);
+ void DrawArrays(GLenum mode, GLint first, GLsizei count);
- void WipeError();
- bool HasError();
- GLenum GetError();
+ void WipeError();
+ bool HasError();
+ GLenum GetError();
private:
diff --git a/source/modules/asura-core/Graphics/Image.cpp b/source/modules/asura-core/Graphics/Image.cpp
new file mode 100644
index 0000000..d2b2ec9
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Image.cpp
@@ -0,0 +1,103 @@
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "../CoreConfig.h"
+
+#include "Shader.h"
+#include "Image.h"
+#include "GfxDevice.h"
+
+using namespace AEIO;
+using namespace AEImage;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+Image::Image()
+ : m_Width(0)
+ , m_Height(0)
+{
+}
+
+Image::~Image()
+{
+}
+
+bool Image::Load(ImageData* imgData)
+{
+ if (!imgData) return false;
+
+ if (m_TexID == 0)
+ {
+ glGenTextures(1, &m_TexID);
+ if (m_TexID == 0)
+ throw Exception("OpenGL glGenTextures failed.");
+ }
+
+ glBindTexture(GL_TEXTURE_2D, m_TexID);
+ imgData->Lock();
+ int width = imgData->width;
+ int height = imgData->height;
+ TextureFormat tf = ConvertColorFormat(imgData->format);
+ glTexImage2D(
+ GL_TEXTURE_2D
+ , 0
+ , tf.internalformat
+ , width, height
+ , 0
+ , tf.externalformat
+ , tf.type
+ , imgData->pixels
+ );
+
+ m_Width = imgData->width;
+ m_Height = imgData->height;
+ imgData->Unlock();
+ GLenum err = glGetError();
+ if (err != GL_NO_ERROR)
+ throw Exception("OpenGL glTexImage2D cause error, error code=%d", err);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ return true;
+}
+
+bool Image::Load(ImageData* imgData, const AEMath::Vector2i& pos)
+{
+ if (!imgData) return false;
+
+ glBindTexture(GL_TEXTURE_2D, m_TexID);
+ imgData->Lock();
+ int width = imgData->width;
+ int height = imgData->height;
+ TextureFormat tf = ConvertColorFormat(imgData->format);
+ glTexSubImage2D(
+ GL_TEXTURE_2D
+ , 0
+ , pos.x
+ , pos.y
+ , imgData->width
+ , imgData->height
+ , tf.externalformat
+ , tf.type
+ , imgData->pixels
+ );
+ imgData->Unlock();
+ GLenum err = glGetError();
+ if (err != GL_NO_ERROR)
+ throw Exception("OpenGL glTexSubImage2D cause error, error code=%d", err);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ return true;
+}
+
+uint32 Image::GetWidth()
+{
+ return m_Width;
+}
+
+uint32 Image::GetHeight()
+{
+ return m_Height;
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Image.h b/source/modules/asura-core/Graphics/Image.h
new file mode 100644
index 0000000..5cbfe23
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Image.h
@@ -0,0 +1,63 @@
+#ifndef _ASURA_ENGINE_IMAGE_H_
+#define _ASURA_ENGINE_IMAGE_H_
+
+// asura modules
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/IO/Renewable.h>
+#include <asura-utils/Stringmap.hpp>
+#include <asura-utils/Manager.hpp>
+
+// module
+#include "../Image/ImageData.h"
+
+// folder
+#include "Color.h"
+#include "Color32.h"
+#include "RenderState.h"
+#include "GPUBuffer.h"
+#include "Texture.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+class Image ASURA_FINAL : public AEScripting::Portable<Image, Texture>
+{
+public:
+
+ Image();
+ ~Image();
+
+ bool Load(AEImage::ImageData* decodeData);
+ bool Load(AEImage::ImageData* decodeData, const AEMath::Vector2i& pos);
+
+ uint GetWidth();
+ uint GetHeight();
+
+ GPUBuffer* GenGPUBuffer();
+
+private:
+
+ uint32 m_Width, m_Height;
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Image, Texture);
+
+ LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_Load);
+ LUAX_DECL_METHOD(_GetWidth);
+ LUAX_DECL_METHOD(_GetHeight);
+ LUAX_DECL_METHOD(_GetSize);
+ LUAX_DECL_METHOD(_GetPixel);
+ LUAX_DECL_METHOD(_Render);
+
+};
+
+namespace_end
+namespace_end
+
+namespace AEGraphics = AsuraEngine::Graphics;
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/index_buffer.cpp b/source/modules/asura-core/Graphics/IndexBuffer.cpp
index 9d7416f..bb3eea7 100644
--- a/source/modules/asura-core/graphics/index_buffer.cpp
+++ b/source/modules/asura-core/Graphics/IndexBuffer.cpp
@@ -1,4 +1,4 @@
-#include "index_buffer.h"
+#include "IndexBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/index_buffer.h b/source/modules/asura-core/Graphics/IndexBuffer.h
index 538b43b..73a6f9b 100644
--- a/source/modules/asura-core/graphics/index_buffer.h
+++ b/source/modules/asura-core/Graphics/IndexBuffer.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_INDEX_BUFFER_H__
-#define __ASURA_INDEX_BUFFER_H__
+#ifndef _ASURA_INDEX_BUFFER_H_
+#define _ASURA_INDEX_BUFFER_H_
-#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
-#include "gpu_buffer.h"
+#include "GPUBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/matrix_stack.cpp b/source/modules/asura-core/Graphics/MatrixStack.cpp
index eaa686f..987d29c 100644
--- a/source/modules/asura-core/graphics/matrix_stack.cpp
+++ b/source/modules/asura-core/Graphics/MatrixStack.cpp
@@ -1,4 +1,4 @@
-#include "matrix_stack.h"
+#include "MatrixStack.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/matrix_stack.h b/source/modules/asura-core/Graphics/MatrixStack.h
index ad32bb4..867011e 100644
--- a/source/modules/asura-core/graphics/matrix_stack.h
+++ b/source/modules/asura-core/Graphics/MatrixStack.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_MATRIX_STACK_H__
-#define __ASURA_MATRIX_STACK_H__
+#ifndef _ASURA_MATRIX_STACK_H_
+#define _ASURA_MATRIX_STACK_H_
-#include <asura-utils/type.h>
-#include <asura-utils/math/matrix44.h>
-#include <asura-utils/classes.h>
+#include <asura-utils/Type.h>
+#include <asura-utils/Math/Matrix44.h>
+#include <asura-utils/Classes.h>
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/input/input_manager.cpp b/source/modules/asura-core/Graphics/Mesh2D.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/input_manager.cpp
+++ b/source/modules/asura-core/Graphics/Mesh2D.cpp
diff --git a/source/modules/asura-core/Graphics/Mesh2D.h b/source/modules/asura-core/Graphics/Mesh2D.h
new file mode 100644
index 0000000..1546765
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Mesh2D.h
@@ -0,0 +1,52 @@
+#ifndef _ASURA_ENGINE_MESH2D_H__
+#define _ASURA_ENGINE_MESH2D_H__
+
+// cpp
+#include <vector>
+
+// asura modules
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+
+// module
+#include "../Mesh/Mesh2dData.h"
+
+// folder
+#include "Color.h"
+#include "VertexBuffer.h"
+#include "IndexBuffer.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+///
+/// 2D meshһЩ㶯
+/// https://en.wikipedia.org/wiki/Polygon_mesh
+///
+class Mesh2D ASURA_FINAL
+ : public Scripting::Portable<Mesh2D>
+{
+public:
+
+ Mesh2D();
+ ~Mesh2D();
+
+ bool Load(AEMesh::Mesh2DData* data);
+
+private:
+
+ VertexBuffer* m_VBO; ///< vertex buffer
+ IndexBuffer* m_IBO; ///< index buffer
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Mesh2D);
+
+ LUAX_DECL_METHOD(_SetVertex);
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/joystick_state.h b/source/modules/asura-core/Graphics/Quad.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/joystick_state.h
+++ b/source/modules/asura-core/Graphics/Quad.cpp
diff --git a/source/modules/asura-core/Graphics/Quad.h b/source/modules/asura-core/Graphics/Quad.h
new file mode 100644
index 0000000..b7dd3d9
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Quad.h
@@ -0,0 +1 @@
+// Quadrectڣrectǵıƫᣬquadһ
diff --git a/source/modules/asura-core/graphics/render_state.h b/source/modules/asura-core/Graphics/RenderState.h
index 9f138c0..5dcf12d 100644
--- a/source/modules/asura-core/graphics/render_state.h
+++ b/source/modules/asura-core/Graphics/RenderState.h
@@ -1,10 +1,10 @@
-#ifndef __ASURA_ENGINE_RENDER_STATE_H__
-#define __ASURA_ENGINE_RENDER_STATE_H__
+#ifndef _ASURA_ENGINE_RENDER_STATE_H_
+#define _ASURA_ENGINE_RENDER_STATE_H_
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/math/transform.h>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/Transform.h>
-#include "blend_mode.h"
+#include "BlendMode.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/input/mouse_state.h b/source/modules/asura-core/Graphics/RenderTarget.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/input/mouse_state.h
+++ b/source/modules/asura-core/Graphics/RenderTarget.cpp
diff --git a/source/modules/asura-core/graphics/render_target.h b/source/modules/asura-core/Graphics/RenderTarget.h
index a52e7b0..bcd7276 100644
--- a/source/modules/asura-core/graphics/render_target.h
+++ b/source/modules/asura-core/Graphics/RenderTarget.h
@@ -1,12 +1,12 @@
-#ifndef __ASURA_ENGINE_RENDERTARGET_H__
-#define __ASURA_ENGINE_RENDERTARGET_H__
+#ifndef _ASURA_ENGINE_RENDERTARGET_H_
+#define _ASURA_ENGINE_RENDERTARGET_H_
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/math/rect.hpp>
-#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
-#include "texture.h"
-#include "color.h"
+#include "Texture.h"
+#include "Color.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/Graphics/Shader.cpp b/source/modules/asura-core/Graphics/Shader.cpp
new file mode 100644
index 0000000..30e0161
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Shader.cpp
@@ -0,0 +1,282 @@
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "GfxDevice.h"
+#include "Shader.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+// texture unit
+static uint8 texUnit = 0;
+
+Shader::Shader()
+{
+}
+
+Shader::~Shader()
+{
+ if(m_VertShader) glDeleteShader(m_VertShader);
+ if(m_FragShader) glDeleteShader(m_FragShader);
+ if(m_Program) glDeleteProgram(m_Program);
+}
+
+void Shader::SetActive(Shader* shader)
+{
+ g_Device.SetActiveShader(shader);
+}
+
+Shader* Shader::GetActive()
+{
+ return g_Device.GetActiveShader();
+}
+
+bool Shader::Load(const string& vert, const string& frag)
+{
+ string warnning = "";
+
+ if (!m_Program)
+ {
+ m_Program = glCreateProgram();
+ if (!m_Program)
+ throw Exception("Cannot create OpenGL shader program.");
+ }
+
+ if (!CompileVertexShader(vert, warnning))
+ {
+ throw Exception("Compile vertex shader failed:%s", warnning);
+ }
+
+ if (!CompileFragementShader(frag, warnning))
+ {
+ throw Exception("Compile fragment shader failed:%s", warnning);
+ }
+
+ glAttachShader(m_Program, m_VertShader);
+ glAttachShader(m_Program, m_FragShader);
+
+ glLinkProgram(m_Program);
+ GLint success;
+ glGetProgramiv(m_Program, GL_LINK_STATUS, &success);
+ if (success == GL_FALSE)
+ {
+ warnning = GetProgramWarnings();
+ throw Exception("Link shader program failed:\n%s", warnning.c_str());
+ }
+
+ return true;
+}
+
+bool Shader::CompileVertexShader(const string& vert, string& outError)
+{
+ if (!m_VertShader)
+ {
+ m_VertShader = glCreateShader(GL_VERTEX_SHADER);
+ if (!m_VertShader)
+ {
+ outError = "Cannot create OpenGL Vertex shader.";
+ return false;
+ }
+ }
+
+ const GLchar* source = vert.c_str();
+ GLint success;
+
+ glShaderSource(m_VertShader, 1, &source, NULL);
+ glCompileShader(m_VertShader);
+ glGetShaderiv(m_VertShader, GL_COMPILE_STATUS, &success);
+ if (success == GL_FALSE)
+ {
+ outError = GetShaderWarnings(m_VertShader);
+ return false;
+ }
+
+ return true;
+}
+
+bool Shader::CompileFragementShader(const string& frag, string& outError)
+{
+ if (!m_FragShader)
+ {
+ m_FragShader = glCreateShader(GL_FRAGMENT_SHADER);
+ if (!m_FragShader)
+ {
+ outError = "Cannot create OpenGL fragment shader.";
+ return false;
+ }
+ }
+
+ const GLchar* source = frag.c_str();
+ GLint success;
+
+ source = frag.c_str();
+ glShaderSource(m_FragShader, 1, &source, NULL);
+ glCompileShader(m_FragShader);
+ glGetShaderiv(m_FragShader, GL_COMPILE_STATUS, &success);
+ if (success == GL_FALSE)
+ {
+ outError = GetShaderWarnings(m_FragShader);
+ return false;
+ }
+
+ return true;
+}
+
+void Shader::OnEnable()
+{
+ texUnit = 0;
+}
+
+void Shader::OnDisable()
+{
+ texUnit = 0;
+}
+
+void Shader::OnUsed()
+{
+ texUnit = 0;
+}
+
+uint Shader::GetUniformLocation(const std::string& uniform)
+{
+ GLint loc = glGetUniformLocation(m_Program, uniform.c_str());
+ return loc;
+}
+
+bool Shader::HasUniform(const std::string& uniform)
+{
+ GLint loc = glGetUniformLocation(m_Program, uniform.c_str());
+ return loc != -1;
+}
+
+GLuint Shader::GetGLProgram()
+{
+ return m_Program;
+}
+
+void Shader::SetUniformFloat(uint loc, float value)
+{
+ if(g_Device.GetActiveShader() == this)
+ glUniform1f(loc, value);
+}
+
+bool Shader::SetUniformTexture(uint loc, const Texture& texture)
+{
+ if (g_Device.GetActiveShader() != this)
+ return false;
+
+ g_Device.WipeError();
+ glActiveTexture(GL_TEXTURE0 + texUnit);
+ if (g_Device.HasError())
+ return false;
+ GLint tex = texture.GetGLTexture();
+ glBindTexture(GL_TEXTURE_2D, tex);
+ if (g_Device.HasError())
+ return false;
+ glUniform1i(loc, texUnit);
+ if (g_Device.HasError())
+ return false;
+ ++texUnit;
+}
+
+void Shader::SetUniformVector2(uint loc, const Math::Vector2f& vec2)
+{
+ if (g_Device.GetActiveShader() == this)
+ glUniform2f(loc, vec2.x, vec2.y);
+}
+
+void Shader::SetUniformVector3(uint loc, const Math::Vector3f& vec3)
+{
+ if (g_Device.GetActiveShader() == this)
+ glUniform3f(loc, vec3.x, vec3.y, vec3.z);
+}
+
+void Shader::SetUniformVector4(uint loc, const Math::Vector4f& vec4)
+{
+ if (g_Device.GetActiveShader() == this)
+ glUniform4f(loc, vec4.x, vec4.y, vec4.z, vec4.w);
+}
+
+void Shader::SetUniformMatrix44(uint loc, const Math::Matrix44& mat)
+{
+ if (g_Device.GetActiveShader() == this)
+ glUniformMatrix4fv(loc, 1, GL_FALSE, mat.GetElements());
+}
+
+void Shader::SetUniformColor(uint loc, const Color& color)
+{
+ if (g_Device.GetActiveShader() == this)
+ glUniform4f(loc, color.r, color.g, color.b, color.a);
+}
+
+uint Shader::GetGLTextureUnitCount()
+{
+ GLint maxTextureUnits;
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
+ return (uint)maxTextureUnits;
+}
+
+std::string Shader::GetProgramWarnings()
+{
+ GLint strsize, nullpos;
+ glGetProgramiv(m_Program, GL_INFO_LOG_LENGTH, &strsize);
+
+ if (strsize == 0)
+ return "";
+
+ char *tempstr = new char[strsize];
+
+ memset(tempstr, '\0', strsize);
+ glGetProgramInfoLog(m_Program, strsize, &nullpos, tempstr);
+ tempstr[nullpos] = '\0';
+
+ std::string warnings(tempstr);
+ delete[] tempstr;
+
+ return warnings;
+}
+
+std::string Shader::GetShaderWarnings(GLuint shader)
+{
+ GLint strsize, nullpos;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &strsize);
+
+ if (strsize == 0)
+ return "";
+
+ char *tempstr = new char[strsize];
+
+ memset(tempstr, '\0', strsize);
+ glGetShaderInfoLog(shader, strsize, &nullpos, tempstr);
+ tempstr[nullpos] = '\0';
+
+ std::string warnings(tempstr);
+ delete[] tempstr;
+
+ return warnings;
+}
+
+void Shader::SetAttribute(int loc, VertexBuffer* vbo, uint offseti, uint stridei, bool normalized)
+{
+ GLsizei offset = offseti * vbo->GetDataTypeSize();
+ GLsizei stride = stridei * vbo->GetDataTypeSize();
+ glEnableVertexAttribArray(loc);
+ vbo->Bind();
+ glVertexAttribPointer(loc, 2, vbo->GetDataType(), normalized, stride, (GLvoid*)offset);
+ vbo->UnBind();
+}
+
+int Shader::GetAttributeLocation(const std::string& attribute)
+{
+ int loc = glGetAttribLocation(m_Program, attribute.c_str());
+ return loc;
+}
+
+void Shader::DisableAttribute(int loc)
+{
+ glDisableVertexAttribArray(loc);
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Shader.h b/source/modules/asura-core/Graphics/Shader.h
new file mode 100644
index 0000000..c96b99f
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Shader.h
@@ -0,0 +1,117 @@
+#ifndef _ASURA_ENGINE_SHADER_H_
+#define _ASURA_ENGINE_SHADER_H_
+
+#include <map>
+#include <string>
+
+#include <asura-utils/Exceptions/Exception.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/IO/Renewable.h>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/vector3.hpp>
+#include <asura-utils/Math/vector4.h>
+#include <asura-utils/Math/matrix44.h>
+#include <asura-utils/Stringmap.hpp>
+#include <asura-utils/Manager.hpp>
+
+#include "GfxDevice.h"
+#include "Color.h"
+#include "Texture.h"
+#include "VertexBuffer.h"
+#include "IndexBuffer.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+///
+/// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩ uniformsuseɫ
+/// ķ༭ÿshaderͨshaderҵuniforms¶frameworkmaterial
+/// á
+///
+class Shader ASURA_FINAL
+ : public Scripting::Portable<Shader>
+ , public AEIO::Renewable
+{
+public:
+
+ Shader();
+
+ ~Shader();
+
+ static void SetActive(Shader* shader);
+ static Shader* GetActive();
+
+ bool Load(const std::string& vert, const std::string& frag) ASURA_THROW(Exception);
+
+ // ʹSetActiveлshaderʱ
+ void OnEnable();
+ void OnDisable();
+ // Draw call֮
+ void OnUsed();
+
+ void SetAttribute(int loc, VertexBuffer* vbo, uint offseti = 0, uint stridei = 0, bool normalized = false);
+ int GetAttributeLocation(const std::string& attribute);
+ void DisableAttribute(int loc);
+
+ bool HasUniform(const std::string& uniform);
+ uint GetUniformLocation(const std::string& uniform);
+ void SetUniformFloat(uint loc, float value);
+ void SetUniformVector2(uint loc, const Math::Vector2f& vec2);
+ void SetUniformVector3(uint loc, const Math::Vector3f& vec3);
+ void SetUniformVector4(uint loc, const Math::Vector4f& vec4);
+ void SetUniformColor(uint loc, const Color& color);
+ void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44);
+ bool SetUniformTexture(uint loc, const Texture& texture);
+
+ float GetUniformFloat(uint loc);
+ AEMath::Vector2f GetUniformVector2(uint loc);
+ AEMath::Vector3f GetUniformVector3(uint loc);
+ AEMath::Vector4f GetUniformVector4s(uint loc);
+ AEMath::Matrix44 GetUniformMatrix44(uint loc);
+
+ GLuint GetGLProgram();
+
+ static uint GetGLTextureUnitCount();
+
+private:
+
+ bool CompileVertexShader(const std::string& vert, std::string& outError);
+ bool CompileFragementShader(const std::string& frag, std::string& outError);
+
+ std::string GetProgramWarnings();
+ std::string GetShaderWarnings(GLuint shader);
+
+ GLuint m_Program;
+ GLuint m_VertShader;
+ GLuint m_FragShader;
+
+luaxport:
+
+ LUAX_DECL_FACTORY(Shader);
+
+ LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_Load);
+ LUAX_DECL_METHOD(_Update);
+ LUAX_DECL_METHOD(_HasUniform);
+ LUAX_DECL_METHOD(_GetUniformLocation);
+ LUAX_DECL_METHOD(_SetUniformFloat);
+ LUAX_DECL_METHOD(_SetUniformTexture);
+ LUAX_DECL_METHOD(_SetUniformVector2);
+ LUAX_DECL_METHOD(_SetUniformVector3);
+ LUAX_DECL_METHOD(_SetUniformVector4);
+ LUAX_DECL_METHOD(_SetUniformColor);
+
+ LUAX_DECL_METHOD(_GetAttributeLocation);
+ LUAX_DECL_METHOD(_SetAttribute);
+ LUAX_DECL_METHOD(_DisableAttribute);
+
+ LUAX_DECL_METHOD(_SetBuiltInUniforms);
+
+};
+
+typedef Shader GpuProgram;
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/mesh/mesh2d_data.cpp b/source/modules/asura-core/Graphics/Shape.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/mesh/mesh2d_data.cpp
+++ b/source/modules/asura-core/Graphics/Shape.cpp
diff --git a/source/modules/asura-core/mesh/mesh2d_handler.cpp b/source/modules/asura-core/Graphics/Shape.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/mesh/mesh2d_handler.cpp
+++ b/source/modules/asura-core/Graphics/Shape.h
diff --git a/source/modules/asura-core/mesh/obj_handler.cpp b/source/modules/asura-core/Graphics/SpriteBatch.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/mesh/obj_handler.cpp
+++ b/source/modules/asura-core/Graphics/SpriteBatch.cpp
diff --git a/source/modules/asura-core/graphics/sprite_batch.h b/source/modules/asura-core/Graphics/SpriteBatch.h
index 7f22da0..a98d1f4 100644
--- a/source/modules/asura-core/graphics/sprite_batch.h
+++ b/source/modules/asura-core/Graphics/SpriteBatch.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__
-#define __ASURA_ENGINE_SPRITE_BATCH_H__
+#ifndef _ASURA_ENGINE_SPRITE_BATCH_H_
+#define _ASURA_ENGINE_SPRITE_BATCH_H_
-#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
-#include "gpu_buffer.h"
+#include "GPUBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/Graphics/Texture.cpp b/source/modules/asura-core/Graphics/Texture.cpp
new file mode 100644
index 0000000..bae0f7c
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Texture.cpp
@@ -0,0 +1,47 @@
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "Texture.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+Texture::Texture()
+ : m_TexID(0)
+{
+}
+
+Texture::~Texture()
+{
+ // ͷԴ
+ if(m_TexID != 0)
+ glDeleteTextures(1, &m_TexID);
+}
+
+GLuint Texture::GetGLTexture() const
+{
+ return m_TexID;
+}
+
+TextureFormat Texture::ConvertColorFormat(const ColorFormat& colorformat)
+{
+ TextureFormat t;
+ switch (colorformat)
+ {
+ case COLOR_FORMAT_RGBA8:
+ t.internalformat = GL_RGBA8; // 4*sizeof(byte) ~= 4 bytes
+ t.externalformat = GL_RGBA;
+ t.type = GL_UNSIGNED_BYTE;
+ break;
+ case COLOR_FORMAT_RGBA32F:
+ t.internalformat = GL_RGBA32F; // 4*sizeof(float) = 16 bytes
+ t.externalformat = GL_RGBA;
+ t.type = GL_FLOAT;
+ break;
+ default:
+ ASSERT(false);
+ }
+ return t;
+}
+
+namespace_end
+namespace_end \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/Texture.h b/source/modules/asura-core/Graphics/Texture.h
new file mode 100644
index 0000000..7d37c31
--- /dev/null
+++ b/source/modules/asura-core/Graphics/Texture.h
@@ -0,0 +1,101 @@
+#ifndef _ASURA_TEXTURE_H_
+#define _ASURA_TEXTURE_H_
+
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/Rect.hpp>
+
+#include "../CoreConfig.h"
+
+#include "RenderState.h"
+#include "GfxDevice.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+class RenderTarget;
+
+/// UVʽ
+enum WrapMode
+{
+ WRAP_MODE_REPEAT,
+ WRAP_MODE_MIRROR,
+ WRAP_MODE_CLAMPTOEDGE,
+ 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ҲϽΪԭ㣬Ϊ˷㡣
+///
+ASURA_ABSTRACT class Texture : public AEScripting::Object
+{
+public:
+
+ LUAX_DECL_ABSTRACT_FACTORY(Texture);
+
+ Texture();
+ virtual ~Texture();
+
+ GLuint GetGLTexture() const;
+
+ void SetFilterMode(FilterMode min, FilterMode mag);
+ void SetWrapMode(WrapMode wrapMode);
+
+ void GetFilterMode();
+ void GetWrapMode();
+
+ /// UVfilterΪ
+ bool IsGenMipmap();
+
+protected:
+
+ /// תcolor formatΪtexture format
+ TextureFormat ConvertColorFormat(const ColorFormat& colorformat);
+
+ GLuint m_TexID;
+ FilterMode m_MinFilter;
+ FilterMode m_MagFilter;
+ WrapMode m_WrapMode;
+ bool m_IsGenMipmap;
+
+ 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);
+
+};
+
+typedef Texture Drawable;
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/vertex_buffer.cpp b/source/modules/asura-core/Graphics/VertexBuffer.cpp
index 7fcd3d4..c44e9be 100644
--- a/source/modules/asura-core/graphics/vertex_buffer.cpp
+++ b/source/modules/asura-core/Graphics/VertexBuffer.cpp
@@ -1,4 +1,4 @@
-#include "vertex_buffer.h"
+#include "VertexBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/vertex_buffer.h b/source/modules/asura-core/Graphics/VertexBuffer.h
index f0bfb9e..83e9b09 100644
--- a/source/modules/asura-core/graphics/vertex_buffer.h
+++ b/source/modules/asura-core/Graphics/VertexBuffer.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_VERTEX_BUFFER_H__
-#define __ASURA_VERTEX_BUFFER_H__
+#ifndef _ASURA_VERTEX_BUFFER_H_
+#define _ASURA_VERTEX_BUFFER_H_
-#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
-#include "gpu_buffer.h"
+#include "GPUBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/Graphics/binding/_canvas.cpp b/source/modules/asura-core/Graphics/binding/_canvas.cpp
new file mode 100644
index 0000000..44841f5
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_canvas.cpp
@@ -0,0 +1,48 @@
+#include "../Canvas.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(Canvas)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "SetSize", _SetSize },
+ { "Bind", _Bind },
+ { "Unbind", _Unbind }
+ );
+ }
+
+ LUAX_POSTPROCESS(Canvas)
+ {
+
+ }
+
+ // canvas:SetSize()
+ LUAX_IMPL_METHOD(Canvas, _SetSize)
+ {
+ LUAX_PREPARE(L, Canvas);
+ return 0;
+
+ }
+
+ // canvas:Bind()
+ LUAX_IMPL_METHOD(Canvas, _Bind)
+ {
+ LUAX_PREPARE(L, Canvas);
+
+ return 0;
+ }
+
+ // canvas:Unbind()
+ LUAX_IMPL_METHOD(Canvas, _Unbind)
+ {
+ LUAX_PREPARE(L, Canvas);
+ return 0;
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_color.cpp b/source/modules/asura-core/Graphics/binding/_color.cpp
new file mode 100644
index 0000000..008d9c2
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_color.cpp
@@ -0,0 +1,130 @@
+#include "../Color.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+LUAX_REGISTRY(Color)
+{
+ LUAX_REGISTER_METHODS(state,
+ { "ToColor32", _ToColor32 },
+ { "SetColor", _SetColor },
+ { "GetColor", _GetColor },
+ { "GetR", _GetR },
+ { "GetG", _GetG },
+ { "GetB", _GetB },
+ { "GetA", _GetA },
+ { "__eq", ___eq },
+ { "__add", ___add },
+ { "__sub", ___sub },
+ { "__mul", ___mul },
+ { "__div", ___div }
+ );
+}
+
+LUAX_POSTPROCESS(Color)
+{
+
+}
+
+// color:ToColor32()
+LUAX_IMPL_METHOD(Color, _ToColor32)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:SetColor()
+LUAX_IMPL_METHOD(Color, _SetColor)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:GetColor()
+LUAX_IMPL_METHOD(Color, _GetColor)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:GetR()
+LUAX_IMPL_METHOD(Color, _GetR)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:GetG()
+LUAX_IMPL_METHOD(Color, _GetG)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:GetB()
+LUAX_IMPL_METHOD(Color, _GetB)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:GetA()
+LUAX_IMPL_METHOD(Color, _GetA)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:__eq()
+LUAX_IMPL_METHOD(Color, ___eq)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:__add()
+LUAX_IMPL_METHOD(Color, ___add)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:__sub()
+LUAX_IMPL_METHOD(Color, ___sub)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:__mul()
+LUAX_IMPL_METHOD(Color, ___mul)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+// color:__div()
+LUAX_IMPL_METHOD(Color, ___div)
+{
+ LUAX_PREPARE(L, Color);
+
+ return 0;
+}
+
+}
+} \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/binding/_color32.cpp b/source/modules/asura-core/Graphics/binding/_color32.cpp
new file mode 100644
index 0000000..7613361
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_color32.cpp
@@ -0,0 +1,66 @@
+#include "../Color32.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(Color32)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "ToColor", _ToColor },
+ { "GetRed", _GetRed },
+ { "GetGreen", _GetGreen },
+ { "GetBlue", _GetBlue },
+ { "GetAlpha", _GetAlpha }
+ );
+ }
+
+ LUAX_POSTPROCESS(Color32)
+ {
+
+ }
+
+ // color32:ToColor()
+ LUAX_IMPL_METHOD(Color32, _ToColor)
+ {
+ LUAX_PREPARE(L, Color32);
+ return 0;
+
+ }
+
+ // color32:GetRed()
+ LUAX_IMPL_METHOD(Color32, _GetRed)
+ {
+ LUAX_PREPARE(L, Color32);
+ return 0;
+ }
+
+ // color32:GetGreen()
+ LUAX_IMPL_METHOD(Color32, _GetGreen)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ return 0;
+ }
+
+ // color32:GetBlue()
+ LUAX_IMPL_METHOD(Color32, _GetBlue)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ return 0;
+ }
+
+ // color32:GetAlpha()
+ LUAX_IMPL_METHOD(Color32, _GetAlpha)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ return 0;
+ }
+
+ }
+}
+ \ No newline at end of file
diff --git a/source/modules/asura-core/Graphics/binding/_gfx_device.cpp b/source/modules/asura-core/Graphics/binding/_gfx_device.cpp
new file mode 100644
index 0000000..f6c2004
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_gfx_device.cpp
@@ -0,0 +1,151 @@
+#include "../GfxDevice.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(GfxDevice)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "SetMatrixMode", _SetMatrixMode },
+ { "GetMatrixMode", _GetMatrixMode },
+ { "PushMatrix", _PushMatrix },
+ { "PopMatrix", _PopMatrix },
+ { "LoadIdentity", _LoadIdentity },
+ { "Rotate", _Rotate },
+ { "Translate", _Translate },
+ { "Scale", _Scale },
+ { "Ortho", _Ortho },
+ { "GetMatrixDepth", _GetMatrixDepth },
+ { "GetMatrixIndex", _GetMatrixIndex },
+ { "UseShader", _UseShader },
+ { "UnuseShader", _UnuseShader }
+ );
+ }
+
+ LUAX_POSTPROCESS(GfxDevice)
+ {
+ LUAX_REGISTER_ENUM(state, "EMatrixMode",
+ { "PROJECTION", MATRIX_MODE_PROJECTION },
+ { "0", 0 },
+ { "MODEL", MATRIX_MODE_MODEL },
+ { "1", 1 },
+ { "VIEW", MATRIX_MODE_VIEW },
+ { "2", 2 }
+ );
+ LUAX_REGISTER_ENUM(state, "EGLParams",
+ { "MAX_TEXTURE_UNIT", GL_PARAM_MAX_TEXTURE_UNIT },
+ { "1", 1 }
+ );
+
+ }
+
+ // gfxdevice:SetMatrixMode()
+ LUAX_IMPL_METHOD(GfxDevice, _SetMatrixMode)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:GetMatrixMode()
+ LUAX_IMPL_METHOD(GfxDevice, _GetMatrixMode)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:PushMatrix()
+ LUAX_IMPL_METHOD(GfxDevice, _PushMatrix)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:PopMatrix()
+ LUAX_IMPL_METHOD(GfxDevice, _PopMatrix)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:LoadIdentity()
+ LUAX_IMPL_METHOD(GfxDevice, _LoadIdentity)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:Rotate()
+ LUAX_IMPL_METHOD(GfxDevice, _Rotate)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:Translate()
+ LUAX_IMPL_METHOD(GfxDevice, _Translate)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:Scale()
+ LUAX_IMPL_METHOD(GfxDevice, _Scale)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:Ortho()
+ LUAX_IMPL_METHOD(GfxDevice, _Ortho)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:GetMatrixDepth()
+ LUAX_IMPL_METHOD(GfxDevice, _GetMatrixDepth)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:GetMatrixIndex()
+ LUAX_IMPL_METHOD(GfxDevice, _GetMatrixIndex)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:UseShader()
+ LUAX_IMPL_METHOD(GfxDevice, _UseShader)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ // gfxdevice:UnuseShader()
+ LUAX_IMPL_METHOD(GfxDevice, _UnuseShader)
+ {
+ LUAX_PREPARE(L, GfxDevice);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp b/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp
new file mode 100644
index 0000000..8c39a59
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp
@@ -0,0 +1,118 @@
+#include <stdlib.h>
+
+#include "../image.h"
+#include "../GPUBuffer.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(GPUBuffer)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "Fill", _Fill },
+ { "GetSize", _GetSize },
+ { "GetCount", _GetCount }
+ );
+ }
+
+ LUAX_POSTPROCESS(GPUBuffer)
+ {
+ LUAX_REGISTER_ENUM(state, "EBufferType",
+ { "VERTEX", BUFFER_TYPE_VERTEX },
+ { "INDEX", BUFFER_TYPE_INDEX }
+ );
+ LUAX_REGISTER_ENUM(state, "EBufferUsage",
+ { "STREAM", BUFFER_USAGE_STREAM },
+ { "DYNAMIC", BUFFER_USAGE_DYNAMIC },
+ { "STATIC", BUFFER_USAGE_STATIC }
+ );
+ LUAX_REGISTER_ENUM(state, "EBufferDataType",
+ { "INT", BUFFER_DATA_TYPE_INT },
+ { "FLOAT", BUFFER_DATA_TYPE_FLOAT },
+ { "UNSIGNED_BYTE", BUFFER_DATA_TYPE_UNSIGNED_BYTE }
+ );
+
+ }
+
+ // buffer = GPUBuffer.New(bufferType, bufferUsage, bufferDataType, size)
+ // buffer = GPUBuffer.New(image)
+ // buffer = GPUBuffer.New(mesh2d)
+ // buffer = GPUBuffer.New(canvas)
+ // buffer = GPUBuffer.New(shape)
+ //LUAX_IMPL_METHOD(GPUBuffer, _New)
+ //{
+ // LUAX_STATE(L);
+
+ // return 0;
+ //}
+
+ // gpubuffer:Fill({data_unit_list}, offseti)
+ // data_unit_list ݵtable
+ // offseti : ʼǵĵطڵ(0ʼ
+ LUAX_IMPL_METHOD(GPUBuffer, _Fill)
+ {
+ LUAX_PREPARE(L, GPUBuffer);
+
+ // ʹbufferӦ޸bufferڵһεʱʼsizeСbufferȻ䡣
+ int offset = state.GetValue(3, 0);
+ int count = lua_objlen(L, 2);
+ int size = count * self->GetDataTypeSize();
+ byte* data = (byte*)malloc(size);
+ int unit = self->GetDataTypeSize();
+ int i = 1;
+ lua_rawgeti(L, 2, i);
+ while (!lua_isnil(L, -1))
+ {
+ switch (self->m_DataType)
+ {
+ case GL_INT:
+ {
+ int n = state.CheckValue<int>(-1);
+ memcpy(data + (i - 1)*unit, &n, unit);
+ break;
+ }
+ case GL_FLOAT:
+ {
+ float n = state.CheckValue<float>(-1);
+ memcpy(data + (i - 1)*unit, &n, unit);
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ unsigned char n = state.CheckValue<unsigned char>(-1);
+ memcpy(data + (i - 1)*unit, &n, unit);
+ break;
+ }
+ }
+ state.Pop(1); // value
+ lua_rawgeti(L, 2, ++i);
+ }
+ state.Pop(); // nil
+
+ self->Fill(data, size, offset * unit);
+
+ free(data);
+ return 0;
+ }
+
+ // gpubuffer:GetSize()
+ LUAX_IMPL_METHOD(GPUBuffer, _GetSize)
+ {
+ LUAX_PREPARE(L, GPUBuffer);
+ state.Push(self->m_Size);
+ return 0;
+ }
+
+ LUAX_IMPL_METHOD(GPUBuffer, _GetCount)
+ {
+ LUAX_PREPARE(L, GPUBuffer);
+ state.Push(self->m_Size / self->GetDataTypeSize());
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_image.cpp b/source/modules/asura-core/Graphics/binding/_image.cpp
new file mode 100644
index 0000000..0e4cb16
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_image.cpp
@@ -0,0 +1,71 @@
+#include "../image.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(Image)
+ {
+ LUAX_INHERIT(state, Texture);
+
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "GetWidth", _GetWidth },
+ { "GetHeight", _GetHeight },
+ { "GetSize", _GetSize },
+ { "Render", _Render }
+ );
+ }
+
+ LUAX_POSTPROCESS(Image)
+ {
+ }
+
+ // image = Image.New()
+ LUAX_IMPL_METHOD(Image, _New)
+ {
+ LUAX_STATE(L);
+ Image* img = new Image();
+ img->PushLuaxUserdata(state);
+ return 1;
+ }
+
+ // width = image:GetWidth()
+ LUAX_IMPL_METHOD(Image, _GetWidth)
+ {
+ LUAX_PREPARE(L, Image);
+ state.Push(self->GetWidth());
+ return 1;
+ }
+
+ // height = image:GetHeight()
+ LUAX_IMPL_METHOD(Image, _GetHeight)
+ {
+ LUAX_PREPARE(L, Image);
+ state.Push(self->GetHeight());
+ return 1;
+ }
+
+ // width, height = image:GetSize()
+ LUAX_IMPL_METHOD(Image, _GetSize)
+ {
+ LUAX_PREPARE(L, Image);
+ int width = self->GetWidth();
+ int height = self->GetHeight();
+ state.Push(width);
+ state.Push(height);
+ return 2;
+ }
+
+ // image:Render()
+ LUAX_IMPL_METHOD(Image, _Render)
+ {
+ LUAX_PREPARE(L, Image);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_index_buffer.cpp b/source/modules/asura-core/Graphics/binding/_index_buffer.cpp
new file mode 100644
index 0000000..151dc98
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_index_buffer.cpp
@@ -0,0 +1,31 @@
+#include "../IndexBuffer.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(IndexBuffer)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New }
+ );
+ }
+
+ LUAX_POSTPROCESS(IndexBuffer)
+ {
+
+ }
+
+ // IndexBuffer.New()
+ LUAX_IMPL_METHOD(IndexBuffer, _New)
+ {
+ LUAX_STATE(L);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_mesh2d.cpp b/source/modules/asura-core/Graphics/binding/_mesh2d.cpp
new file mode 100644
index 0000000..4e3f426
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_mesh2d.cpp
@@ -0,0 +1,20 @@
+#include "../mesh2d.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(Mesh2D)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(Mesh2D)
+ {
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_shader.cpp b/source/modules/asura-core/Graphics/binding/_shader.cpp
new file mode 100644
index 0000000..85fd388
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_shader.cpp
@@ -0,0 +1,131 @@
+#include "../shader.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(Shader)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "Load", _Load },
+ { "Update", _Update },
+ { "HasUniform", _HasUniform },
+ { "GetUniformLocation", _GetUniformLocation },
+ { "SetBuiltInUniforms", _SetBuiltInUniforms },
+ { "SetUniformFloat", _SetUniformFloat },
+ { "SetUniformTexture", _SetUniformTexture },
+ { "SetUniformVector2", _SetUniformVector2 },
+ { "SetUniformVector3", _SetUniformVector3 },
+ { "SetUniformVector4", _SetUniformVector4 },
+ { "SetUniformColor", _SetUniformColor },
+ { "SetBuiltInUniforms", _SetBuiltInUniforms }
+ );
+ }
+
+ LUAX_POSTPROCESS(Shader)
+ {
+
+ }
+
+ // Shader.New()
+ LUAX_IMPL_METHOD(Shader, _New)
+ {
+ LUAX_STATE(L);
+
+ return 0;
+ }
+
+ // shader:Load()
+ LUAX_IMPL_METHOD(Shader, _Load)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:Update()
+ LUAX_IMPL_METHOD(Shader, _Update)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:HasUniform()
+ LUAX_IMPL_METHOD(Shader, _HasUniform)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:GetUniformLocation()
+ LUAX_IMPL_METHOD(Shader, _GetUniformLocation)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetBuiltInUniforms()
+ LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformFloat()
+ LUAX_IMPL_METHOD(Shader, _SetUniformFloat)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformTexture()
+ LUAX_IMPL_METHOD(Shader, _SetUniformTexture)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformVector2()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector2)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformVector3()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector3)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformVector4()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector4)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ // shader:SetUniformColor()
+ LUAX_IMPL_METHOD(Shader, _SetUniformColor)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp b/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp
new file mode 100644
index 0000000..6b7d25c
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp
@@ -0,0 +1,20 @@
+#include "../SpriteBatch.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(SpriteBatch)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(SpriteBatch)
+ {
+
+ }
+
+ }
+}
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..f5e5f17
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_texture.cpp
@@ -0,0 +1,85 @@
+#include "../texture.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(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->m_MinFilter);
+ state.Push((int)self->m_MagFilter);
+ return 2;
+ }
+
+ // wrapmode= texture:GetWrapMode()
+ LUAX_IMPL_METHOD(Texture, _GetWrapMode)
+ {
+ LUAX_PREPARE(L, Texture);
+ state.Push((int)self->m_WrapMode);
+ 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/_vertex_buffer.cpp b/source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp
new file mode 100644
index 0000000..8ed487b
--- /dev/null
+++ b/source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp
@@ -0,0 +1,38 @@
+#include "../VertexBuffer.h"
+
+using namespace std;
+using namespace Luax;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Graphics)
+
+
+ LUAX_REGISTRY(VertexBuffer)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New }
+ );
+ }
+
+ LUAX_POSTPROCESS(VertexBuffer)
+ {
+
+ }
+
+ // vbo = VertexBuffer.New(usage, data_type, count)
+ LUAX_IMPL_METHOD(VertexBuffer, _New)
+ {
+ LUAX_STATE(L);
+
+ BufferUsage usage = (BufferUsage)state.CheckValue<uint>(1);
+ BufferDataType datatype = (BufferDataType)state.CheckValue<uint>(2);
+ uint count = state.CheckValue<uint>(3);
+
+ VertexBuffer* vbo = new VertexBuffer(usage, datatype, count * GPUBuffer::GetDataTypeSize(datatype));
+ vbo->PushLuaxUserdata(state);
+
+ return 1;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/image/image_data.cpp b/source/modules/asura-core/Image/ImageData.cpp
index 1de70cd..c75166f 100644
--- a/source/modules/asura-core/image/image_data.cpp
+++ b/source/modules/asura-core/Image/ImageData.cpp
@@ -1,7 +1,7 @@
-#include "image_data.h"
-#include "png_decoder.h"
-#include "stb_decoder.h"
-#include "image_decoder.h"
+#include "ImageData.h"
+#include "PngDecoder.h"
+#include "StbDecoder.h"
+#include "ImageDecoder.h"
using namespace std;
diff --git a/source/modules/asura-core/image/image_data.h b/source/modules/asura-core/Image/ImageData.h
index 93e3448..cd2fe1a 100644
--- a/source/modules/asura-core/image/image_data.h
+++ b/source/modules/asura-core/Image/ImageData.h
@@ -1,16 +1,16 @@
-#ifndef __ASURA_ENGINE_IMAGEDATA_H__
-#define __ASURA_ENGINE_IMAGEDATA_H__
+#ifndef _ASURA_ENGINE_IMAGEDATA_H_
+#define _ASURA_ENGINE_IMAGEDATA_H_
#include <list>
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/io/decoded_data.h>
-#include <asura-utils/io/data_buffer.h>
-#include <asura-utils/threading/thread.h>
-#include <asura-utils/threading/mutex.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/IO/DecodedData.h>
+#include <asura-utils/IO/DataBuffer.h>
+#include <asura-utils/Threads/Thread.h>
+#include <asura-utils/Threads/Mutex.h>
-#include "../graphics/texture.h"
-#include "../graphics/color.h"
+#include "../Graphics/Texture.h"
+#include "../Graphics/Color.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/image_decode_task.cpp b/source/modules/asura-core/Image/ImageDecodeTask.cpp
index 3cadb43..16c166e 100644
--- a/source/modules/asura-core/image/image_decode_task.cpp
+++ b/source/modules/asura-core/Image/ImageDecodeTask.cpp
@@ -1,4 +1,4 @@
-#include "image_decode_task.h"
+#include "ImageDecodeTask.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/image_decode_task.h b/source/modules/asura-core/Image/ImageDecodeTask.h
index 3726514..74ecf24 100644
--- a/source/modules/asura-core/image/image_decode_task.h
+++ b/source/modules/asura-core/Image/ImageDecodeTask.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_IMAGE_DECODE_TASK_H__
-#define __ASURA_IMAGE_DECODE_TASK_H__
+#ifndef _ASURA_IMAGE_DECODE_TASK_H_
+#define _ASURA_IMAGE_DECODE_TASK_H_
-#include <asura-utils/threading/task.h>
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/classes.h>
+#include <asura-utils/Threads/task.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Classes.h>
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/image_decoder.h b/source/modules/asura-core/Image/ImageDecoder.h
index 30e65d3..7de92d6 100644
--- a/source/modules/asura-core/image/image_decoder.h
+++ b/source/modules/asura-core/Image/ImageDecoder.h
@@ -1,9 +1,9 @@
-#ifndef __ASURA_ENGINE_IMAGE_DECODER_H__
-#define __ASURA_ENGINE_IMAGE_DECODER_H__
+#ifndef _ASURA_ENGINE_IMAGE_DECODER_H_
+#define _ASURA_ENGINE_IMAGE_DECODER_H_
-#include <asura-utils/io/data_buffer.h>
+#include <asura-utils/IO/DataBuffer.h>
-#include "image_data.h"
+#include "ImageData.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/png_decoder.cpp b/source/modules/asura-core/Image/PngDecoder.cpp
index bf33959..618c16e 100644
--- a/source/modules/asura-core/image/png_decoder.cpp
+++ b/source/modules/asura-core/Image/PngDecoder.cpp
@@ -1,4 +1,4 @@
-#include "png_decoder.h"
+#include "PngDecoder.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/png_decoder.h b/source/modules/asura-core/Image/PngDecoder.h
index af67186..b6ea3ba 100644
--- a/source/modules/asura-core/image/png_decoder.h
+++ b/source/modules/asura-core/Image/PngDecoder.h
@@ -1,7 +1,7 @@
-#ifndef __ASURA_ENGINE_PNGDECODER_H__
-#define __ASURA_ENGINE_PNGDECODER_H__
+#ifndef _ASURA_ENGINE_PNGDECODER_H_
+#define _ASURA_ENGINE_PNGDECODER_H_
-#include "image_decoder.h"
+#include "ImageDecoder.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/image/stb_decoder.cpp b/source/modules/asura-core/Image/StbDecoder.cpp
index ed61aa4..8d3537c 100644
--- a/source/modules/asura-core/image/stb_decoder.cpp
+++ b/source/modules/asura-core/Image/StbDecoder.cpp
@@ -1,6 +1,6 @@
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
-#include "stb_decoder.h"
+#include "StbDecoder.h"
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>
diff --git a/source/modules/asura-core/image/stb_decoder.h b/source/modules/asura-core/Image/StbDecoder.h
index 6158b21..a86073a 100644
--- a/source/modules/asura-core/image/stb_decoder.h
+++ b/source/modules/asura-core/Image/StbDecoder.h
@@ -1,7 +1,7 @@
-#ifndef __ASURA_ENGINE_STBDECODER_H__
-#define __ASURA_ENGINE_STBDECODER_H__
+#ifndef _ASURA_ENGINE_STBDECODER_H_
+#define _ASURA_ENGINE_STBDECODER_H_
-#include "image_decoder.h"
+#include "ImageDecoder.h"
namespace_begin(AsuraEngine)
namespace_begin(Image)
diff --git a/source/modules/asura-core/Image/binding/_image_data.cpp b/source/modules/asura-core/Image/binding/_image_data.cpp
new file mode 100644
index 0000000..77f3a96
--- /dev/null
+++ b/source/modules/asura-core/Image/binding/_image_data.cpp
@@ -0,0 +1,108 @@
+#include <asura-utils/Threads/Thread.h>
+#include <asura-utils/IO/DataBuffer.h>
+
+#include "../ImageData.h"
+
+using namespace std;
+using namespace AEThreading;
+using namespace AEIO;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Image)
+LUAX_REGISTRY(ImageData)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "GetPixel", _GetPixel },
+ { "GetSize", _GetSize },
+ { "GetWidth", _GetWidth },
+ { "GetHeight", _GetHeight },
+ { "GetPixelFormat", _GetPixelFormat },
+ { "Decode", _Decode },
+ { "DecodeAsync", _DecodeAsync },
+ { "IsAvailable", _IsAvailable }
+ );
+ }
+
+ LUAX_POSTPROCESS(ImageData)
+ {
+
+ }
+
+ // ImageData.New()
+ LUAX_IMPL_METHOD(ImageData, _New)
+ {
+ LUAX_STATE(L);
+
+ return 0;
+ }
+
+ // imagedata:GetPixel()
+ LUAX_IMPL_METHOD(ImageData, _GetPixel)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:GetSize()
+ LUAX_IMPL_METHOD(ImageData, _GetSize)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:GetWidth()
+ LUAX_IMPL_METHOD(ImageData, _GetWidth)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:GetHeight()
+ LUAX_IMPL_METHOD(ImageData, _GetHeight)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:GetPixelFormat()
+ LUAX_IMPL_METHOD(ImageData, _GetPixelFormat)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:Decode()
+ LUAX_IMPL_METHOD(ImageData, _Decode)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ // imagedata:DecodeAsync(thread, databuffer, callback)
+ LUAX_IMPL_METHOD(ImageData, _DecodeAsync)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ Thread* thread = state.CheckUserdata<Thread>(2);
+ DataBuffer* buffer = state.CheckUserdata<DataBuffer>(3);
+
+ return 0;
+ }
+
+ // imagedata:IsAvailable()
+ LUAX_IMPL_METHOD(ImageData, _IsAvailable)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/Image/binding/_image_decode_task.cpp b/source/modules/asura-core/Image/binding/_image_decode_task.cpp
new file mode 100644
index 0000000..3c8ed4b
--- /dev/null
+++ b/source/modules/asura-core/Image/binding/_image_decode_task.cpp
@@ -0,0 +1,19 @@
+#include "../ImageDecodeTask.h"
+
+using namespace std;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Image)
+
+LUAX_REGISTRY(ImageDecodeTask)
+{
+
+}
+
+LUAX_POSTPROCESS(ImageDecodeTask)
+{
+
+}
+
+}
+}
diff --git a/source/modules/asura-core/Input/Button.h b/source/modules/asura-core/Input/Button.h
new file mode 100644
index 0000000..5c3c0de
--- /dev/null
+++ b/source/modules/asura-core/Input/Button.h
@@ -0,0 +1,31 @@
+#ifndef __BUTTON_H__
+#define __BUTTON_H__
+
+#include <asura-utils/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(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;
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/mesh/obj_handler.h b/source/modules/asura-core/Input/ClipBoard.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/mesh/obj_handler.h
+++ b/source/modules/asura-core/Input/ClipBoard.cpp
diff --git a/source/modules/asura-core/profiler/gpu_profiler.cpp b/source/modules/asura-core/Input/ClipBoard.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/profiler/gpu_profiler.cpp
+++ b/source/modules/asura-core/Input/ClipBoard.h
diff --git a/source/modules/asura-core/profiler/gpu_profiler.h b/source/modules/asura-core/Input/InputDevice.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/profiler/gpu_profiler.h
+++ b/source/modules/asura-core/Input/InputDevice.cpp
diff --git a/source/modules/asura-core/input/input_device.h b/source/modules/asura-core/Input/InputDevice.h
index 1c116e6..39f3d37 100644
--- a/source/modules/asura-core/input/input_device.h
+++ b/source/modules/asura-core/Input/InputDevice.h
@@ -1,13 +1,13 @@
-#ifndef __ASURA_ENGINE_INPUT_BASE_H__
-#define __ASURA_ENGINE_INPUT_BASE_H__
+#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 <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Singleton.hpp>
-#include "../core_config.h"
+#include "../CoreConfig.h"
-#include "keyboard_state.h"
+#include "KeyboardState.h"
namespace_begin(AsuraEngine)
namespace_begin(Input)
diff --git a/source/modules/asura-core/threading/channel.cpp b/source/modules/asura-core/Input/InputManager.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/threading/channel.cpp
+++ b/source/modules/asura-core/Input/InputManager.cpp
diff --git a/source/modules/asura-core/input/input_manager.h b/source/modules/asura-core/Input/InputManager.h
index 7e24b4e..dd11b2f 100644
--- a/source/modules/asura-core/input/input_manager.h
+++ b/source/modules/asura-core/Input/InputManager.h
@@ -1,9 +1,9 @@
#ifndef __INPUT_MAMANGER_H__
#define __INPUT_MAMANGER_H__
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/singleton.hpp>
-#include <asura-utils/classes.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Singleton.hpp>
+#include <asura-utils/Classes.h>
namespace_begin(AsuraEngine)
namespace_begin(Input)
diff --git a/source/modules/asura-core/window/window_impl_glew.cpp b/source/modules/asura-core/Input/JoystickState.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glew.cpp
+++ b/source/modules/asura-core/Input/JoystickState.h
diff --git a/source/modules/asura-core/input/keyboard_state.h b/source/modules/asura-core/Input/KeyboardState.h
index 5c43dff..96d22e7 100644
--- a/source/modules/asura-core/input/keyboard_state.h
+++ b/source/modules/asura-core/Input/KeyboardState.h
@@ -3,7 +3,7 @@
#include <vector>
-#include "button.h"
+#include "Button.h"
namespace_begin(AsuraEngine)
namespace_begin(Input)
diff --git a/source/modules/asura-core/Input/Keys.h b/source/modules/asura-core/Input/Keys.h
new file mode 100644
index 0000000..8f04dc2
--- /dev/null
+++ b/source/modules/asura-core/Input/Keys.h
@@ -0,0 +1,482 @@
+
+/**
+* Keyboard keys. They are dependent on the current layout of the keyboard.
+**/
+enum Key
+{
+ KEY_UNKNOWN,
+
+ KEY_RETURN,
+ KEY_ESCAPE,
+ KEY_BACKSPACE,
+ KEY_TAB,
+ KEY_SPACE,
+ KEY_EXCLAIM,
+ KEY_QUOTEDBL,
+ KEY_HASH,
+ KEY_PERCENT,
+ KEY_DOLLAR,
+ KEY_AMPERSAND,
+ KEY_QUOTE,
+ KEY_LEFTPAREN,
+ KEY_RIGHTPAREN,
+ KEY_ASTERISK,
+ KEY_PLUS,
+ KEY_COMMA,
+ KEY_MINUS,
+ KEY_PERIOD,
+ KEY_SLASH,
+ KEY_0,
+ KEY_1,
+ KEY_2,
+ KEY_3,
+ KEY_4,
+ KEY_5,
+ KEY_6,
+ KEY_7,
+ KEY_8,
+ KEY_9,
+ KEY_COLON,
+ KEY_SEMICOLON,
+ KEY_LESS,
+ KEY_EQUALS,
+ KEY_GREATER,
+ KEY_QUESTION,
+ KEY_AT,
+
+ KEY_LEFTBRACKET,
+ KEY_BACKSLASH,
+ KEY_RIGHTBRACKET,
+ KEY_CARET,
+ KEY_UNDERSCORE,
+ KEY_BACKQUOTE,
+ KEY_A,
+ KEY_B,
+ KEY_C,
+ KEY_D,
+ KEY_E,
+ KEY_F,
+ KEY_G,
+ KEY_H,
+ KEY_I,
+ KEY_J,
+ KEY_K,
+ KEY_L,
+ KEY_M,
+ KEY_N,
+ KEY_O,
+ KEY_P,
+ KEY_Q,
+ KEY_R,
+ KEY_S,
+ KEY_T,
+ KEY_U,
+ KEY_V,
+ KEY_W,
+ KEY_X,
+ KEY_Y,
+ KEY_Z,
+
+ KEY_CAPSLOCK,
+
+ KEY_F1,
+ KEY_F2,
+ KEY_F3,
+ KEY_F4,
+ KEY_F5,
+ KEY_F6,
+ KEY_F7,
+ KEY_F8,
+ KEY_F9,
+ KEY_F10,
+ KEY_F11,
+ KEY_F12,
+
+ KEY_PRINTSCREEN,
+ KEY_SCROLLLOCK,
+ KEY_PAUSE,
+ KEY_INSERT,
+ KEY_HOME,
+ KEY_PAGEUP,
+ KEY_DELETE,
+ KEY_END,
+ KEY_PAGEDOWN,
+ KEY_RIGHT,
+ KEY_LEFT,
+ KEY_DOWN,
+ KEY_UP,
+
+ KEY_NUMLOCKCLEAR,
+ KEY_KP_DIVIDE,
+ KEY_KP_MULTIPLY,
+ KEY_KP_MINUS,
+ KEY_KP_PLUS,
+ KEY_KP_ENTER,
+ KEY_KP_1,
+ KEY_KP_2,
+ KEY_KP_3,
+ KEY_KP_4,
+ KEY_KP_5,
+ KEY_KP_6,
+ KEY_KP_7,
+ KEY_KP_8,
+ KEY_KP_9,
+ KEY_KP_0,
+ KEY_KP_PERIOD,
+ KEY_KP_COMMA,
+ KEY_KP_EQUALS,
+
+ KEY_APPLICATION,
+ KEY_POWER,
+ KEY_F13,
+ KEY_F14,
+ KEY_F15,
+ KEY_F16,
+ KEY_F17,
+ KEY_F18,
+ KEY_F19,
+ KEY_F20,
+ KEY_F21,
+ KEY_F22,
+ KEY_F23,
+ KEY_F24,
+ KEY_EXECUTE,
+ KEY_HELP,
+ KEY_MENU,
+ KEY_SELECT,
+ KEY_STOP,
+ KEY_AGAIN,
+ KEY_UNDO,
+ KEY_CUT,
+ KEY_COPY,
+ KEY_PASTE,
+ KEY_FIND,
+ KEY_MUTE,
+ KEY_VOLUMEUP,
+ KEY_VOLUMEDOWN,
+
+ KEY_ALTERASE,
+ KEY_SYSREQ,
+ KEY_CANCEL,
+ KEY_CLEAR,
+ KEY_PRIOR,
+ KEY_RETURN2,
+ KEY_SEPARATOR,
+ KEY_OUT,
+ KEY_OPER,
+ KEY_CLEARAGAIN,
+
+ KEY_THOUSANDSSEPARATOR,
+ KEY_DECIMALSEPARATOR,
+ KEY_CURRENCYUNIT,
+ KEY_CURRENCYSUBUNIT,
+
+ KEY_LCTRL,
+ KEY_LSHIFT,
+ KEY_LALT,
+ KEY_LGUI,
+ KEY_RCTRL,
+ KEY_RSHIFT,
+ KEY_RALT,
+ KEY_RGUI,
+
+ KEY_MODE,
+
+ KEY_AUDIONEXT,
+ KEY_AUDIOPREV,
+ KEY_AUDIOSTOP,
+ KEY_AUDIOPLAY,
+ KEY_AUDIOMUTE,
+ KEY_MEDIASELECT,
+ KEY_WWW,
+ KEY_MAIL,
+ KEY_CALCULATOR,
+ KEY_COMPUTER,
+ KEY_APP_SEARCH,
+ KEY_APP_HOME,
+ KEY_APP_BACK,
+ KEY_APP_FORWARD,
+ KEY_APP_STOP,
+ KEY_APP_REFRESH,
+ KEY_APP_BOOKMARKS,
+
+ KEY_BRIGHTNESSDOWN,
+ KEY_BRIGHTNESSUP,
+ KEY_DISPLAYSWITCH,
+ KEY_KBDILLUMTOGGLE,
+ KEY_KBDILLUMDOWN,
+ KEY_KBDILLUMUP,
+ KEY_EJECT,
+ KEY_SLEEP,
+
+ KEY_MAX_ENUM
+};
+
+/**
+* Scancodes represent physical keys independent of the current layout.
+* Their names may not match the names of the keys printed on the keyboard.
+* Some of them are very esoteric...
+**/
+enum Scancode
+{
+ SCANCODE_UNKNOWN,
+
+ SCANCODE_A,
+ SCANCODE_B,
+ SCANCODE_C,
+ SCANCODE_D,
+ SCANCODE_E,
+ SCANCODE_F,
+ SCANCODE_G,
+ SCANCODE_H,
+ SCANCODE_I,
+ SCANCODE_J,
+ SCANCODE_K,
+ SCANCODE_L,
+ SCANCODE_M,
+ SCANCODE_N,
+ SCANCODE_O,
+ SCANCODE_P,
+ SCANCODE_Q,
+ SCANCODE_R,
+ SCANCODE_S,
+ SCANCODE_T,
+ SCANCODE_U,
+ SCANCODE_V,
+ SCANCODE_W,
+ SCANCODE_X,
+ SCANCODE_Y,
+ SCANCODE_Z,
+
+ SCANCODE_1,
+ SCANCODE_2,
+ SCANCODE_3,
+ SCANCODE_4,
+ SCANCODE_5,
+ SCANCODE_6,
+ SCANCODE_7,
+ SCANCODE_8,
+ SCANCODE_9,
+ SCANCODE_0,
+
+ SCANCODE_RETURN,
+ SCANCODE_ESCAPE,
+ SCANCODE_BACKSPACE,
+ SCANCODE_TAB,
+ SCANCODE_SPACE,
+
+ SCANCODE_MINUS,
+ SCANCODE_EQUALS,
+ SCANCODE_LEFTBRACKET,
+ SCANCODE_RIGHTBRACKET,
+ SCANCODE_BACKSLASH,
+ SCANCODE_NONUSHASH,
+ SCANCODE_SEMICOLON,
+ SCANCODE_APOSTROPHE,
+ SCANCODE_GRAVE,
+ SCANCODE_COMMA,
+ SCANCODE_PERIOD,
+ SCANCODE_SLASH,
+
+ SCANCODE_CAPSLOCK,
+
+ SCANCODE_F1,
+ SCANCODE_F2,
+ SCANCODE_F3,
+ SCANCODE_F4,
+ SCANCODE_F5,
+ SCANCODE_F6,
+ SCANCODE_F7,
+ SCANCODE_F8,
+ SCANCODE_F9,
+ SCANCODE_F10,
+ SCANCODE_F11,
+ SCANCODE_F12,
+
+ SCANCODE_PRINTSCREEN,
+ SCANCODE_SCROLLLOCK,
+ SCANCODE_PAUSE,
+ SCANCODE_INSERT,
+ SCANCODE_HOME,
+ SCANCODE_PAGEUP,
+ SCANCODE_DELETE,
+ SCANCODE_END,
+ SCANCODE_PAGEDOWN,
+ SCANCODE_RIGHT,
+ SCANCODE_LEFT,
+ SCANCODE_DOWN,
+ SCANCODE_UP,
+
+ SCANCODE_NUMLOCKCLEAR,
+ SCANCODE_KP_DIVIDE,
+ SCANCODE_KP_MULTIPLY,
+ SCANCODE_KP_MINUS,
+ SCANCODE_KP_PLUS,
+ SCANCODE_KP_ENTER,
+ SCANCODE_KP_1,
+ SCANCODE_KP_2,
+ SCANCODE_KP_3,
+ SCANCODE_KP_4,
+ SCANCODE_KP_5,
+ SCANCODE_KP_6,
+ SCANCODE_KP_7,
+ SCANCODE_KP_8,
+ SCANCODE_KP_9,
+ SCANCODE_KP_0,
+ SCANCODE_KP_PERIOD,
+
+ SCANCODE_NONUSBACKSLASH,
+ SCANCODE_APPLICATION,
+ SCANCODE_POWER,
+ SCANCODE_KP_EQUALS,
+ SCANCODE_F13,
+ SCANCODE_F14,
+ SCANCODE_F15,
+ SCANCODE_F16,
+ SCANCODE_F17,
+ SCANCODE_F18,
+ SCANCODE_F19,
+ SCANCODE_F20,
+ SCANCODE_F21,
+ SCANCODE_F22,
+ SCANCODE_F23,
+ SCANCODE_F24,
+ SCANCODE_EXECUTE,
+ SCANCODE_HELP,
+ SCANCODE_MENU,
+ SCANCODE_SELECT,
+ SCANCODE_STOP,
+ SCANCODE_AGAIN,
+ SCANCODE_UNDO,
+ SCANCODE_CUT,
+ SCANCODE_COPY,
+ SCANCODE_PASTE,
+ SCANCODE_FIND,
+ SCANCODE_MUTE,
+ SCANCODE_VOLUMEUP,
+ SCANCODE_VOLUMEDOWN,
+ SCANCODE_KP_COMMA,
+ SCANCODE_KP_EQUALSAS400,
+
+ SCANCODE_INTERNATIONAL1,
+ SCANCODE_INTERNATIONAL2,
+ SCANCODE_INTERNATIONAL3,
+ SCANCODE_INTERNATIONAL4,
+ SCANCODE_INTERNATIONAL5,
+ SCANCODE_INTERNATIONAL6,
+ SCANCODE_INTERNATIONAL7,
+ SCANCODE_INTERNATIONAL8,
+ SCANCODE_INTERNATIONAL9,
+ SCANCODE_LANG1,
+ SCANCODE_LANG2,
+ SCANCODE_LANG3,
+ SCANCODE_LANG4,
+ SCANCODE_LANG5,
+ SCANCODE_LANG6,
+ SCANCODE_LANG7,
+ SCANCODE_LANG8,
+ SCANCODE_LANG9,
+
+ SCANCODE_ALTERASE,
+ SCANCODE_SYSREQ,
+ SCANCODE_CANCEL,
+ SCANCODE_CLEAR,
+ SCANCODE_PRIOR,
+ SCANCODE_RETURN2,
+ SCANCODE_SEPARATOR,
+ SCANCODE_OUT,
+ SCANCODE_OPER,
+ SCANCODE_CLEARAGAIN,
+ SCANCODE_CRSEL,
+ SCANCODE_EXSEL,
+
+ SCANCODE_KP_00,
+ SCANCODE_KP_000,
+ SCANCODE_THOUSANDSSEPARATOR,
+ SCANCODE_DECIMALSEPARATOR,
+ SCANCODE_CURRENCYUNIT,
+ SCANCODE_CURRENCYSUBUNIT,
+ SCANCODE_KP_LEFTPAREN,
+ SCANCODE_KP_RIGHTPAREN,
+ SCANCODE_KP_LEFTBRACE,
+ SCANCODE_KP_RIGHTBRACE,
+ SCANCODE_KP_TAB,
+ SCANCODE_KP_BACKSPACE,
+ SCANCODE_KP_A,
+ SCANCODE_KP_B,
+ SCANCODE_KP_C,
+ SCANCODE_KP_D,
+ SCANCODE_KP_E,
+ SCANCODE_KP_F,
+ SCANCODE_KP_XOR,
+ SCANCODE_KP_POWER,
+ SCANCODE_KP_PERCENT,
+ SCANCODE_KP_LESS,
+ SCANCODE_KP_GREATER,
+ SCANCODE_KP_AMPERSAND,
+ SCANCODE_KP_DBLAMPERSAND,
+ SCANCODE_KP_VERTICALBAR,
+ SCANCODE_KP_DBLVERTICALBAR,
+ SCANCODE_KP_COLON,
+ SCANCODE_KP_HASH,
+ SCANCODE_KP_SPACE,
+ SCANCODE_KP_AT,
+ SCANCODE_KP_EXCLAM,
+ SCANCODE_KP_MEMSTORE,
+ SCANCODE_KP_MEMRECALL,
+ SCANCODE_KP_MEMCLEAR,
+ SCANCODE_KP_MEMADD,
+ SCANCODE_KP_MEMSUBTRACT,
+ SCANCODE_KP_MEMMULTIPLY,
+ SCANCODE_KP_MEMDIVIDE,
+ SCANCODE_KP_PLUSMINUS,
+ SCANCODE_KP_CLEAR,
+ SCANCODE_KP_CLEARENTRY,
+ SCANCODE_KP_BINARY,
+ SCANCODE_KP_OCTAL,
+ SCANCODE_KP_DECIMAL,
+ SCANCODE_KP_HEXADECIMAL,
+
+ SCANCODE_LCTRL,
+ SCANCODE_LSHIFT,
+ SCANCODE_LALT,
+ SCANCODE_LGUI,
+ SCANCODE_RCTRL,
+ SCANCODE_RSHIFT,
+ SCANCODE_RALT,
+ SCANCODE_RGUI,
+
+ SCANCODE_MODE,
+
+ SCANCODE_AUDIONEXT,
+ SCANCODE_AUDIOPREV,
+ SCANCODE_AUDIOSTOP,
+ SCANCODE_AUDIOPLAY,
+ SCANCODE_AUDIOMUTE,
+ SCANCODE_MEDIASELECT,
+ SCANCODE_WWW,
+ SCANCODE_MAIL,
+ SCANCODE_CALCULATOR,
+ SCANCODE_COMPUTER,
+ SCANCODE_AC_SEARCH,
+ SCANCODE_AC_HOME,
+ SCANCODE_AC_BACK,
+ SCANCODE_AC_FORWARD,
+ SCANCODE_AC_STOP,
+ SCANCODE_AC_REFRESH,
+ SCANCODE_AC_BOOKMARKS,
+
+ SCANCODE_BRIGHTNESSDOWN,
+ SCANCODE_BRIGHTNESSUP,
+ SCANCODE_DISPLAYSWITCH,
+ SCANCODE_KBDILLUMTOGGLE,
+ SCANCODE_KBDILLUMDOWN,
+ SCANCODE_KBDILLUMUP,
+ SCANCODE_EJECT,
+ SCANCODE_SLEEP,
+
+ SCANCODE_APP1,
+ SCANCODE_APP2,
+
+ SCANCODE_MAX_ENUM
+};
diff --git a/source/modules/asura-core/window/window_impl_glew.h b/source/modules/asura-core/Input/MouseState.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glew.h
+++ b/source/modules/asura-core/Input/MouseState.h
diff --git a/source/modules/asura-core/mesh/am2_handler.cpp b/source/modules/asura-core/Mesh/Am2Handler.cpp
index d0b9252..115797f 100644
--- a/source/modules/asura-core/mesh/am2_handler.cpp
+++ b/source/modules/asura-core/Mesh/Am2Handler.cpp
@@ -1,4 +1,4 @@
-#include "am2_handler.h"
+#include "Am2Handler.h"
namespace_begin(AsuraEngine)
namespace_begin(Mesh)
diff --git a/source/modules/asura-core/mesh/am2_handler.h b/source/modules/asura-core/Mesh/Am2Handler.h
index 4fa8ba5..8bd0612 100644
--- a/source/modules/asura-core/mesh/am2_handler.h
+++ b/source/modules/asura-core/Mesh/Am2Handler.h
@@ -1,7 +1,7 @@
-#ifndef __ASURA_MESH2D_AM2_HANDLER_H__
-#define __ASURA_MESH2D_AM2_HANDLER_H__
+#ifndef _ASURA_MESH2D_AM2_HANDLER_H__
+#define _ASURA_MESH2D_AM2_HANDLER_H__
-#include "mesh2d_handler.h"
+#include "Mesh2dHandler.h"
namespace_begin(AsuraEngine)
namespace_begin(Mesh)
diff --git a/source/modules/asura-core/window/window_impl_glut.cpp b/source/modules/asura-core/Mesh/Mesh2DData.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glut.cpp
+++ b/source/modules/asura-core/Mesh/Mesh2DData.cpp
diff --git a/source/modules/asura-core/mesh/mesh2d_data.h b/source/modules/asura-core/Mesh/Mesh2DData.h
index 024ba02..1144846 100644
--- a/source/modules/asura-core/mesh/mesh2d_data.h
+++ b/source/modules/asura-core/Mesh/Mesh2DData.h
@@ -1,17 +1,17 @@
-#ifndef __ASURA_MESH2D_DATA_H__
-#define __ASURA_MESH2D_DATA_H__
+#ifndef _ASURA_MESH2D_DATA_H__
+#define _ASURA_MESH2D_DATA_H__
// cpp
#include <vector>
// asura modules
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/io/decoded_data.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/IO/DecodedData.h>
// module
-#include "../graphics/color.h"
-#include "../graphics/gpu_buffer.h"
+#include "../Graphics/Color.h"
+#include "../Graphics/GPUBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Mesh)
diff --git a/source/modules/asura-core/window/window_impl_glut.h b/source/modules/asura-core/Mesh/Mesh2DHandler.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/window/window_impl_glut.h
+++ b/source/modules/asura-core/Mesh/Mesh2DHandler.cpp
diff --git a/source/modules/asura-core/mesh/mesh2d_handler.h b/source/modules/asura-core/Mesh/Mesh2DHandler.h
index c8ae32e..e50ace8 100644
--- a/source/modules/asura-core/mesh/mesh2d_handler.h
+++ b/source/modules/asura-core/Mesh/Mesh2DHandler.h
@@ -1,10 +1,10 @@
-#ifndef __ASURA_MESH2D_HANDLER_H__
-#define __ASURA_MESH2D_HANDLER_H__
+#ifndef _ASURA_MESH2D_HANDLER_H__
+#define _ASURA_MESH2D_HANDLER_H__
-#include <asura-utils/io/data_buffer.h>
-#include <asura-utils/type.h>
+#include <asura-utils/IO/DataBuffer.h>
+#include <asura-utils/Type.h>
-#include "mesh2d_data.h"
+#include "Mesh2dData.h"
namespace_begin(AsuraEngine)
namespace_begin(Mesh)
diff --git a/source/modules/asura-core/Mesh/ObjHandler.cpp b/source/modules/asura-core/Mesh/ObjHandler.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Mesh/ObjHandler.cpp
diff --git a/source/modules/asura-core/Mesh/ObjHandler.h b/source/modules/asura-core/Mesh/ObjHandler.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Mesh/ObjHandler.h
diff --git a/source/modules/asura-core/Profiler/GPUProfiler.cpp b/source/modules/asura-core/Profiler/GPUProfiler.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Profiler/GPUProfiler.cpp
diff --git a/source/modules/asura-core/Profiler/GPUProfiler.h b/source/modules/asura-core/Profiler/GPUProfiler.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Profiler/GPUProfiler.h
diff --git a/source/modules/asura-core/Profiler/Stats.cpp b/source/modules/asura-core/Profiler/Stats.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Profiler/Stats.cpp
diff --git a/source/modules/asura-core/Profiler/Stats.h b/source/modules/asura-core/Profiler/Stats.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Profiler/Stats.h
diff --git a/source/modules/asura-core/Threads/Channel.cpp b/source/modules/asura-core/Threads/Channel.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Threads/Channel.cpp
diff --git a/source/modules/asura-core/Threads/Channel.h b/source/modules/asura-core/Threads/Channel.h
new file mode 100644
index 0000000..01b9ded
--- /dev/null
+++ b/source/modules/asura-core/Threads/Channel.h
@@ -0,0 +1,18 @@
+#ifndef _ASURA_THREAD_CHANNEL_H_
+#define _ASURA_THREAD_CHANNEL_H_
+
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Threads)
+
+class Channel
+{
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/threading/thread_ex.cpp b/source/modules/asura-core/Threads/ThreadEx.cpp
index da806f4..cc8107c 100644
--- a/source/modules/asura-core/threading/thread_ex.cpp
+++ b/source/modules/asura-core/Threads/ThreadEx.cpp
@@ -1,9 +1,9 @@
-#include <asura-utils/classes.h>
+#include <asura-utils/Classes.h>
-#include "thread_ex.h"
+#include "ThreadEx.h"
namespace_begin(AsuraEngine)
-namespace_begin(Threading)
+namespace_begin(Threads)
int ThreadEx::Process()
{
diff --git a/source/modules/asura-core/threading/thread_ex.h b/source/modules/asura-core/Threads/ThreadEx.h
index 0015f61..53600a6 100644
--- a/source/modules/asura-core/threading/thread_ex.h
+++ b/source/modules/asura-core/Threads/ThreadEx.h
@@ -1,11 +1,11 @@
-#ifndef __ASURA_THREAD_EX_H__
-#define __ASURA_THREAD_EX_H__
+#ifndef _ASURA_THREAD_EX_H_
+#define _ASURA_THREAD_EX_H_
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/threading/thread.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Threads/Thread.h>
namespace_begin(AsuraEngine)
-namespace_begin(Threading)
+namespace_begin(Threads)
///
/// ThreadExеͬͨ˶ͨݡ
diff --git a/source/modules/asura-core/Time/Timer.cpp b/source/modules/asura-core/Time/Timer.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Time/Timer.cpp
diff --git a/source/modules/asura-core/Time/Timer.h b/source/modules/asura-core/Time/Timer.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Time/Timer.h
diff --git a/source/modules/asura-core/Type.h b/source/modules/asura-core/Type.h
new file mode 100644
index 0000000..39880e2
--- /dev/null
+++ b/source/modules/asura-core/Type.h
@@ -0,0 +1,11 @@
+#ifndef _ASURA_ENGINE_TYPE_H_
+#define _ASURA_ENGINE_TYPE_H_
+
+#include <stdint.h>
+
+namespace AsuraEngine
+{
+
+}
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Window/Window.cpp b/source/modules/asura-core/Window/Window.cpp
new file mode 100644
index 0000000..adba7c9
--- /dev/null
+++ b/source/modules/asura-core/Window/Window.cpp
@@ -0,0 +1,104 @@
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "window.h"
+
+#include "WindowImplSDL.h"
+#include "WindowImplGlew.h"
+#include "WindowImplGlut.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Window)
+
+ Window::Window()
+ : m_Impl(nullptr)
+ {
+ }
+
+ Window::~Window()
+ {
+ if (m_Impl)
+ delete m_Impl;
+ }
+
+#define try_init_window(impl) \
+ if (!m_Impl) \
+ { \
+ m_Impl = new impl(); \
+ if (!m_Impl->Init(config)) \
+ { \
+ delete m_Impl; \
+ m_Impl = nullptr; \
+ } \
+ }
+
+ bool Window::Init(const WindowConfig& config)
+ {
+ ASSERT(!m_Impl);
+#if ASURA_WINDOW_SDL
+ try_init_window(WindowImplSDL);
+#endif
+ return m_Impl != nullptr;
+ }
+
+ void Window::Exit()
+ {
+ if (m_Impl)
+ delete m_Impl;
+ }
+
+ void Window::SetPosition(int x, int y)
+ {
+ ASSERT(m_Impl);
+ m_Impl->SetPosition(x, y);
+ }
+
+ void Window::SetTitle(const std::string& title)
+ {
+ ASSERT(m_Impl);
+ m_Impl->SetTitils(title);
+ }
+
+ void Window::Show()
+ {
+ ASSERT(m_Impl);
+ m_Impl->Show();
+ }
+
+ void Window::Hide()
+ {
+ ASSERT(m_Impl);
+ m_Impl->Hide();
+ }
+
+ void Window::SwapRenderBuffer()
+ {
+ ASSERT(m_Impl);
+ m_Impl->SwapRenderBuffer();
+ }
+
+ void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
+ {
+ ASSERT(m_Impl);
+ glClearColor(col.r, col.g, col.b, col.a);
+ }
+
+ //void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
+ //{
+ // ASSERT(m_Impl);
+
+ //}
+
+ void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state)
+ {
+ ASSERT(m_Impl);
+
+ }
+/*
+ void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state)
+ {
+ ASSERT(m_Impl);
+
+ }
+*/
+ }
+}
diff --git a/source/modules/asura-core/Window/Window.h b/source/modules/asura-core/Window/Window.h
new file mode 100644
index 0000000..f5498c1
--- /dev/null
+++ b/source/modules/asura-core/Window/Window.h
@@ -0,0 +1,138 @@
+#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/RenderState.h"
+#include "../Graphics/RenderTarget.h"
+
+namespace_begin(AsuraEngine)
+namespace_begin(Window)
+
+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; ///< ֱͬ
+ AEImage::ImageData* icon; ///< ͼ
+ bool show; ///< Ƿʾ
+ int flag; ///< ڱ
+};
+
+///
+/// ϷĵڣrunnerֻҪһڡͬĿͻʵִ˽ӿڲֶעᵽlua༭
+/// ᵼ࣬޽ӵ༭ⴰϡ
+///
+class Window ASURA_FINAL
+ : public AEScripting::Portable<Window, AEGraphics::RenderTarget>
+ , 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(AEImage::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:
+
+ WindowImpl* m_Impl;
+
+luaxport:
+
+ 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);
+
+};
+
+using RenderWindow = Window;
+
+ASURA_ABSTRACT class WindowImpl
+{
+public:
+
+ WindowImpl() {};
+ virtual ~WindowImpl() {};
+
+ virtual bool Init(const WindowConfig& config);
+
+ 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() = 0;
+ virtual void Hide() = 0;
+
+ virtual void SwapRenderBuffer() = 0;
+
+};
+
+namespace_end
+namespace_end
+
+namespace AEWindow = AsuraEngine::Window;
+
+#endif \ No newline at end of file
diff --git a/source/modules/asura-core/Window/WindowImplGlew.cpp b/source/modules/asura-core/Window/WindowImplGlew.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Window/WindowImplGlew.cpp
diff --git a/source/modules/asura-core/Window/WindowImplGlew.h b/source/modules/asura-core/Window/WindowImplGlew.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Window/WindowImplGlew.h
diff --git a/source/modules/asura-core/Window/WindowImplGlut.h b/source/modules/asura-core/Window/WindowImplGlut.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Window/WindowImplGlut.h
diff --git a/source/modules/asura-core/window/window_impl_sdl.cpp b/source/modules/asura-core/Window/WindowImplSDL.cpp
index 59562a4..3cbad70 100644
--- a/source/modules/asura-core/window/window_impl_sdl.cpp
+++ b/source/modules/asura-core/Window/WindowImplSDL.cpp
@@ -1,12 +1,12 @@
-#include "../core_config.h"
+#include "../CoreConfig.h"
#if ASURA_WINDOW_SDL
#include <SDL2/SDL.h>
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
-#include "window_impl_sdl.h"
+#include "WindowImplSDL.h"
using namespace AEGraphics;
using namespace AEImage;
diff --git a/source/modules/asura-core/window/window_impl_sdl.h b/source/modules/asura-core/Window/WindowImplSDL.h
index 20f5c95..5971351 100644
--- a/source/modules/asura-core/window/window_impl_sdl.h
+++ b/source/modules/asura-core/Window/WindowImplSDL.h
@@ -1,13 +1,13 @@
-#ifndef __ASURA_WINDOW_SDL_H_
-#define __ASURA_WINDOW_SDL_H_
+#ifndef _ASURA_WINDOW_SDL_H_
+#define _ASURA_WINDOW_SDL_H_
-#include "../core_config.h"
+#include "../CoreConfig.h"
#if ASURA_WINDOW_SDL
#include <SDL2/SDL.h>
-#include "window.h"
+#include "Window.h"
namespace_begin(AsuraEngine)
namespace_begin(Window)
diff --git a/source/modules/asura-core/Window/WinodwImplGlut.cpp b/source/modules/asura-core/Window/WinodwImplGlut.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/modules/asura-core/Window/WinodwImplGlut.cpp
diff --git a/source/modules/asura-core/Window/binding/_window.cpp b/source/modules/asura-core/Window/binding/_window.cpp
new file mode 100644
index 0000000..1e14a3a
--- /dev/null
+++ b/source/modules/asura-core/Window/binding/_window.cpp
@@ -0,0 +1,179 @@
+#include "../../Image/ImageData.h"
+
+#include "../Window.h"
+
+using namespace std;
+using namespace AEGraphics;
+using namespace AEImage;
+
+namespace_begin(AsuraEngine)
+namespace_begin(Window)
+
+ 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/application.h b/source/modules/asura-core/application.h
index 62eefe7..ea5faa7 100644
--- a/source/modules/asura-core/application.h
+++ b/source/modules/asura-core/application.h
@@ -1,18 +1,16 @@
-#ifndef __ASURA_ENGINE_APPLICATION_H__
-#define __ASURA_ENGINE_APPLICATION_H__
+#ifndef _ASURA_ENGINE_APPLICATION_H_
+#define _ASURA_ENGINE_APPLICATION_H_
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/module.h>
-#include <asura-utils/classes.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Module.h>
+#include <asura-utils/Classes.h>
#include <queue>
-#include "core_config.h"
+#include "CoreConfig.h"
namespace_begin(AsuraEngine)
-///
/// ģ
-///
enum SubModules
{
ASURA_MODULE_NONE = 0X00000000U,
diff --git a/source/modules/asura-core/core_module.h b/source/modules/asura-core/core_module.h
deleted file mode 100644
index 443aea4..0000000
--- a/source/modules/asura-core/core_module.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __ASURA_CORE_MODULE_H__
-#define __ASURA_CORE_MODULE_H__
-
-#include <asura-utils/module.h>
-
-#include "graphics/image.h"
-#include "graphics/texture.h"
-
-#include "window/window.h"
-
-#include "threading/thread_ex.h"
-
-namespace AsuraEngine
-{
-
- class CoreModule : public Module
- {
- public:
-
- void Initialize(Luax::LuaxState& state) override;
-
- void Finalize(Luax::LuaxState& state) override;
-
- };
-
-}
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/font/string.hpp b/source/modules/asura-core/font/string.hpp
index 2c6c845..13a8b2d 100644
--- a/source/modules/asura-core/font/string.hpp
+++ b/source/modules/asura-core/font/string.hpp
@@ -1,5 +1,5 @@
-//#ifndef __ASURA_ENGINE_STRING_H__
-//#define __ASURA_ENGINE_STRING_H__
+//#ifndef _ASURA_ENGINE_STRING_H_
+//#define _ASURA_ENGINE_STRING_H_
//
//#include <asura-utils/type.h>
//
@@ -587,7 +587,7 @@
// ////////////////////////////////////////////////////////////
// String operator +(const String& left, const String& right);
//
-// #include "String.inl"
+// #include "String.inc"
//
// }
//}
diff --git a/source/modules/asura-core/font/ttf.h b/source/modules/asura-core/font/ttf.h
index 840b63e..b83cf76 100644
--- a/source/modules/asura-core/font/ttf.h
+++ b/source/modules/asura-core/font/ttf.h
@@ -1,5 +1,5 @@
-#ifndef __ASURA_TTF_H__
-#define __ASURA_TTF_H__
+#ifndef _ASURA_TTF_H_
+#define _ASURA_TTF_H_
namespace AsuraEngine
{
diff --git a/source/modules/asura-core/font/utf.hpp b/source/modules/asura-core/font/utf.hpp
index 2e04ee4..59f62ed 100644
--- a/source/modules/asura-core/font/utf.hpp
+++ b/source/modules/asura-core/font/utf.hpp
@@ -1,5 +1,5 @@
-#ifndef __ASURA_UTF_HPP__
-#define __ASURA_UTF_HPP__
+#ifndef _ASURA_UTF_HPP_
+#define _ASURA_UTF_HPP_
////////////////////////////////////////////////////////////
// Headers
@@ -705,7 +705,7 @@ namespace AsuraEngine
static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
};
-#include "Utf.inl"
+#include "Utf.inc"
// Make typedefs to get rid of the template syntax
typedef Utf<8> Utf8;
diff --git a/source/modules/asura-core/graphics/binding/_canvas.cpp b/source/modules/asura-core/graphics/binding/_canvas.cpp
index 6dda773..44841f5 100644
--- a/source/modules/asura-core/graphics/binding/_canvas.cpp
+++ b/source/modules/asura-core/graphics/binding/_canvas.cpp
@@ -1,4 +1,4 @@
-#include "../canvas.h"
+#include "../Canvas.h"
using namespace std;
diff --git a/source/modules/asura-core/graphics/binding/_color.cpp b/source/modules/asura-core/graphics/binding/_color.cpp
index c990d8b..008d9c2 100644
--- a/source/modules/asura-core/graphics/binding/_color.cpp
+++ b/source/modules/asura-core/graphics/binding/_color.cpp
@@ -1,4 +1,4 @@
-#include "../color.h"
+#include "../Color.h"
using namespace std;
using namespace Luax;
diff --git a/source/modules/asura-core/graphics/binding/_color32.cpp b/source/modules/asura-core/graphics/binding/_color32.cpp
index 96c63af..7613361 100644
--- a/source/modules/asura-core/graphics/binding/_color32.cpp
+++ b/source/modules/asura-core/graphics/binding/_color32.cpp
@@ -1,4 +1,4 @@
-#include "../color32.h"
+#include "../Color32.h"
using namespace std;
diff --git a/source/modules/asura-core/graphics/binding/_gfx_device.cpp b/source/modules/asura-core/graphics/binding/_gfx_device.cpp
index 60a0b0b..f6c2004 100644
--- a/source/modules/asura-core/graphics/binding/_gfx_device.cpp
+++ b/source/modules/asura-core/graphics/binding/_gfx_device.cpp
@@ -1,4 +1,4 @@
-#include "../gfx_device.h"
+#include "../GfxDevice.h"
using namespace std;
using namespace Luax;
diff --git a/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp b/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp
index 479901e..8c39a59 100644
--- a/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp
+++ b/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include "../image.h"
-#include "../gpu_buffer.h"
+#include "../GPUBuffer.h"
using namespace std;
using namespace Luax;
diff --git a/source/modules/asura-core/graphics/binding/_index_buffer.cpp b/source/modules/asura-core/graphics/binding/_index_buffer.cpp
index eb81699..151dc98 100644
--- a/source/modules/asura-core/graphics/binding/_index_buffer.cpp
+++ b/source/modules/asura-core/graphics/binding/_index_buffer.cpp
@@ -1,4 +1,4 @@
-#include "../index_buffer.h"
+#include "../IndexBuffer.h"
using namespace std;
using namespace Luax;
diff --git a/source/modules/asura-core/graphics/binding/_sprite_batch.cpp b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp
index 7795d26..6b7d25c 100644
--- a/source/modules/asura-core/graphics/binding/_sprite_batch.cpp
+++ b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp
@@ -1,4 +1,4 @@
-#include "../sprite_batch.h"
+#include "../SpriteBatch.h"
using namespace std;
diff --git a/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp b/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp
index b181df3..8ed487b 100644
--- a/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp
+++ b/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp
@@ -1,4 +1,4 @@
-#include "../vertex_buffer.h"
+#include "../VertexBuffer.h"
using namespace std;
using namespace Luax;
diff --git a/source/modules/asura-core/graphics/blend_mode.h b/source/modules/asura-core/graphics/blend_mode.h
deleted file mode 100644
index 73e1a41..0000000
--- a/source/modules/asura-core/graphics/blend_mode.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __ASURA_ENGINE_BLEND_MODE_H__
-#define __ASURA_ENGINE_BLEND_MODE_H__
-
-#include <asura-utils/classes.h>
-
-namespace_begin(AsuraEngine)
-namespace_begin(Graphics)
-
-enum BlendMode
-{
-
-};
-
-namespace_end
-namespace_end
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/canvas.h b/source/modules/asura-core/graphics/canvas.h
index bbd098a..0ec55bc 100644
--- a/source/modules/asura-core/graphics/canvas.h
+++ b/source/modules/asura-core/graphics/canvas.h
@@ -1,15 +1,15 @@
-#ifndef __ASURA_ENGINE_CANVAS_H__
-#define __ASURA_ENGINE_CANVAS_H__
-
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/math/rect.hpp>
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/exceptions/exception.h>
-
-#include "gfx_device.h"
-#include "texture.h"
-#include "render_target.h"
-#include "render_state.h"
+#ifndef _ASURA_ENGINE_CANVAS_H_
+#define _ASURA_ENGINE_CANVAS_H_
+
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Exceptions/Exception.h>
+
+#include "GfxDevice.h"
+#include "Texture.h"
+#include "RenderTarget.h"
+#include "RenderState.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/color.cpp b/source/modules/asura-core/graphics/color.cpp
index 47e039f..5a66291 100644
--- a/source/modules/asura-core/graphics/color.cpp
+++ b/source/modules/asura-core/graphics/color.cpp
@@ -1,5 +1,5 @@
-#include "color.h"
-#include "color32.h"
+#include "Color.h"
+#include "Color32.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/color.h b/source/modules/asura-core/graphics/color.h
index 99a9b00..a16f17d 100644
--- a/source/modules/asura-core/graphics/color.h
+++ b/source/modules/asura-core/graphics/color.h
@@ -1,10 +1,10 @@
-#ifndef __ASURA_ENGINE_COLOR_H__
-#define __ASURA_ENGINE_COLOR_H__
+#ifndef _ASURA_ENGINE_COLOR_H_
+#define _ASURA_ENGINE_COLOR_H_
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/classes.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Classes.h>
-#include "../core_config.h"
+#include "../CoreConfig.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/color32.cpp b/source/modules/asura-core/graphics/color32.cpp
index 11239c8..f1f0b74 100644
--- a/source/modules/asura-core/graphics/color32.cpp
+++ b/source/modules/asura-core/graphics/color32.cpp
@@ -1,5 +1,5 @@
-#include "color.h"
-#include "color32.h"
+#include "Color.h"
+#include "Color32.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/color32.h b/source/modules/asura-core/graphics/color32.h
index 52405e9..aa445fe 100644
--- a/source/modules/asura-core/graphics/color32.h
+++ b/source/modules/asura-core/graphics/color32.h
@@ -1,10 +1,10 @@
-#ifndef __ASURA_ENGINE_COLOR32_H__
-#define __ASURA_ENGINE_COLOR32_H__
+#ifndef _ASURA_ENGINE_COLOR32_H__
+#define _ASURA_ENGINE_COLOR32_H__
-#include <asura-utils/classes.h>
-#include <asura-utils/scripting/portable.hpp>
+#include <asura-utils/Classes.h>
+#include <asura-utils/Scripting/Portable.hpp>
-#include "../core_config.h"
+#include "../CoreConfig.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp
index 32fa870..d2b2ec9 100644
--- a/source/modules/asura-core/graphics/image.cpp
+++ b/source/modules/asura-core/graphics/image.cpp
@@ -1,10 +1,10 @@
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
-#include "../core_config.h"
+#include "../CoreConfig.h"
-#include "shader.h"
-#include "image.h"
-#include "gfx_device.h"
+#include "Shader.h"
+#include "Image.h"
+#include "GfxDevice.h"
using namespace AEIO;
using namespace AEImage;
diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h
index 72f1281..5cbfe23 100644
--- a/source/modules/asura-core/graphics/image.h
+++ b/source/modules/asura-core/graphics/image.h
@@ -1,23 +1,23 @@
-#ifndef __ASURA_ENGINE_IMAGE_H__
-#define __ASURA_ENGINE_IMAGE_H__
+#ifndef _ASURA_ENGINE_IMAGE_H_
+#define _ASURA_ENGINE_IMAGE_H_
// asura modules
-#include <asura-utils/math/rect.hpp>
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/io/renewable.h>
-#include <asura-utils/stringmap.hpp>
-#include <asura-utils/manager.hpp>
+#include <asura-utils/Math/Rect.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/IO/Renewable.h>
+#include <asura-utils/Stringmap.hpp>
+#include <asura-utils/Manager.hpp>
// module
-#include "../image/image_data.h"
+#include "../Image/ImageData.h"
// folder
-#include "color.h"
-#include "color32.h"
-#include "render_state.h"
-#include "gpu_buffer.h"
-#include "texture.h"
+#include "Color.h"
+#include "Color32.h"
+#include "RenderState.h"
+#include "GPUBuffer.h"
+#include "Texture.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/mesh2d.h b/source/modules/asura-core/graphics/mesh2d.h
index d2d7d3b..1546765 100644
--- a/source/modules/asura-core/graphics/mesh2d.h
+++ b/source/modules/asura-core/graphics/mesh2d.h
@@ -1,20 +1,20 @@
-#ifndef __ASURA_ENGINE_MESH2D_H__
-#define __ASURA_ENGINE_MESH2D_H__
+#ifndef _ASURA_ENGINE_MESH2D_H__
+#define _ASURA_ENGINE_MESH2D_H__
// cpp
#include <vector>
// asura modules
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/math/vector2.hpp>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/Math/Vector2.hpp>
// module
-#include "../mesh/mesh2d_data.h"
+#include "../Mesh/Mesh2dData.h"
// folder
-#include "color.h"
-#include "vertex_buffer.h"
-#include "index_buffer.h"
+#include "Color.h"
+#include "VertexBuffer.h"
+#include "IndexBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/shader.cpp b/source/modules/asura-core/graphics/shader.cpp
index 74bf7a8..30e0161 100644
--- a/source/modules/asura-core/graphics/shader.cpp
+++ b/source/modules/asura-core/graphics/shader.cpp
@@ -1,7 +1,7 @@
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
-#include "gfx_device.h"
-#include "shader.h"
+#include "GfxDevice.h"
+#include "Shader.h"
using namespace std;
diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h
index c535570..c96b99f 100644
--- a/source/modules/asura-core/graphics/shader.h
+++ b/source/modules/asura-core/graphics/shader.h
@@ -1,24 +1,24 @@
-#ifndef __ASURA_ENGINE_SHADER_H__
-#define __ASURA_ENGINE_SHADER_H__
+#ifndef _ASURA_ENGINE_SHADER_H_
+#define _ASURA_ENGINE_SHADER_H_
#include <map>
#include <string>
-#include <asura-utils/exceptions/exception.h>
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/io/renewable.h>
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/math/vector3.hpp>
-#include <asura-utils/math/vector4.h>
-#include <asura-utils/math/matrix44.h>
-#include <asura-utils/stringmap.hpp>
-#include <asura-utils/manager.hpp>
-
-#include "gfx_device.h"
-#include "color.h"
-#include "texture.h"
-#include "vertex_buffer.h"
-#include "index_buffer.h"
+#include <asura-utils/Exceptions/Exception.h>
+#include <asura-utils/Scripting/Portable.hpp>
+#include <asura-utils/IO/Renewable.h>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/vector3.hpp>
+#include <asura-utils/Math/vector4.h>
+#include <asura-utils/Math/matrix44.h>
+#include <asura-utils/Stringmap.hpp>
+#include <asura-utils/Manager.hpp>
+
+#include "GfxDevice.h"
+#include "Color.h"
+#include "Texture.h"
+#include "VertexBuffer.h"
+#include "IndexBuffer.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp
index 42e3851..bae0f7c 100644
--- a/source/modules/asura-core/graphics/texture.cpp
+++ b/source/modules/asura-core/graphics/texture.cpp
@@ -1,4 +1,4 @@
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
#include "Texture.h"
diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h
index 458e35a..7d37c31 100644
--- a/source/modules/asura-core/graphics/texture.h
+++ b/source/modules/asura-core/graphics/texture.h
@@ -1,13 +1,13 @@
-#ifndef __ASURA_TEXTURE_H__
-#define __ASURA_TEXTURE_H__
+#ifndef _ASURA_TEXTURE_H_
+#define _ASURA_TEXTURE_H_
-#include <asura-utils/math/vector2.hpp>
-#include <asura-utils/math/rect.hpp>
+#include <asura-utils/Math/Vector2.hpp>
+#include <asura-utils/Math/Rect.hpp>
-#include "../core_config.h"
+#include "../CoreConfig.h"
-#include "render_state.h"
-#include "gfx_device.h"
+#include "RenderState.h"
+#include "GfxDevice.h"
namespace_begin(AsuraEngine)
namespace_begin(Graphics)
diff --git a/source/modules/asura-core/image/binding/_image_data.cpp b/source/modules/asura-core/image/binding/_image_data.cpp
index 93e63ce..77f3a96 100644
--- a/source/modules/asura-core/image/binding/_image_data.cpp
+++ b/source/modules/asura-core/image/binding/_image_data.cpp
@@ -1,7 +1,7 @@
-#include <asura-utils/threading/thread.h>
-#include <asura-utils/io/data_buffer.h>
+#include <asura-utils/Threads/Thread.h>
+#include <asura-utils/IO/DataBuffer.h>
-#include "../image_data.h"
+#include "../ImageData.h"
using namespace std;
using namespace AEThreading;
diff --git a/source/modules/asura-core/image/binding/_image_decode_task.cpp b/source/modules/asura-core/image/binding/_image_decode_task.cpp
index 0181628..3c8ed4b 100644
--- a/source/modules/asura-core/image/binding/_image_decode_task.cpp
+++ b/source/modules/asura-core/image/binding/_image_decode_task.cpp
@@ -1,18 +1,19 @@
-#include "../image_decode_task.h"
+#include "../ImageDecodeTask.h"
using namespace std;
namespace_begin(AsuraEngine)
namespace_begin(Image)
+
LUAX_REGISTRY(ImageDecodeTask)
- {
+{
- }
+}
- LUAX_POSTPROCESS(ImageDecodeTask)
- {
+LUAX_POSTPROCESS(ImageDecodeTask)
+{
- }
+}
- }
+}
}
diff --git a/source/modules/asura-core/input/button.h b/source/modules/asura-core/input/button.h
index 78f9b6d..5c3c0de 100644
--- a/source/modules/asura-core/input/button.h
+++ b/source/modules/asura-core/input/button.h
@@ -1,7 +1,7 @@
#ifndef __BUTTON_H__
#define __BUTTON_H__
-#include <asura-utils/classes.h>
+#include <asura-utils/Classes.h>
namespace_begin(AsuraEngine)
namespace_begin(Input)
diff --git a/source/modules/asura-core/threading/channel.h b/source/modules/asura-core/threading/channel.h
deleted file mode 100644
index ede43e4..0000000
--- a/source/modules/asura-core/threading/channel.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef __ASURA_THREAD_CHANNEL_H__
-#define __ASURA_THREAD_CHANNEL_H__
-
-#include <asura-utils/scripting/portable.hpp>
-#include <asura-utils/classes.h>
-
-namespace_begin(AsuraEngine)
-namespace_begin(Threading)
-
-class Channel
-{
-
-};
-
-namespace_end
-namespace_end
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-core/type.h b/source/modules/asura-core/type.h
index 88848d5..39880e2 100644
--- a/source/modules/asura-core/type.h
+++ b/source/modules/asura-core/type.h
@@ -1,5 +1,5 @@
-#ifndef __ASURA_ENGINE_TYPE_H__
-#define __ASURA_ENGINE_TYPE_H__
+#ifndef _ASURA_ENGINE_TYPE_H_
+#define _ASURA_ENGINE_TYPE_H_
#include <stdint.h>
diff --git a/source/modules/asura-core/window/binding/_window.cpp b/source/modules/asura-core/window/binding/_window.cpp
index 7119cd2..1e14a3a 100644
--- a/source/modules/asura-core/window/binding/_window.cpp
+++ b/source/modules/asura-core/window/binding/_window.cpp
@@ -1,6 +1,6 @@
-#include "../../image/image_data.h"
+#include "../../Image/ImageData.h"
-#include "../window.h"
+#include "../Window.h"
using namespace std;
using namespace AEGraphics;
diff --git a/source/modules/asura-core/window/window.cpp b/source/modules/asura-core/window/window.cpp
index bbcb949..adba7c9 100644
--- a/source/modules/asura-core/window/window.cpp
+++ b/source/modules/asura-core/window/window.cpp
@@ -1,10 +1,10 @@
-#include <asura-utils/exceptions/exception.h>
+#include <asura-utils/Exceptions/Exception.h>
#include "window.h"
-#include "window_impl_sdl.h"
-#include "window_impl_glew.h"
-#include "window_impl_glut.h"
+#include "WindowImplSDL.h"
+#include "WindowImplGlew.h"
+#include "WindowImplGlut.h"
namespace_begin(AsuraEngine)
namespace_begin(Window)
diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h
index 872c40f..f5498c1 100644
--- a/source/modules/asura-core/window/window.h
+++ b/source/modules/asura-core/window/window.h
@@ -1,13 +1,13 @@
-#ifndef __ASURA_ENGINE_WINDOW_H__
-#define __ASURA_ENGINE_WINDOW_H__
+#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 <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"
+#include "../Graphics/Image.h"
+#include "../Graphics/RenderState.h"
+#include "../Graphics/RenderTarget.h"
namespace_begin(AsuraEngine)
namespace_begin(Window)