From 1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 19 Mar 2019 23:06:27 +0800 Subject: *rename --- Source/Asura.Engine/Application.cpp | 59 -- Source/Asura.Engine/Application.h | 83 --- Source/Asura.Engine/Asura.h | 15 - Source/Asura.Engine/Audio/Sound.cpp | 0 Source/Asura.Engine/Audio/Sound.h | 27 - Source/Asura.Engine/Config.h | 82 --- Source/Asura.Engine/Exceptions/Exception.cpp | 47 -- Source/Asura.Engine/Exceptions/Exception.h | 43 -- Source/Asura.Engine/FileSystem/Reloadable.h | 27 - .../Asura.Engine/Graphics/Application.Graphics.cpp | 19 - Source/Asura.Engine/Graphics/Canvas.cpp | 41 -- Source/Asura.Engine/Graphics/Canvas.h | 81 --- Source/Asura.Engine/Graphics/Color.cpp | 132 ---- Source/Asura.Engine/Graphics/Color.h | 94 --- Source/Asura.Engine/Graphics/GL.cpp | 11 - Source/Asura.Engine/Graphics/GL.h | 19 - Source/Asura.Engine/Graphics/Image.cpp | 32 - Source/Asura.Engine/Graphics/Image.h | 75 -- Source/Asura.Engine/Graphics/Mesh2D.cpp | 0 Source/Asura.Engine/Graphics/Mesh2D.h | 30 - Source/Asura.Engine/Graphics/Quad.cpp | 0 Source/Asura.Engine/Graphics/Quad.h | 1 - Source/Asura.Engine/Graphics/Shader.cpp | 81 --- Source/Asura.Engine/Graphics/Shader.h | 125 ---- Source/Asura.Engine/Graphics/Shape.cpp | 0 Source/Asura.Engine/Graphics/Shape.h | 0 Source/Asura.Engine/Graphics/Texture.cpp | 26 - Source/Asura.Engine/Graphics/Texture.h | 66 -- Source/Asura.Engine/Graphics/Window.cpp | 56 -- Source/Asura.Engine/Graphics/Window.h | 85 --- Source/Asura.Engine/Input/Clipboard.cpp | 0 Source/Asura.Engine/Input/Clipboard.h | 37 - Source/Asura.Engine/Input/Cursor.cpp | 0 Source/Asura.Engine/Input/Cursor.defs | 25 - Source/Asura.Engine/Input/Cursor.h | 54 -- Source/Asura.Engine/Input/Keyboard.cpp | 0 Source/Asura.Engine/Input/Keyboard.defs | 482 ------------- Source/Asura.Engine/Input/Keyboard.h | 73 -- Source/Asura.Engine/Input/Mouse.cpp | 0 Source/Asura.Engine/Input/Mouse.h | 56 -- Source/Asura.Engine/Manager.hpp | 14 - Source/Asura.Engine/Math/Curve.cpp | 0 Source/Asura.Engine/Math/Curve.h | 0 Source/Asura.Engine/Math/Functions.cpp | 0 Source/Asura.Engine/Math/Functions.h | 0 Source/Asura.Engine/Math/Matrix44.cpp | 0 Source/Asura.Engine/Math/Matrix44.h | 24 - Source/Asura.Engine/Math/Rect.hpp | 32 - Source/Asura.Engine/Math/Rect.inl | 19 - Source/Asura.Engine/Math/Transform.cpp | 0 Source/Asura.Engine/Math/Transform.h | 30 - Source/Asura.Engine/Math/Vector2.hpp | 70 -- Source/Asura.Engine/Math/Vector2.inl | 114 ---- Source/Asura.Engine/Math/Vector3.hpp | 233 ------- Source/Asura.Engine/Math/Vector3.inl | 145 ---- Source/Asura.Engine/Math/Vector4.h | 234 ------- Source/Asura.Engine/Math/Vector4.inl | 152 ----- Source/Asura.Engine/Physics/World.h | 25 - Source/Asura.Engine/Profiler/Stats.cpp | 0 Source/Asura.Engine/Profiler/Stats.h | 0 Source/Asura.Engine/Scripting/Luax.hpp | 18 - Source/Asura.Engine/Scripting/Type.h | 17 - Source/Asura.Engine/Singleton.hpp | 59 -- Source/Asura.Engine/StringMap.cpp | 0 Source/Asura.Engine/StringMap.hpp | 29 - Source/Asura.Engine/Text/Glyph.cpp | 0 Source/Asura.Engine/Text/Glyph.h | 0 Source/Asura.Engine/Text/String.cpp | 376 ----------- Source/Asura.Engine/Text/String.hpp | 594 ---------------- Source/Asura.Engine/Text/String.inl | 29 - Source/Asura.Engine/Text/Utf.hpp | 720 -------------------- Source/Asura.Engine/Text/Utf.inl | 752 --------------------- Source/Asura.Engine/Time/Timer.cpp | 0 Source/Asura.Engine/Time/Timer.h | 0 Source/Asura.Engine/Type.h | 11 - Source/Asura.Engine/application.cpp | 59 -- Source/Asura.Engine/application.h | 83 --- Source/Asura.Engine/asura.h | 15 - Source/Asura.Engine/audio/sound.cpp | 0 Source/Asura.Engine/audio/sound.h | 27 - Source/Asura.Engine/audio/sound_decoder.h | 29 - Source/Asura.Engine/config.h | 82 --- Source/Asura.Engine/exceptions/exception.cpp | 47 -- Source/Asura.Engine/exceptions/exception.h | 43 -- Source/Asura.Engine/filesystem/data_buffer.cpp | 14 - Source/Asura.Engine/filesystem/data_buffer.h | 39 -- Source/Asura.Engine/filesystem/decoded_data.cpp | 20 - Source/Asura.Engine/filesystem/decoded_data.h | 41 -- Source/Asura.Engine/filesystem/reloadable.h | 27 - .../Asura.Engine/filesystem/resource_manager.cpp | 0 Source/Asura.Engine/filesystem/resource_manager.h | 44 -- .../Asura.Engine/graphics/application.graphics.cpp | 19 - .../graphics/binding/canvas.binding.cpp | 0 .../graphics/binding/color.binding.cpp | 0 .../graphics/binding/image.binding.cpp | 0 .../graphics/binding/image_data.binding.cpp | 35 - .../graphics/binding/mesh2d.binding.cpp | 0 .../graphics/binding/mesh2d_data.binding.cpp | 9 - .../graphics/binding/shader.binding.cpp | 119 ---- .../graphics/binding/sprite_batch.binding.cpp | 0 .../graphics/binding/window.binding.cpp | 11 - Source/Asura.Engine/graphics/blend_mode.h | 17 - Source/Asura.Engine/graphics/canvas.cpp | 41 -- Source/Asura.Engine/graphics/canvas.h | 81 --- Source/Asura.Engine/graphics/color.cpp | 132 ---- Source/Asura.Engine/graphics/color.h | 94 --- Source/Asura.Engine/graphics/color_palette.h | 0 Source/Asura.Engine/graphics/gif.cpp | 0 Source/Asura.Engine/graphics/gif.h | 4 - Source/Asura.Engine/graphics/gl.cpp | 11 - Source/Asura.Engine/graphics/gl.h | 19 - Source/Asura.Engine/graphics/image.cpp | 32 - Source/Asura.Engine/graphics/image.h | 75 -- Source/Asura.Engine/graphics/image_data.cpp | 50 -- Source/Asura.Engine/graphics/image_data.h | 62 -- Source/Asura.Engine/graphics/image_decoder.h | 35 - Source/Asura.Engine/graphics/mesh2d.cpp | 0 Source/Asura.Engine/graphics/mesh2d.h | 30 - Source/Asura.Engine/graphics/mesh2d_data.cpp | 0 Source/Asura.Engine/graphics/mesh2d_data.h | 0 Source/Asura.Engine/graphics/pixel_format.h | 91 --- Source/Asura.Engine/graphics/png_decoder.cpp | 19 - Source/Asura.Engine/graphics/png_decoder.h | 27 - Source/Asura.Engine/graphics/quad.cpp | 0 Source/Asura.Engine/graphics/quad.h | 1 - Source/Asura.Engine/graphics/render_state.h | 50 -- Source/Asura.Engine/graphics/render_target.cpp | 0 Source/Asura.Engine/graphics/render_target.h | 54 -- Source/Asura.Engine/graphics/shader.cpp | 81 --- Source/Asura.Engine/graphics/shader.h | 125 ---- Source/Asura.Engine/graphics/shape.cpp | 0 Source/Asura.Engine/graphics/shape.h | 0 Source/Asura.Engine/graphics/sprite_batch.cpp | 0 Source/Asura.Engine/graphics/sprite_batch.h | 28 - Source/Asura.Engine/graphics/stb_decoder.cpp | 65 -- Source/Asura.Engine/graphics/stb_decoder.h | 28 - Source/Asura.Engine/graphics/texture.cpp | 26 - Source/Asura.Engine/graphics/texture.h | 66 -- Source/Asura.Engine/graphics/window.cpp | 56 -- Source/Asura.Engine/graphics/window.h | 85 --- Source/Asura.Engine/input/clipboard.cpp | 0 Source/Asura.Engine/input/clipboard.h | 37 - Source/Asura.Engine/input/cursor.cpp | 0 Source/Asura.Engine/input/cursor.defs | 25 - Source/Asura.Engine/input/cursor.h | 54 -- Source/Asura.Engine/input/input_device.hpp | 30 - Source/Asura.Engine/input/keyboard.cpp | 0 Source/Asura.Engine/input/keyboard.defs | 482 ------------- Source/Asura.Engine/input/keyboard.h | 73 -- Source/Asura.Engine/input/mouse.cpp | 0 Source/Asura.Engine/input/mouse.h | 56 -- Source/Asura.Engine/manager.hpp | 14 - Source/Asura.Engine/math/curve.cpp | 0 Source/Asura.Engine/math/curve.h | 0 Source/Asura.Engine/math/functions.cpp | 0 Source/Asura.Engine/math/functions.h | 0 Source/Asura.Engine/math/matrix44.cpp | 0 Source/Asura.Engine/math/matrix44.h | 24 - Source/Asura.Engine/math/ranged_value.cpp | 0 Source/Asura.Engine/math/ranged_value.h | 0 Source/Asura.Engine/math/rect.hpp | 32 - Source/Asura.Engine/math/rect.inl | 19 - Source/Asura.Engine/math/transform.cpp | 0 Source/Asura.Engine/math/transform.h | 30 - Source/Asura.Engine/math/vector2.hpp | 70 -- Source/Asura.Engine/math/vector2.inl | 114 ---- Source/Asura.Engine/math/vector3.hpp | 233 ------- Source/Asura.Engine/math/vector3.inl | 145 ---- Source/Asura.Engine/math/vector4.h | 234 ------- Source/Asura.Engine/math/vector4.inl | 152 ----- Source/Asura.Engine/physics/world.h | 25 - Source/Asura.Engine/profiler/stats.cpp | 0 Source/Asura.Engine/profiler/stats.h | 0 Source/Asura.Engine/scripting/luax.hpp | 18 - Source/Asura.Engine/scripting/portable.hpp | 49 -- Source/Asura.Engine/scripting/portable.inl | 31 - Source/Asura.Engine/scripting/type.h | 17 - Source/Asura.Engine/singleton.hpp | 59 -- Source/Asura.Engine/stringmap.cpp | 0 Source/Asura.Engine/stringmap.hpp | 29 - Source/Asura.Engine/text/glyph.cpp | 0 Source/Asura.Engine/text/glyph.h | 0 Source/Asura.Engine/text/string.cpp | 376 ----------- Source/Asura.Engine/text/string.hpp | 594 ---------------- Source/Asura.Engine/text/string.inl | 29 - Source/Asura.Engine/text/ttf.cpp | 0 Source/Asura.Engine/text/ttf.h | 17 - Source/Asura.Engine/text/utf.hpp | 720 -------------------- Source/Asura.Engine/text/utf.inl | 752 --------------------- Source/Asura.Engine/time/timer.cpp | 0 Source/Asura.Engine/time/timer.h | 0 Source/Asura.Engine/type.h | 11 - 192 files changed, 12580 deletions(-) delete mode 100644 Source/Asura.Engine/Application.cpp delete mode 100644 Source/Asura.Engine/Application.h delete mode 100644 Source/Asura.Engine/Asura.h delete mode 100644 Source/Asura.Engine/Audio/Sound.cpp delete mode 100644 Source/Asura.Engine/Audio/Sound.h delete mode 100644 Source/Asura.Engine/Config.h delete mode 100644 Source/Asura.Engine/Exceptions/Exception.cpp delete mode 100644 Source/Asura.Engine/Exceptions/Exception.h delete mode 100644 Source/Asura.Engine/FileSystem/Reloadable.h delete mode 100644 Source/Asura.Engine/Graphics/Application.Graphics.cpp delete mode 100644 Source/Asura.Engine/Graphics/Canvas.cpp delete mode 100644 Source/Asura.Engine/Graphics/Canvas.h delete mode 100644 Source/Asura.Engine/Graphics/Color.cpp delete mode 100644 Source/Asura.Engine/Graphics/Color.h delete mode 100644 Source/Asura.Engine/Graphics/GL.cpp delete mode 100644 Source/Asura.Engine/Graphics/GL.h delete mode 100644 Source/Asura.Engine/Graphics/Image.cpp delete mode 100644 Source/Asura.Engine/Graphics/Image.h delete mode 100644 Source/Asura.Engine/Graphics/Mesh2D.cpp delete mode 100644 Source/Asura.Engine/Graphics/Mesh2D.h delete mode 100644 Source/Asura.Engine/Graphics/Quad.cpp delete mode 100644 Source/Asura.Engine/Graphics/Quad.h delete mode 100644 Source/Asura.Engine/Graphics/Shader.cpp delete mode 100644 Source/Asura.Engine/Graphics/Shader.h delete mode 100644 Source/Asura.Engine/Graphics/Shape.cpp delete mode 100644 Source/Asura.Engine/Graphics/Shape.h delete mode 100644 Source/Asura.Engine/Graphics/Texture.cpp delete mode 100644 Source/Asura.Engine/Graphics/Texture.h delete mode 100644 Source/Asura.Engine/Graphics/Window.cpp delete mode 100644 Source/Asura.Engine/Graphics/Window.h delete mode 100644 Source/Asura.Engine/Input/Clipboard.cpp delete mode 100644 Source/Asura.Engine/Input/Clipboard.h delete mode 100644 Source/Asura.Engine/Input/Cursor.cpp delete mode 100644 Source/Asura.Engine/Input/Cursor.defs delete mode 100644 Source/Asura.Engine/Input/Cursor.h delete mode 100644 Source/Asura.Engine/Input/Keyboard.cpp delete mode 100644 Source/Asura.Engine/Input/Keyboard.defs delete mode 100644 Source/Asura.Engine/Input/Keyboard.h delete mode 100644 Source/Asura.Engine/Input/Mouse.cpp delete mode 100644 Source/Asura.Engine/Input/Mouse.h delete mode 100644 Source/Asura.Engine/Manager.hpp delete mode 100644 Source/Asura.Engine/Math/Curve.cpp delete mode 100644 Source/Asura.Engine/Math/Curve.h delete mode 100644 Source/Asura.Engine/Math/Functions.cpp delete mode 100644 Source/Asura.Engine/Math/Functions.h delete mode 100644 Source/Asura.Engine/Math/Matrix44.cpp delete mode 100644 Source/Asura.Engine/Math/Matrix44.h delete mode 100644 Source/Asura.Engine/Math/Rect.hpp delete mode 100644 Source/Asura.Engine/Math/Rect.inl delete mode 100644 Source/Asura.Engine/Math/Transform.cpp delete mode 100644 Source/Asura.Engine/Math/Transform.h delete mode 100644 Source/Asura.Engine/Math/Vector2.hpp delete mode 100644 Source/Asura.Engine/Math/Vector2.inl delete mode 100644 Source/Asura.Engine/Math/Vector3.hpp delete mode 100644 Source/Asura.Engine/Math/Vector3.inl delete mode 100644 Source/Asura.Engine/Math/Vector4.h delete mode 100644 Source/Asura.Engine/Math/Vector4.inl delete mode 100644 Source/Asura.Engine/Physics/World.h delete mode 100644 Source/Asura.Engine/Profiler/Stats.cpp delete mode 100644 Source/Asura.Engine/Profiler/Stats.h delete mode 100644 Source/Asura.Engine/Scripting/Luax.hpp delete mode 100644 Source/Asura.Engine/Scripting/Type.h delete mode 100644 Source/Asura.Engine/Singleton.hpp delete mode 100644 Source/Asura.Engine/StringMap.cpp delete mode 100644 Source/Asura.Engine/StringMap.hpp delete mode 100644 Source/Asura.Engine/Text/Glyph.cpp delete mode 100644 Source/Asura.Engine/Text/Glyph.h delete mode 100644 Source/Asura.Engine/Text/String.cpp delete mode 100644 Source/Asura.Engine/Text/String.hpp delete mode 100644 Source/Asura.Engine/Text/String.inl delete mode 100644 Source/Asura.Engine/Text/Utf.hpp delete mode 100644 Source/Asura.Engine/Text/Utf.inl delete mode 100644 Source/Asura.Engine/Time/Timer.cpp delete mode 100644 Source/Asura.Engine/Time/Timer.h delete mode 100644 Source/Asura.Engine/Type.h delete mode 100644 Source/Asura.Engine/application.cpp delete mode 100644 Source/Asura.Engine/application.h delete mode 100644 Source/Asura.Engine/asura.h delete mode 100644 Source/Asura.Engine/audio/sound.cpp delete mode 100644 Source/Asura.Engine/audio/sound.h delete mode 100644 Source/Asura.Engine/audio/sound_decoder.h delete mode 100644 Source/Asura.Engine/config.h delete mode 100644 Source/Asura.Engine/exceptions/exception.cpp delete mode 100644 Source/Asura.Engine/exceptions/exception.h delete mode 100644 Source/Asura.Engine/filesystem/data_buffer.cpp delete mode 100644 Source/Asura.Engine/filesystem/data_buffer.h delete mode 100644 Source/Asura.Engine/filesystem/decoded_data.cpp delete mode 100644 Source/Asura.Engine/filesystem/decoded_data.h delete mode 100644 Source/Asura.Engine/filesystem/reloadable.h delete mode 100644 Source/Asura.Engine/filesystem/resource_manager.cpp delete mode 100644 Source/Asura.Engine/filesystem/resource_manager.h delete mode 100644 Source/Asura.Engine/graphics/application.graphics.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/canvas.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/color.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/image.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/image_data.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/shader.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/binding/window.binding.cpp delete mode 100644 Source/Asura.Engine/graphics/blend_mode.h delete mode 100644 Source/Asura.Engine/graphics/canvas.cpp delete mode 100644 Source/Asura.Engine/graphics/canvas.h delete mode 100644 Source/Asura.Engine/graphics/color.cpp delete mode 100644 Source/Asura.Engine/graphics/color.h delete mode 100644 Source/Asura.Engine/graphics/color_palette.h delete mode 100644 Source/Asura.Engine/graphics/gif.cpp delete mode 100644 Source/Asura.Engine/graphics/gif.h delete mode 100644 Source/Asura.Engine/graphics/gl.cpp delete mode 100644 Source/Asura.Engine/graphics/gl.h delete mode 100644 Source/Asura.Engine/graphics/image.cpp delete mode 100644 Source/Asura.Engine/graphics/image.h delete mode 100644 Source/Asura.Engine/graphics/image_data.cpp delete mode 100644 Source/Asura.Engine/graphics/image_data.h delete mode 100644 Source/Asura.Engine/graphics/image_decoder.h delete mode 100644 Source/Asura.Engine/graphics/mesh2d.cpp delete mode 100644 Source/Asura.Engine/graphics/mesh2d.h delete mode 100644 Source/Asura.Engine/graphics/mesh2d_data.cpp delete mode 100644 Source/Asura.Engine/graphics/mesh2d_data.h delete mode 100644 Source/Asura.Engine/graphics/pixel_format.h delete mode 100644 Source/Asura.Engine/graphics/png_decoder.cpp delete mode 100644 Source/Asura.Engine/graphics/png_decoder.h delete mode 100644 Source/Asura.Engine/graphics/quad.cpp delete mode 100644 Source/Asura.Engine/graphics/quad.h delete mode 100644 Source/Asura.Engine/graphics/render_state.h delete mode 100644 Source/Asura.Engine/graphics/render_target.cpp delete mode 100644 Source/Asura.Engine/graphics/render_target.h delete mode 100644 Source/Asura.Engine/graphics/shader.cpp delete mode 100644 Source/Asura.Engine/graphics/shader.h delete mode 100644 Source/Asura.Engine/graphics/shape.cpp delete mode 100644 Source/Asura.Engine/graphics/shape.h delete mode 100644 Source/Asura.Engine/graphics/sprite_batch.cpp delete mode 100644 Source/Asura.Engine/graphics/sprite_batch.h delete mode 100644 Source/Asura.Engine/graphics/stb_decoder.cpp delete mode 100644 Source/Asura.Engine/graphics/stb_decoder.h delete mode 100644 Source/Asura.Engine/graphics/texture.cpp delete mode 100644 Source/Asura.Engine/graphics/texture.h delete mode 100644 Source/Asura.Engine/graphics/window.cpp delete mode 100644 Source/Asura.Engine/graphics/window.h delete mode 100644 Source/Asura.Engine/input/clipboard.cpp delete mode 100644 Source/Asura.Engine/input/clipboard.h delete mode 100644 Source/Asura.Engine/input/cursor.cpp delete mode 100644 Source/Asura.Engine/input/cursor.defs delete mode 100644 Source/Asura.Engine/input/cursor.h delete mode 100644 Source/Asura.Engine/input/input_device.hpp delete mode 100644 Source/Asura.Engine/input/keyboard.cpp delete mode 100644 Source/Asura.Engine/input/keyboard.defs delete mode 100644 Source/Asura.Engine/input/keyboard.h delete mode 100644 Source/Asura.Engine/input/mouse.cpp delete mode 100644 Source/Asura.Engine/input/mouse.h delete mode 100644 Source/Asura.Engine/manager.hpp delete mode 100644 Source/Asura.Engine/math/curve.cpp delete mode 100644 Source/Asura.Engine/math/curve.h delete mode 100644 Source/Asura.Engine/math/functions.cpp delete mode 100644 Source/Asura.Engine/math/functions.h delete mode 100644 Source/Asura.Engine/math/matrix44.cpp delete mode 100644 Source/Asura.Engine/math/matrix44.h delete mode 100644 Source/Asura.Engine/math/ranged_value.cpp delete mode 100644 Source/Asura.Engine/math/ranged_value.h delete mode 100644 Source/Asura.Engine/math/rect.hpp delete mode 100644 Source/Asura.Engine/math/rect.inl delete mode 100644 Source/Asura.Engine/math/transform.cpp delete mode 100644 Source/Asura.Engine/math/transform.h delete mode 100644 Source/Asura.Engine/math/vector2.hpp delete mode 100644 Source/Asura.Engine/math/vector2.inl delete mode 100644 Source/Asura.Engine/math/vector3.hpp delete mode 100644 Source/Asura.Engine/math/vector3.inl delete mode 100644 Source/Asura.Engine/math/vector4.h delete mode 100644 Source/Asura.Engine/math/vector4.inl delete mode 100644 Source/Asura.Engine/physics/world.h delete mode 100644 Source/Asura.Engine/profiler/stats.cpp delete mode 100644 Source/Asura.Engine/profiler/stats.h delete mode 100644 Source/Asura.Engine/scripting/luax.hpp delete mode 100644 Source/Asura.Engine/scripting/portable.hpp delete mode 100644 Source/Asura.Engine/scripting/portable.inl delete mode 100644 Source/Asura.Engine/scripting/type.h delete mode 100644 Source/Asura.Engine/singleton.hpp delete mode 100644 Source/Asura.Engine/stringmap.cpp delete mode 100644 Source/Asura.Engine/stringmap.hpp delete mode 100644 Source/Asura.Engine/text/glyph.cpp delete mode 100644 Source/Asura.Engine/text/glyph.h delete mode 100644 Source/Asura.Engine/text/string.cpp delete mode 100644 Source/Asura.Engine/text/string.hpp delete mode 100644 Source/Asura.Engine/text/string.inl delete mode 100644 Source/Asura.Engine/text/ttf.cpp delete mode 100644 Source/Asura.Engine/text/ttf.h delete mode 100644 Source/Asura.Engine/text/utf.hpp delete mode 100644 Source/Asura.Engine/text/utf.inl delete mode 100644 Source/Asura.Engine/time/timer.cpp delete mode 100644 Source/Asura.Engine/time/timer.h delete mode 100644 Source/Asura.Engine/type.h (limited to 'Source/Asura.Engine') diff --git a/Source/Asura.Engine/Application.cpp b/Source/Asura.Engine/Application.cpp deleted file mode 100644 index 598bca8..0000000 --- a/Source/Asura.Engine/Application.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "Sdl2/SDL.h" -#include "Exceptions/Exception.h" -#include "Scripting/Luax.hpp" -#include "Application.h" - -using namespace Luax; - -namespace AsuraEngine -{ - - Application::Application() - { - - } - - Application::~Application() - { - - } - - bool Application::InitSubModules(uint flag) - { - // 初始化子模块 - #define TryInitSubModule(module_name, func_name) \ - if((flag&ASURA_MODULE_##module_name) && !Application::Init##func_name()) \ - throw Exception("Asura init submodule %s failed.", #module_name); - - TryInitSubModule(GRAPHICS, Graphics); - TryInitSubModule(AUDIO, Audio); - TryInitSubModule(FONT, Font); - TryInitSubModule(INPUT, Input); - TryInitSubModule(MATH, Math); - TryInitSubModule(PHYSICS, Physics); - TryInitSubModule(TIME, Time); - TryInitSubModule(WINDOW, Window); - - } - - void Application::PortToLua() - { - LuaxState state(mLuaState); - -#define RegisterLuaFactory(T) state.RegisterFactory(); - - state.SetToGlobalNamespace(); - state.PushNamespace("AsuraEngine"); - - RegisterLuaFactory(AEGraphics::Image>); - -#ifdef ASURA_AUTHOR - state.PushNamespace("Version"); - - state.PopNamespace(); // AsuraEngine.Version -#endif - - state.PopNamespace(); // AsuraEngine - } - -} \ No newline at end of file diff --git a/Source/Asura.Engine/Application.h b/Source/Asura.Engine/Application.h deleted file mode 100644 index a260cf8..0000000 --- a/Source/Asura.Engine/Application.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ASURA_ENGINE_APPLICATION_H__ -#define __ASURA_ENGINE_APPLICATION_H__ - -#include "scripting/portable.hpp" -#include "config.h" - -namespace 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 - }; - - /// - /// 管理主循环 - /// - ASURA_ABSTRACT class Application - { - public: - - Application(); - - virtual ~Application(); - - /// - /// 初始化进入前的子系统 - /// - bool InitSubModules(uint flag = ASURA_MODULE_ALL); - - /// - /// 注册lua类,可以被重载,自定义导出的类 - /// - virtual void PortToLua(); - - /// - /// 进入入口 - /// - virtual void Run(int argc, char* args[]); - - /// - /// 退出run时的处理 - /// - virtual void Exit(); - - private: - - /// - /// 子模块初始化函数,在各自模块的文件夹下面实现。 - /// - bool InitGraphics(); - bool InitAudio(); - bool InitFont(); - bool InitInput(); - bool InitMath(); - bool InitPhysics(); - bool InitTime(); - bool InitWindow(); - - /// - /// Lua state. - /// - lua_State* mLuaState; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Asura.h b/Source/Asura.Engine/Asura.h deleted file mode 100644 index 5ca56f3..0000000 --- a/Source/Asura.Engine/Asura.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASURA_ENGINE_H__ -#define __ASURA_ENGINE_H__ - -#include "Application.h" - -#include "Graphics/Shader.h" - -//namespace AEGraphics = AsuraEngine::Graphics; -//namespace AEMath = AsuraEngine::Math; -//namespace AETime = AsuraEngine::Time; -//namespace AEInput = AsuraEngine::Input; -//namespace AEProfiler = AsuraEngine::Profiler; -//namespace AEFont = AsuraEngine::Font; - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Audio/Sound.cpp b/Source/Asura.Engine/Audio/Sound.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Audio/Sound.h b/Source/Asura.Engine/Audio/Sound.h deleted file mode 100644 index 095bdb7..0000000 --- a/Source/Asura.Engine/Audio/Sound.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_SOUND_H__ -#define __ASURA_ENGINE_SOUND_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Audio - { - - class Sound ASURA_FINAL: virtual public Scripting::Portable - { - public: - - Sound(); - ~Sound(); - - private: - - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Config.h b/Source/Asura.Engine/Config.h deleted file mode 100644 index f02a2ba..0000000 --- a/Source/Asura.Engine/Config.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __ASURA_CONFIG_H__ -#define __ASURA_CONFIG_H__ - -namespace AsuraEngine -{ - - //---------------------------------------------------------------------------------------------------------------- - // 基本类型 - - typedef int8_t int8; - typedef uint8_t uint8; - typedef uint8 byte; - typedef int16_t int16; - typedef uint16_t uint16; - typedef int32_t int32; - typedef uint32_t uint32; - typedef int64_t int64; - typedef uint64_t uint64; - - typedef uint32_t uint; - typedef int32_t sint; - - typedef std::size_t size_t; - - //---------------------------------------------------------------------------------------------------------------- - // assert - -#ifndef ASSERT - #ifdef NDEBUG - #define ASSERT(x) { false ? (void)(x) : (void)0; } - #else - #ifdef _WIN32 - #define ASURA_DEBUG_BREAK() __debugbreak() - #else - #define ASURA_DEBUG_BREAK() raise(SIGTRAP) - #endif - #define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) - #endif -#endif - - //---------------------------------------------------------------------------------------------------------------- - // 导出定义 - -#ifdef _WIN32 - #define ASURA_FINAL final - #define ASURA_LIBRARY_EXPORT __declspec(dllexport) - #define ASURA_LIBRARY_IMPORT __declspec(dllimport) - #define ASURA_FORCE_INLINE __forceinline - #define ASURA_RESTRICT __restrict - #define ASURA_ATTRIBUTE_USED - #define ASURA_ABSTRACT - #define ASURA_API ASURA_LIBRARY_EXPORT -#else - #define ASURA_FINAL final - #define ASURA_LIBRARY_EXPORT __attribute__((visibility("default"))) - #define ASURA_LIBRARY_IMPORT - #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline - #define ASURA_RESTRICT __restrict__ - #define ASURA_ATTRIBUTE_USED __attribute__((used)) - #define ASURA_ABSTRACT - #define ASURA_API ASURA_LIBRARY_EXPORT -#endif - - //---------------------------------------------------------------------------------------------------------------- - // 默认入口 - -#define ASURA_RUN(App) \ -int main(int argc, char* args[]) \ -{ \ - App app; \ - app.InitSubModules(); \ - app.PortToLua(); \ - app.Run(argc, args); \ - return 0; \ -} - - //---------------------------------------------------------------------------------------------------------------- - // - -} // namespace AsuraEngine - -#endif // __ASURA_CONFIG_H__ \ No newline at end of file diff --git a/Source/Asura.Engine/Exceptions/Exception.cpp b/Source/Asura.Engine/Exceptions/Exception.cpp deleted file mode 100644 index dbb36ca..0000000 --- a/Source/Asura.Engine/Exceptions/Exception.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Exception.h" - -#include -#include - -namespace AsuraEngine -{ - - Exception::Exception(const char *fmt, ...) - { - va_list args; - int size_buffer = 256, size_out; - char *buffer; - while (true) - { - buffer = new char[size_buffer]; - memset(buffer, 0, size_buffer); - - va_start(args, fmt); - size_out = vsnprintf(buffer, size_buffer, fmt, args); - va_end(args); - - // see http://perfec.to/vsnprintf/pasprintf.c - // if size_out ... - // == -1 --> output was truncated - // == size_buffer --> output was truncated - // == size_buffer-1 --> ambiguous, /may/ have been truncated - // > size_buffer --> output was truncated, and size_out - // bytes would have been written - if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1) - size_buffer *= 2; - else if (size_out > size_buffer) - size_buffer = size_out + 2; // to avoid the ambiguous case - else - break; - - delete[] buffer; - } - message = std::string(buffer); - delete[] buffer; - } - - Exception::~Exception() throw() - { - } - -} diff --git a/Source/Asura.Engine/Exceptions/Exception.h b/Source/Asura.Engine/Exceptions/Exception.h deleted file mode 100644 index bed8a9a..0000000 --- a/Source/Asura.Engine/Exceptions/Exception.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __ASURA_ENGINE_EXCEPTION_H__ -#define __ASURA_ENGINE_EXCEPTION_H__ - -#include - -namespace AsuraEngine -{ - - /** - * A convenient vararg-enabled exception class. - **/ - class Exception : public std::exception - { - public: - - /** - * Creates a new Exception according to printf-rules. - * - * See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ - * - * @param fmt The format string (see printf). - **/ - Exception(const char *fmt, ...); - virtual ~Exception() throw(); - - /** - * Returns a string containing reason for the exception. - * @return A description of the exception. - **/ - inline virtual const char *what() const throw() - { - return message.c_str(); - } - - private: - - std::string message; - - }; // Exception - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/FileSystem/Reloadable.h b/Source/Asura.Engine/FileSystem/Reloadable.h deleted file mode 100644 index eb35d3e..0000000 --- a/Source/Asura.Engine/FileSystem/Reloadable.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_RELOADABLE_H__ -#define __ASURA_ENGINE_RELOADABLE_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 可以重新构建的数据结构。比如图片、音频这种,从外部数据可以直接构建,可以在编辑器内重新构建,适用于不改变handle的资源。 - /// - ASURA_ABSTRACT class Reloadable - { - public: - Reloadable(); - virtual ~Reloadable(); - - // 继承Reloadable的需要提供一个load方法 - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Application.Graphics.cpp b/Source/Asura.Engine/Graphics/Application.Graphics.cpp deleted file mode 100644 index 4d3102f..0000000 --- a/Source/Asura.Engine/Graphics/Application.Graphics.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Application.h" -#include "Sdl2/SDL.h" -#include "Exceptions/Exception.h" - -namespace AsuraEngine -{ - - /// - /// 初始化graphics模块 - /// - bool Application::InitGraphics() - { - - if (SDL_Init(SDL_INIT_VIDEO) < 0) - return false; - - } - -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Canvas.cpp b/Source/Asura.Engine/Graphics/Canvas.cpp deleted file mode 100644 index 61787b6..0000000 --- a/Source/Asura.Engine/Graphics/Canvas.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "Canvas.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Canvas::Canvas() - : Texture() - , mWidth(0) - , mHeight(0) - { - glGenFramebuffers(1, &mFBO); - GLint current_fbo; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureHandle, 0); - glBindFramebuffer(GL_FRAMEBUFFER, current_fbo); - } - - void Canvas::SetSize(uint w, uint h) - { - GLint current_tex; - glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_tex); - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - - glBindTexture(GL_TEXTURE_2D, current_tex); - } - - void Canvas::Bind() - { - - } - - void Canvas::Unbind() - { - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Canvas.h b/Source/Asura.Engine/Graphics/Canvas.h deleted file mode 100644 index c4e0f65..0000000 --- a/Source/Asura.Engine/Graphics/Canvas.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __ASURA_ENGINE_CANVAS_H__ -#define __ASURA_ENGINE_CANVAS_H__ - -#include - -#include "Math/Rect.hpp" -#include "GL.h" -#include "Texture.h" -#include "RenderTarget.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Canvas也可以称为render texture,自身也可以作为texture渲染。 - /// - class Canvas ASURA_FINAL - : public Drawable - , public RenderTarget - , public Scripting::Portable - { - public: - - Canvas(); - - ~Canvas(); - - /// - /// 设置render texture的大小 - /// - void SetSize(uint w, uint h); - - 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: - - /// - /// Frame buffer object id. - /// - GLuint mFBO; - - /// - /// canvas的大小 - /// - uint mWidth, mHeight; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(SimCanvas); - - LUAX_DECL_METHOD(l_SetSize); - LUAX_DECL_METHOD(l_Bind); - LUAX_DECL_METHOD(l_Unbind); - - //---------------------------------------------------------------------------------------------------------- - - }; - - /// - /// Canvas别名为RenderTexture - /// - using RenderTexture = Canvas; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Color.cpp b/Source/Asura.Engine/Graphics/Color.cpp deleted file mode 100644 index 106493d..0000000 --- a/Source/Asura.Engine/Graphics/Color.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "Color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - 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; - } - - int Color32::l_GetRed(lua_State* L) - { - - } - - int Color32::l_GetGreen(lua_State* L) - { - - } - - int Color32::l_GetBlue(lua_State* L) - { - - } - - int Color32::l_GetAlpha(lua_State* L) - { - - } - - //------------------------------------------------------------------------------------------------------------ - - 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::operator *(const Color& c) - { - r *= c.r; - g *= c.g; - b *= c.b; - a *= c.a; - } - - int Color::l_GetRed(lua_State* L) - { - - } - - int Color::l_GetGreen(lua_State* L) - { - - } - - int Color::l_GetBlue(lua_State* L) - { - - } - - int Color::l_GetAlpha(lua_State* L) - { - - } - - int Color::l_Add(lua_State* L) - { - - } - - int Color::l_Minus(lua_State* L) - { - - } - - int Color::l_Multiply(lua_State* L) - { - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Color.h b/Source/Asura.Engine/Graphics/Color.h deleted file mode 100644 index 0d65cb1..0000000 --- a/Source/Asura.Engine/Graphics/Color.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __ASURA_ENGINE_COLOR_H__ -#define __ASURA_ENGINE_COLOR_H__ - -#include "Scripting/Luax.hpp" -#include "Scripting/Portable.h" -#include "Config.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Color; - - /// - /// 32bits颜色 - /// - class Color32 ASURA_FINAL: public Scripting::Portable - { - public: - - Color32(); - - ~Color32(); - - Color32(const Color32& c); - - Color32(const Color& c); - - Color32(byte r, byte g, byte b, byte a); - - byte r, g, b, a; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Color32); - - LUAX_DECL_METHOD(l_ToColor); - LUAX_DECL_METHOD(l_GetRed); - LUAX_DECL_METHOD(l_GetGreen); - LUAX_DECL_METHOD(l_GetBlue); - LUAX_DECL_METHOD(l_GetAlpha); - LUAX_DECL_METHOD(l_Multiply); - LUAX_DECL_METHOD(l_Index); //索引r,g,b,a - LUAX_DECL_METHOD(l_NewIndex); //修改r,g,b,a - - //---------------------------------------------------------------------------------------------------------- - - }; - - /// - /// 规范化颜色 - /// - class Color ASURA_FINAL: public Scripting::Portable - { - 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); - - float r, g, b, a; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Color); - - LUAX_DECL_METHOD(l_ToColor32); - LUAX_DECL_METHOD(l_SetColor); - LUAX_DECL_METHOD(l_GetColor); - LUAX_DECL_METHOD(l_Multiply); // 颜色乘法 - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/GL.cpp b/Source/Asura.Engine/Graphics/GL.cpp deleted file mode 100644 index dac2ea4..0000000 --- a/Source/Asura.Engine/Graphics/GL.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "OpenGL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/GL.h b/Source/Asura.Engine/Graphics/GL.h deleted file mode 100644 index 0661e17..0000000 --- a/Source/Asura.Engine/Graphics/GL.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ASURA_ENGINE_OPENGL_H__ -#define __ASURA_ENGINE_OPENGL_H__ - -#include "glad/glad.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class OpenGL - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.cpp b/Source/Asura.Engine/Graphics/Image.cpp deleted file mode 100644 index e704945..0000000 --- a/Source/Asura.Engine/Graphics/Image.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Config.h" -#include "Image.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Image::Image() - { - } - - Image::~Image() - { - } - - //创建\更新纹理像素信息 - bool Image::Load(ImageData* data) - { - ASSERT(data); - - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data->pixels); - glBindTexture(GL_TEXTURE_2D, 0); - return true; - - RRA(data, mImageData); - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Image.h b/Source/Asura.Engine/Graphics/Image.h deleted file mode 100644 index 916c365..0000000 --- a/Source/Asura.Engine/Graphics/Image.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_H__ -#define __ASURA_ENGINE_IMAGE_H__ - -#include "math/vector2.hpp" -#include "scripting/portable.hpp" -#include "fileSystem/reloadable.h" -#include "stringmap.hpp" -#include "manager.hpp" -#include "texture.h" -#include "color.h" -#include "image_data.h" -#include "render_state.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageFactory; - - /// - /// Image是图片从内存中载入后,读取进游戏后保存的结果。一个Image在内存、显存中只会保存一份,不会产生副本。需要特征 - /// 化的区别image,如锚点位置,缩放和旋转角度,使用sprite。是一个只读类。主要是考虑到editor和engine使用不同的封装。 - /// - class Image ASURA_FINAL - : public Drawable - , public Scripting::Portable - , public Filesystem::Reloadable - { - public: - - Image(); - - ~Image(); - - /// - /// 从数据buffer构建image像素信息,如果mPixels不为空,先清空数据。用来重新构建image,使用glTexImage2D重新提交image - /// 的像素数据。 - /// - bool Load(ImageData* data); - - uint GetWidth(); - uint GetHeight(); - Math::Vector2u GetSize(); - - /// - /// 获得某一个位置的像素 - /// - Color32 GetPixel(uint x, uint y); - - void Render(const RenderTarget* rt, const RenderState& state) override; - - void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override; - - private: - - ImageData* mImageData; - - Math::Vector2u mSize; - - public: - - LUAX_DECL_FACTORY(SimImage); - - LUAX_DECL_METHOD(l_Load); - LUAX_DECL_METHOD(l_GetWidth); - LUAX_DECL_METHOD(l_GetHeight); - LUAX_DECL_METHOD(l_GetSize); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Mesh2D.cpp b/Source/Asura.Engine/Graphics/Mesh2D.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Mesh2D.h b/Source/Asura.Engine/Graphics/Mesh2D.h deleted file mode 100644 index 2c58f00..0000000 --- a/Source/Asura.Engine/Graphics/Mesh2D.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_MESH2D_H__ -#define __ASURA_ENGINE_MESH2D_H__ - -#include "Scripting/Luax.hpp" - -#include "scripting/portable.hpp" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 2D mesh,用于做一些顶点动画。 - /// - class Mesh2D ASURA_FINAL - : public Scripting::Portable - { - public: - - Mesh2D(); - - ~Mesh2D(); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Quad.cpp b/Source/Asura.Engine/Graphics/Quad.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Quad.h b/Source/Asura.Engine/Graphics/Quad.h deleted file mode 100644 index b7dd3d9..0000000 --- a/Source/Asura.Engine/Graphics/Quad.h +++ /dev/null @@ -1 +0,0 @@ -// Quad和rect的区别在于,rect是的边偏向于轴,quad不一定。 diff --git a/Source/Asura.Engine/Graphics/Shader.cpp b/Source/Asura.Engine/Graphics/Shader.cpp deleted file mode 100644 index 1a85866..0000000 --- a/Source/Asura.Engine/Graphics/Shader.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "Shader.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Shader::Shader() - { - - } - - Shader::~Shader() - { - - } - - bool Shader::Load(const std::string& vertexShader, const std::string& fragmentShader) - { - - } - - uint Shader::GetUniformLocation(const std::string& uniform) - { - - } - - GLuint Shader::GetGLProgramHandle() - { - return mProgramHandle; - } - - void Shader::Use() - { - - } - - void Shader::Unuse() - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformTexture(uint loc, const Texture& texture) - { - - } - - void Shader::SetUniformVector2(uint loc, const Math::Vector2f& vec2) - { - - } - - void Shader::SetUniformVector3(uint loc, const Math::Vector3f& vec3) - { - - } - - void Shader::SetUniformVector4(uint loc, const Math::Vector4f& vec4) - { - - } - - uint Shader::GetGLTextureUnitCount() - { - GLint maxTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); - return (uint)maxTextureUnits; - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Shader.h b/Source/Asura.Engine/Graphics/Shader.h deleted file mode 100644 index 65f214e..0000000 --- a/Source/Asura.Engine/Graphics/Shader.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef __ASURA_ENGINE_SHADER_H__ -#define __ASURA_ENGINE_SHADER_H__ - -#include -#include - -#include "FileSystem/Reloadable.h" -#include "Scripting/Luax.hpp" -#include "Math/Vector2.hpp" -#include "Math/Vector3.hpp" -#include "Math/Vector4.h" -#include "Math/Matrix44.h" -#include "StringMap.hpp" -#include "scripting/portable.hpp" -#include "Color.h" -#include "Manager.hpp" -#include "Texture.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只提供设置uniforms和use着色器的方法。编辑 - /// 器针对每个shader,会通过shader代码找到声明的uniforms变量,并暴露给framework的material设置。 - /// - class Shader ASURA_FINAL - : public Scripting::Portable - , public Filesystem::Reloadable - { - public: - - Shader(); - - ~Shader(); - - /// - /// 从代码编译shader,编译时会先检测是否有上次缓存的uniforms location map。使用glAttachShader重新编译生成着色器, - /// 不会重新申请着色器程序。 - /// - bool Load(const std::string& vertexShader, const std::string& fragmentShader); - - /// - /// 将当期shader设置为活动 - /// - void Use(); - - /// - /// 将当期shader设置为非活动 - /// - void Unuse(); - - /// - /// 在已经知道uniform location的情况下,设置值。 - /// - void SetUniformFloat(uint loc, float value); - void SetUniformTexture(uint loc, const Texture& texture); - 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); - - uint GetUniformLocation(const std::string& uniform); - - bool HasUniform(const std::string& uniform); - - GLuint GetGLProgramHandle(); - - /// - /// 获得texture unit数量,一般为16个 - /// - static uint GetGLTextureUnitCount(); - - private: - - /// - /// 当前活动的shader - /// - static Shader* mCurrentShader; - - /// - /// 设置内置变量: - /// vec2 Asura_Time x值为进入当前场景开始的时间,y值为上一帧的时间间隔 - /// vec2 Asura_RenderTargetSize RT的大小,以像素为单位 - /// Texture Asura_MainTexture 主纹理 - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// - GLuint mProgramHandle; - - //------------------------------------------------------------------------------------------------------------ - - public: - - LUAX_DECL_FACTORY(SimShader); - - LUAX_DECL_METHOD(l_Use); - LUAX_DECL_METHOD(l_Unuse); - LUAX_DECL_METHOD(l_Load); - LUAX_DECL_METHOD(l_HasUniform); - LUAX_DECL_METHOD(l_GetUniformLocation); - LUAX_DECL_METHOD(l_SetBuiltInUniforms); - LUAX_DECL_METHOD(l_SetUniformFloat); - LUAX_DECL_METHOD(l_SetUniformTexture); - LUAX_DECL_METHOD(l_SetUniformVector2); - LUAX_DECL_METHOD(l_SetUniformVector3); - LUAX_DECL_METHOD(l_SetUniformVector4); - LUAX_DECL_METHOD(l_SetUniformColor); - - private: - - Luax::LuaxMemberRef mCodeLuaRef; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Shape.cpp b/Source/Asura.Engine/Graphics/Shape.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Shape.h b/Source/Asura.Engine/Graphics/Shape.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Graphics/Texture.cpp b/Source/Asura.Engine/Graphics/Texture.cpp deleted file mode 100644 index 6cb6497..0000000 --- a/Source/Asura.Engine/Graphics/Texture.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Texture.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Texture::Texture() - : mTextureHandle(0) - { - // 申请GL texture - glGenTextures(1, &mTextureHandle); - } - - Texture::~Texture() - { - glDeleteTextures(1, &mTextureHandle); - } - - GLuint Texture::GetGLTextureHandle() const - { - return mTextureHandle; - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Texture.h b/Source/Asura.Engine/Graphics/Texture.h deleted file mode 100644 index 81aa469..0000000 --- a/Source/Asura.Engine/Graphics/Texture.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __ASURA_ENGINE_TEXTURE_H__ -#define __ASURA_ENGINE_TEXTURE_H__ - -#include "Config.h" -#include "Math/Rect.hpp" -#include "Math/Vector2.hpp" -#include "Scripting/Luax.hpp" -#include "RenderState.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class RenderTarget; - - /// - /// 2D纹理抽象类,在2d mesh和render target中被使用。Texture的渲染原点在左上角,游戏里面的上层会以笛卡尔坐标系为标准。 - /// 在Editor里面界面和组件也是以左上角为原点,这样是为了方便。 - /// - ASURA_ABSTRACT class Texture - { - public: - - Texture(); - - virtual ~Texture(); - - GLuint GetGLTextureHandle() const; - - /// - /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 - /// - virtual void Render(const RenderTarget* rt, const RenderState& state) = 0; - - /// - /// 渲染texture的一部分到rt上,原点在左上角,向右,向下延伸。 - /// - virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; - - /// - /// 设置过滤方式 - /// - void SetSmooth(bool smooth); - - /// - /// 设置重复方式 - /// - void SetRepeated(); - - protected: - - /// - /// OpenGL texture handle。 - /// - GLuint mTextureHandle; - - }; - - using Drawable = Texture; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Graphics/Window.cpp b/Source/Asura.Engine/Graphics/Window.cpp deleted file mode 100644 index bb941e1..0000000 --- a/Source/Asura.Engine/Graphics/Window.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "Config.h" -#include "Window.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Window::Window(WindowStyle style) - { - //mWindowHandle = SDL_CreateWindow(); - } - - Window::~Window() - { - - } - - SDL_Window* Window::GetSDLWindowHandle() - { - return mWindowHandle; - } - - void Window::SetPosition(int x, int y) - { - ASSERT(mWindowHandle); - SDL_SetWindowPosition(mWindowHandle, x, y); - } - - void Window::SetTitle(const std::string& title) - { - - } - - void Window::Show() - { - - } - - void Window::Hide() - { - - } - - void Window::SetWindowStyle(WindowStyle style) - { - - } - - void Window::SwapRenderBuffer() - { - - } - - } -} diff --git a/Source/Asura.Engine/Graphics/Window.h b/Source/Asura.Engine/Graphics/Window.h deleted file mode 100644 index 973fd98..0000000 --- a/Source/Asura.Engine/Graphics/Window.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __ASURA_ENGINE_WINDOW_H__ -#define __ASURA_ENGINE_WINDOW_H__ - -#include "SDL2/Sdl.h" -#include "Graphics/RenderTarget.h" -#include "Math/Vector2.hpp" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - enum WindowStyle - { - WINDOW_STYLE_FULLSCREEN = 1 << 1, - }; - - /// - /// 窗口,支持多窗口。在编辑器下需要多个窗口支持,runner只需要一个窗口。 - /// - class Window ASURA_FINAL - : public RenderTarget - , public Scripting::Portable - { - public: - - Window(WindowStyle style); - - ~Window(); - - SDL_Window* GetSDLWindowHandle(); - - void SetSize(uint width, uint height); - - void SetPosition(int x, int y); - - void SetTitle(const std::string& title); - - void SetWindowStyle(WindowStyle style); - - void Show(); - - void Hide(); - - /// - /// 如果是开启双缓冲的窗口,需要交换缓冲区来展示到前台 - /// - void SwapRenderBuffer(); - - void Clear(const Color& col = Color::Black) override; - - void Clear(const Math::Recti& quad, const Color& col = Color::Black) override; - - void Draw(const Drawable* texture, const RenderState& state) override; - - void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) override; - - private: - - /// - /// SDL window handle. - /// - SDL_Window* mWindowHandle; - - Math::Vector2i mPosition; - - Math::Vector2i mSize; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Window); - - //---------------------------------------------------------------------------------------------------------- - - }; - - using RenderWindow = Window; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Input/Clipboard.cpp b/Source/Asura.Engine/Input/Clipboard.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Input/Clipboard.h b/Source/Asura.Engine/Input/Clipboard.h deleted file mode 100644 index 4cecd55..0000000 --- a/Source/Asura.Engine/Input/Clipboard.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __ASURA_ENGINE_CLIPBOARD_H__ -#define __ASURA_ENGINE_CLIPBOARD_H__ - -#include "Text/String.hpp" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Clipboard ASURA_FINAL : public InputDevice - { - public: - - Clipboard(); - - Text::String GetString(); - - void SetString(const Text::String& text); - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Clipboard); - - //---------------------------------------------------------------------------------------------------------- - - private: - - ~Clipboard(); - - }; - - }; -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Input/Cursor.cpp b/Source/Asura.Engine/Input/Cursor.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Input/Cursor.defs b/Source/Asura.Engine/Input/Cursor.defs deleted file mode 100644 index f8b8492..0000000 --- a/Source/Asura.Engine/Input/Cursor.defs +++ /dev/null @@ -1,25 +0,0 @@ - -// Types of system cursors. -enum SystemCursor -{ - CURSOR_ARROW, - CURSOR_IBEAM, - CURSOR_WAIT, - CURSOR_CROSSHAIR, - CURSOR_WAITARROW, - CURSOR_SIZENWSE, - CURSOR_SIZENESW, - CURSOR_SIZEWE, - CURSOR_SIZENS, - CURSOR_SIZEALL, - CURSOR_NO, - CURSOR_HAND, - CURSOR_MAX_ENUM -}; - -enum CursorType -{ - CURSORTYPE_SYSTEM, - CURSORTYPE_IMAGE, - CURSORTYPE_MAX_ENUM -}; diff --git a/Source/Asura.Engine/Input/Cursor.h b/Source/Asura.Engine/Input/Cursor.h deleted file mode 100644 index 7125869..0000000 --- a/Source/Asura.Engine/Input/Cursor.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __ASURA_ENGINE_CURSOR_H__ -#define __ASURA_ENGINE_CURSOR_H__ - -#include - -#include "Scripting/Portable.h" -#include "Graphics/ImageData.h" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Cursor : public Scripting::Portable - { - public: - - // 鼠标指针的相关枚举 - #include "Cursor.defs" - - Cursor(Graphics::ImageData& imageData, int hotx, int hoty); - Cursor(SystemCursor cursortype); - - ~Cursor(); - - SDL_Cursor* GetHandle() const; - CursorType GetType() const; - SystemCursor GetSystemType() const; - - private: - - SDL_Cursor* mCursorHandle; - - CursorType mType; - SystemCursor mSystemType; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Cursor); - - LUAX_DECL_ENUM(EnumCursorType); - LUAX_DECL_ENUM(EnumSystemCursor); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Input/Keyboard.cpp b/Source/Asura.Engine/Input/Keyboard.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Input/Keyboard.defs b/Source/Asura.Engine/Input/Keyboard.defs deleted file mode 100644 index 8f04dc2..0000000 --- a/Source/Asura.Engine/Input/Keyboard.defs +++ /dev/null @@ -1,482 +0,0 @@ - -/** -* 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/Asura.Engine/Input/Keyboard.h b/Source/Asura.Engine/Input/Keyboard.h deleted file mode 100644 index 488209b..0000000 --- a/Source/Asura.Engine/Input/Keyboard.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __ASURA_INPUT_KEYBOARD_H__ -#define __ASURA_INPUT_KEYBOARD_H__ - -#include - -#include "InputDevice.hpp" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Input - { - - class Keyboard ASURA_FINAL : public InputDevice - { - public: - - // 键盘相关的枚举 - #include "Keyboard.defs" - - Keyboard(); - - void SetKeyRepeat(bool enable); - bool HasKeyRepeat() const; - bool IsDown(const std::vector &keylist) const; - bool IsScancodeDown(const std::vector &scancodelist) const; - - Key GetKeyFromScancode(Scancode scancode) const; - Scancode GetScancodeFromKey(Key key) const; - - void SetTextInput(bool enable); - void SetTextInput(bool enable, double x, double y, double w, double h); - bool HasTextInput() const; - bool HasScreenKeyboard() const; - - bool GetConstant(Scancode in, SDL_Scancode &out); - bool GetConstant(SDL_Scancode in, Scancode &out); - - private: - - ~Keyboard(); - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Keyboard); // 通过AsuraEngine.Keyboard直接访问,没有New方法 - - LUAX_DECL_ENUM(Key); - LUAX_DECL_ENUM(ScanCode); - - LUAX_DECL_METHOD(SetKeyRepeat); - LUAX_DECL_METHOD(HasKeyRepeat); - LUAX_DECL_METHOD(IsDown); - LUAX_DECL_METHOD(IsScancodeDown); - - LUAX_DECL_METHOD(GetKeyFromScancode); - LUAX_DECL_METHOD(GetScancodeFromKey); - - LUAX_DECL_METHOD(SetTextInput); - LUAX_DECL_METHOD(HasTextInput); - LUAX_DECL_METHOD(HasScreenKeyboard); - - LUAX_DECL_METHOD(GetConstant); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Input/Mouse.cpp b/Source/Asura.Engine/Input/Mouse.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Input/Mouse.h b/Source/Asura.Engine/Input/Mouse.h deleted file mode 100644 index 0f34fdd..0000000 --- a/Source/Asura.Engine/Input/Mouse.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __ASURA_ENGINE_MOUSE_H__ -#define __ASURA_ENGINE_MOUSE_H__ - -#include "Cursor.h" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Mouse : public InputDevice - { - public: - - /// - /// 从图片数据中构建鼠标指针或者使用系统指针 - /// - Cursor *CreateCursor(Graphics::ImageData *data, int hotx, int hoty); - Cursor *GetSystemCursor(Cursor::SystemCursor cursortype); - - void SetCursor(Cursor *cursor); - void SetCursor() ; - - Cursor* GetCursor() const; - - bool IsCursorSupported() const; - - double GetX() const; - double GetY() const; - void GetPosition(double &x, double &y) const; - void GetX(double x) ; - void SetY(double y) ; - void SetPosition(double x, double y) ; - void SetVisible(bool visible) ; - bool IsDown(const std::vector &buttons) const; - bool IsVisible() const; - void SetGrabbed(bool grab) ; - bool IsGrabbed() const; - bool SetRelativeMode(bool relative) ; - bool GetRelativeMode() const; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Mouse); - - //---------------------------------------------------------------------------------------------------------- - - private: - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Manager.hpp b/Source/Asura.Engine/Manager.hpp deleted file mode 100644 index 7b4e272..0000000 --- a/Source/Asura.Engine/Manager.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_ENGINE_MANAGER_H__ -#define __ASURA_ENGINE_MANAGER_H__ - -namespace AsuraEngine -{ - - class Manager - { - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Curve.cpp b/Source/Asura.Engine/Math/Curve.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Curve.h b/Source/Asura.Engine/Math/Curve.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Functions.cpp b/Source/Asura.Engine/Math/Functions.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Functions.h b/Source/Asura.Engine/Math/Functions.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Matrix44.cpp b/Source/Asura.Engine/Math/Matrix44.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Matrix44.h b/Source/Asura.Engine/Math/Matrix44.h deleted file mode 100644 index 4ab3c0b..0000000 --- a/Source/Asura.Engine/Math/Matrix44.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __ASURA_ENGINE_MATRIX44_H__ -#define __ASURA_ENGINE_MATRIX44_H__ - -namespace AsuraEngine -{ - namespace Math - { - - /// - /// 4x4矩阵 - /// - class Matrix44 - { - public: - - private: - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Rect.hpp b/Source/Asura.Engine/Math/Rect.hpp deleted file mode 100644 index f635007..0000000 --- a/Source/Asura.Engine/Math/Rect.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __ASURA_ENGINE_RECT_H__ -#define __ASURA_ENGINE_RECT_H__ - -namespace AsuraEngine -{ - namespace Math - { - - template - struct Rect - { - public: - Rect(); - ~Rect(T x, T y, T w, T h); - - template - explicit Rect(const Rect& rect); - - T x, y, w, h; - }; - -#include "Rect.inl" - - // Define the most common types - typedef Rect Recti; - typedef Rect Rectu; - typedef Rect Rectf; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Rect.inl b/Source/Asura.Engine/Math/Rect.inl deleted file mode 100644 index 891a3f8..0000000 --- a/Source/Asura.Engine/Math/Rect.inl +++ /dev/null @@ -1,19 +0,0 @@ -template -inline Rect::Rect() - : x(0) - , y(0) - , w(0) - , h(0) -{ - -} - -template -inline Rect::Rect(T X, T Y, T W, T H) - : x(X) - , y(Y) - , w(W) - , h(H) -{ - -} diff --git a/Source/Asura.Engine/Math/Transform.cpp b/Source/Asura.Engine/Math/Transform.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Math/Transform.h b/Source/Asura.Engine/Math/Transform.h deleted file mode 100644 index 33c3d4b..0000000 --- a/Source/Asura.Engine/Math/Transform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_TRANSFORM_H__ -#define __ASURA_ENGINE_TRANSFORM_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Math - { - - class Transform - { - public: - - void Set(float x, float y, float sx, float sy, float ox, float oy, float r); - - void LoadIdentity(); - - void Move(float dx = 0, float dy = 0); - void Rotate(float r); - void Scale(float sx, float sy); - - float m[16]; //4x4 matrix - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector2.hpp b/Source/Asura.Engine/Math/Vector2.hpp deleted file mode 100644 index df78255..0000000 --- a/Source/Asura.Engine/Math/Vector2.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR2_H__ -#define __ASURA_ENGINE_VECTOR2_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector2 - { - public: - Vector2(); - Vector2(T X, T Y); - - template - explicit Vector2(const Vector2& vector); - - Set(T X, T Y); - - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - }; - - template - Vector2 operator -(const Vector2& right); - - template - Vector2& operator +=(Vector2& left, const Vector2& right); - - template - Vector2& operator -=(Vector2& left, const Vector2& right); - - template - Vector2 operator +(const Vector2& left, const Vector2& right); - - template - Vector2 operator -(const Vector2& left, const Vector2& right); - - template - Vector2 operator *(const Vector2& left, T right); - - template - Vector2 operator *(T left, const Vector2& right); - - template - Vector2& operator *=(Vector2& left, T right); - - template - Vector2 operator /(const Vector2& left, T right); - - template - Vector2& operator /=(Vector2& left, T right); - - template - bool operator ==(const Vector2& left, const Vector2& right); - - template - bool operator !=(const Vector2& left, const Vector2& right); - -#include "Vector2.inl" - - // Define the most common types - typedef Vector2 Vector2i; - typedef Vector2 Vector2u; - typedef Vector2 Vector2f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector2.inl b/Source/Asura.Engine/Math/Vector2.inl deleted file mode 100644 index 9e131a7..0000000 --- a/Source/Asura.Engine/Math/Vector2.inl +++ /dev/null @@ -1,114 +0,0 @@ -template -inline Vector2::Vector2() : - x(0), - y(0) -{ - -} - -template -inline Vector2::Vector2(T X, T Y) : - x(X), - y(Y) -{ - -} - -template -template -inline Vector2::Vector2(const Vector2& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)) -{ -} - -template -inline Vector2::Set(T X, T Y) -{ - x = X; - y = Y; -} - -template -inline Vector2 operator -(const Vector2& right) -{ - return Vector2(-right.x, -right.y); -} - -template -inline Vector2& operator +=(Vector2& left, const Vector2& right) -{ - left.x += right.x; - left.y += right.y; - - return left; -} - -template -inline Vector2& operator -=(Vector2& left, const Vector2& right) -{ - left.x -= right.x; - left.y -= right.y; - - return left; -} - -template -inline Vector2 operator +(const Vector2& left, const Vector2& right) -{ - return Vector2(left.x + right.x, left.y + right.y); -} - -template -inline Vector2 operator -(const Vector2& left, const Vector2& right) -{ - return Vector2(left.x - right.x, left.y - right.y); -} - -template -inline Vector2 operator *(const Vector2& left, T right) -{ - return Vector2(left.x * right, left.y * right); -} - -template -inline Vector2 operator *(T left, const Vector2& right) -{ - return Vector2(right.x * left, right.y * left); -} - -template -inline Vector2& operator *=(Vector2& left, T right) -{ - left.x *= right; - left.y *= right; - - return left; -} - -template -inline Vector2 operator /(const Vector2& left, T right) -{ - return Vector2(left.x / right, left.y / right); -} - -template -inline Vector2& operator /=(Vector2& left, T right) -{ - left.x /= right; - left.y /= right; - - return left; -} - -template -inline bool operator ==(const Vector2& left, const Vector2& right) -{ - return (left.x == right.x) && (left.y == right.y); -} - -template -inline bool operator !=(const Vector2& left, const Vector2& right) -{ - return (left.x != right.x) || (left.y != right.y); -} diff --git a/Source/Asura.Engine/Math/Vector3.hpp b/Source/Asura.Engine/Math/Vector3.hpp deleted file mode 100644 index 2b23406..0000000 --- a/Source/Asura.Engine/Math/Vector3.hpp +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR3_H__ -#define __ASURA_ENGINE_VECTOR3_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector3 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector3(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector3(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector3(T X, T Y, T Z); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template - explicit Vector3(const Vector3& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator -(const Vector3& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator +=(Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator -=(Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator +(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator -(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator *(const Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator *(T left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator *=(Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator /(const Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator /=(Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator ==(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator !=(const Vector3& left, const Vector3& right); - -#include "Vector3.inl" - - // Define the most common types - typedef Vector3 Vector3i; - typedef Vector3 Vector3f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector3.inl b/Source/Asura.Engine/Math/Vector3.inl deleted file mode 100644 index 3a2aa93..0000000 --- a/Source/Asura.Engine/Math/Vector3.inl +++ /dev/null @@ -1,145 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template -inline Vector3::Vector3() : - x(0), - y(0), - z(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3::Vector3(T X, T Y, T Z) : - x(X), - y(Y), - z(Z) -{ - -} - - -//////////////////////////////////////////////////////////// -template -template -inline Vector3::Vector3(const Vector3& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)), - z(static_cast(vector.z)) -{ -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator -(const Vector3& left) -{ - return Vector3(-left.x, -left.y, -left.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator +=(Vector3& left, const Vector3& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator -=(Vector3& left, const Vector3& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator +(const Vector3& left, const Vector3& right) -{ - return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator -(const Vector3& left, const Vector3& right) -{ - return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator *(const Vector3& left, T right) -{ - return Vector3(left.x * right, left.y * right, left.z * right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator *(T left, const Vector3& right) -{ - return Vector3(right.x * left, right.y * left, right.z * left); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator *=(Vector3& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator /(const Vector3& left, T right) -{ - return Vector3(left.x / right, left.y / right, left.z / right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator /=(Vector3& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator ==(const Vector3& left, const Vector3& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator !=(const Vector3& left, const Vector3& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); -} diff --git a/Source/Asura.Engine/Math/Vector4.h b/Source/Asura.Engine/Math/Vector4.h deleted file mode 100644 index 13a9d8a..0000000 --- a/Source/Asura.Engine/Math/Vector4.h +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR4_H__ -#define __ASURA_ENGINE_VECTOR4_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector4 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector4(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector4(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector4(T X, T Y, T Z, T W); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template - explicit Vector4(const Vector4& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - T w; ///< W coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator -(const Vector4& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator +=(Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator -=(Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator +(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator -(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator *(const Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator *(T left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator *=(Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator /(const Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator /=(Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator ==(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator !=(const Vector4& left, const Vector4& right); - -#include "Vector4.inl" - - // Define the most common types - typedef Vector4 Vector4i; - typedef Vector4 Vector4f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector4.inl b/Source/Asura.Engine/Math/Vector4.inl deleted file mode 100644 index 025bfcc..0000000 --- a/Source/Asura.Engine/Math/Vector4.inl +++ /dev/null @@ -1,152 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template -inline Vector4::Vector4() : - x(0), - y(0), - z(0), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4::Vector4(T X, T Y, T Z) : - x(X), - y(Y), - z(Z), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -template -inline Vector4::Vector4(const Vector4& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)), - z(static_cast(vector.z)) - w(static_cast(vector.w)) -{ -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator -(const Vector4& left) -{ - return Vector4(-left.x, -left.y, -left.z, -left.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator +=(Vector4& left, const Vector4& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - left.w += right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator -=(Vector4& left, const Vector4& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - left.w -= right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator +(const Vector4& left, const Vector4& right) -{ - return Vector4(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator -(const Vector4& left, const Vector4& right) -{ - return Vector4(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator *(const Vector4& left, T right) -{ - return Vector4(left.x * right, left.y * right, left.z * right, left.w * right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator *(T left, const Vector4& right) -{ - return Vector4(right.x * left, right.y * left, right.z * left, right.w * left); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator *=(Vector4& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - left.w *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator /(const Vector4& left, T right) -{ - return Vector4(left.x / right, left.y / right, left.z / right, left.w / right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator /=(Vector4& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - left.w /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator ==(const Vector4& left, const Vector4& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z) && (left.w == right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator !=(const Vector4& left, const Vector4& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z) || (left.w != right.w); -} diff --git a/Source/Asura.Engine/Physics/World.h b/Source/Asura.Engine/Physics/World.h deleted file mode 100644 index 971adce..0000000 --- a/Source/Asura.Engine/Physics/World.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __ASURA_ENGINE_WORLD_H__ -#define __ASURA_ENGINE_WORLD_H__ - -#include "Box2D/Box2D.h" -#include "scripting/luax.hpp" - -namespace AsuraEngine -{ - namespace Physics - { - - class World - { - public: - - private: - - LUAX_DECL_FACTORY(SimWorld); //AsuraEngine.SimWorld - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Profiler/Stats.cpp b/Source/Asura.Engine/Profiler/Stats.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Profiler/Stats.h b/Source/Asura.Engine/Profiler/Stats.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Scripting/Luax.hpp b/Source/Asura.Engine/Scripting/Luax.hpp deleted file mode 100644 index 2bb1160..0000000 --- a/Source/Asura.Engine/Scripting/Luax.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __ASURA_ENGINE_LUAX_H__ -#define __ASURA_ENGINE_LUAX_H__ - -/// -/// Scripting with Lua. -/// -extern "C" { -#include "Lua51/lua.h" -#include "Lua51/lauxlib.h" -} -#include "Luax/luax.h" - -/// -/// 暴露给lua的类用poartable派生 -/// -#include "Portable.h" - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Scripting/Type.h b/Source/Asura.Engine/Scripting/Type.h deleted file mode 100644 index 0665810..0000000 --- a/Source/Asura.Engine/Scripting/Type.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_SCRIPTING_TYPE_H__ -#define __ASURA_SCRIPTING_TYPE_H__ - -namespace AsuraEngine -{ - namespace Scripting - { - - class Type - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Singleton.hpp b/Source/Asura.Engine/Singleton.hpp deleted file mode 100644 index 756209a..0000000 --- a/Source/Asura.Engine/Singleton.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __ASURA_SINGLETON_H__ -#define __ASURA_SINGLETON_H__ - -#include "Config.h" - -namespace AsuraEngine -{ - - /// - /// 继承Singleton的类在第一次实例化时保存实例,之后如果再次实例化会报错。 - /// - template - class Singleton - { - public: - - static T* Get() - { - // 如果之前没有创建,在这里立即创建一个并保存 - if (!instance) instance = new T; - // 返回实例 - return instance; - } - - static void Destroy() - { - delete instance; - instance = nullptr; - } - - protected: - - Singleton() - { - // 如果有instance,意味着又创建了一个实例,这是错误的。 - ASSERT(!instance); - // 否则,将本实体作为实例 - instance = static_cast(this); - }; - - virtual ~Singleton() {}; - - static T* instance; - - private: - - Singleton(const Singleton& singleton); - - Singleton& operator = (const Singleton& singleton); - - }; - - // 实例初始化为空 - template - T* Singleton::instance = nullptr; - -} - -#endif // __ASURA_SINGLETON_H__ \ No newline at end of file diff --git a/Source/Asura.Engine/StringMap.cpp b/Source/Asura.Engine/StringMap.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/StringMap.hpp b/Source/Asura.Engine/StringMap.hpp deleted file mode 100644 index ddba128..0000000 --- a/Source/Asura.Engine/StringMap.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ASURA_ENGINE_STRINGMAP_H__ -#define __ASURA_ENGINE_STRINGMAP_H__ - -#include - -namespace AsuraEngine -{ - - /// - /// 一个双向一一对应的映射,用来储存shader uniforms、statemathine state parameter的ID。 - /// - template - class StringMap - { - public: - - bool ContainsKey(const key_type& key); - - bool ContainsString(const String& str); - - std::string GetStringByKey(const key_type& key); - - key_type GetKeyByString(const String& str); - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Text/Glyph.cpp b/Source/Asura.Engine/Text/Glyph.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Text/Glyph.h b/Source/Asura.Engine/Text/Glyph.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Text/String.cpp b/Source/Asura.Engine/Text/String.cpp deleted file mode 100644 index 8c9c55a..0000000 --- a/Source/Asura.Engine/Text/String.cpp +++ /dev/null @@ -1,376 +0,0 @@ -#include "String.hpp" -#include "Utf.hpp" - -namespace AsuraEngine -{ - namespace Text - { - - - //////////////////////////////////////////////////////////// - const std::size_t String::InvalidPos = std::basic_string::npos; - - - //////////////////////////////////////////////////////////// - String::String() - { - } - - - //////////////////////////////////////////////////////////// - String::String(char ansiChar, const std::locale& locale) - { - mString += Utf32::DecodeAnsi(ansiChar, locale); - } - - - //////////////////////////////////////////////////////////// - String::String(wchar_t wideChar) - { - mString += Utf32::DecodeWide(wideChar); - } - - - //////////////////////////////////////////////////////////// - String::String(uint32 utf32Char) - { - mString += utf32Char; - } - - - //////////////////////////////////////////////////////////// - String::String(const char* ansiString, const std::locale& locale) - { - if (ansiString) - { - std::size_t length = strlen(ansiString); - if (length > 0) - { - mString.reserve(length + 1); - Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale); - } - } - } - - - //////////////////////////////////////////////////////////// - String::String(const std::string& ansiString, const std::locale& locale) - { - mString.reserve(ansiString.length() + 1); - Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale); - } - - - //////////////////////////////////////////////////////////// - String::String(const wchar_t* wideString) - { - if (wideString) - { - std::size_t length = std::wcslen(wideString); - if (length > 0) - { - mString.reserve(length + 1); - Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString)); - } - } - } - - - //////////////////////////////////////////////////////////// - String::String(const std::wstring& wideString) - { - mString.reserve(wideString.length() + 1); - Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString)); - } - - - //////////////////////////////////////////////////////////// - String::String(const uint32* utf32String) - { - if (utf32String) - mString = utf32String; - } - - - //////////////////////////////////////////////////////////// - String::String(const std::basic_string& utf32String) : - mString(utf32String) - { - } - - - //////////////////////////////////////////////////////////// - String::String(const String& copy) : - mString(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(mString.length() + 1); - - // Convert - Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::wstring String::ToWideString() const - { - // Prepare the output string - std::wstring output; - output.reserve(mString.length() + 1); - - // Convert - Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf8() const - { - // Prepare the output string - std::basic_string output; - output.reserve(mString.length()); - - // Convert - Utf32::ToUtf8(mString.begin(), mString.end(), std::back_inserter(output)); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf16() const - { - // Prepare the output string - std::basic_string output; - output.reserve(mString.length()); - - // Convert - Utf32::ToUtf16(mString.begin(), mString.end(), std::back_inserter(output)); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf32() const - { - return mString; - } - - - //////////////////////////////////////////////////////////// - String& String::operator =(const String& right) - { - mString = right.mString; - return *this; - } - - - //////////////////////////////////////////////////////////// - String& String::operator +=(const String& right) - { - mString += right.mString; - return *this; - } - - - //////////////////////////////////////////////////////////// - uint32 String::operator [](std::size_t index) const - { - return mString[index]; - } - - - //////////////////////////////////////////////////////////// - uint32& String::operator [](std::size_t index) - { - return mString[index]; - } - - - //////////////////////////////////////////////////////////// - void String::Clear() - { - mString.clear(); - } - - - //////////////////////////////////////////////////////////// - std::size_t String::GetSize() const - { - return mString.size(); - } - - - //////////////////////////////////////////////////////////// - bool String::IsEmpty() const - { - return mString.empty(); - } - - - //////////////////////////////////////////////////////////// - void String::Erase(std::size_t position, std::size_t count) - { - mString.erase(position, count); - } - - - //////////////////////////////////////////////////////////// - void String::Insert(std::size_t position, const String& str) - { - mString.insert(position, str.mString); - } - - - //////////////////////////////////////////////////////////// - std::size_t String::Find(const String& str, std::size_t start) const - { - return mString.find(str.mString, start); - } - - - //////////////////////////////////////////////////////////// - void String::Replace(std::size_t position, std::size_t length, const String& replaceWith) - { - mString.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 mString.substr(position, length); - } - - - //////////////////////////////////////////////////////////// - const uint32* String::GetData() const - { - return mString.c_str(); - } - - - //////////////////////////////////////////////////////////// - String::Iterator String::Begin() - { - return mString.begin(); - } - - - //////////////////////////////////////////////////////////// - String::ConstIterator String::Begin() const - { - return mString.begin(); - } - - - //////////////////////////////////////////////////////////// - String::Iterator String::End() - { - return mString.end(); - } - - - //////////////////////////////////////////////////////////// - String::ConstIterator String::End() const - { - return mString.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/Asura.Engine/Text/String.hpp b/Source/Asura.Engine/Text/String.hpp deleted file mode 100644 index 226735b..0000000 --- a/Source/Asura.Engine/Text/String.hpp +++ /dev/null @@ -1,594 +0,0 @@ -#ifndef __ASURA_ENGINE_STRING_H__ -#define __ASURA_ENGINE_STRING_H__ - -#include "Config.h" -#include -#include -#include - -namespace AsuraEngine -{ - namespace Text - { - - - //////////////////////////////////////////////////////////// - /// \brief Utility string class that automatically handles - /// conversions between types and encodings - /// - //////////////////////////////////////////////////////////// - class String - { - public: - - //////////////////////////////////////////////////////////// - // Types - //////////////////////////////////////////////////////////// - typedef std::basic_string::iterator Iterator; ///< Iterator type - typedef std::basic_string::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& 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 - 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 - 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. - /// - /// \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 - 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 ToUtf8() const; - - //////////////////////////////////////////////////////////// - /// \brief Convert the Unicode string to a UTF-16 string - /// - /// \return Converted UTF-16 string - /// - /// \see toUtf8, toUtf32 - /// - //////////////////////////////////////////////////////////// - std::basic_string 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 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 mString; ///< 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.inl" - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/Text/String.inl b/Source/Asura.Engine/Text/String.inl deleted file mode 100644 index ef18228..0000000 --- a/Source/Asura.Engine/Text/String.inl +++ /dev/null @@ -1,29 +0,0 @@ - -//////////////////////////////////////////////////////////// -template -String String::fromUtf8(T begin, T end) -{ - String string; - Utf8::toUtf32(begin, end, std::back_inserter(string.m_string)); - return string; -} - - -//////////////////////////////////////////////////////////// -template -String String::fromUtf16(T begin, T end) -{ - String string; - Utf16::toUtf32(begin, end, std::back_inserter(string.m_string)); - return string; -} - - -//////////////////////////////////////////////////////////// -template -String String::fromUtf32(T begin, T end) -{ - String string; - string.m_string.assign(begin, end); - return string; -} diff --git a/Source/Asura.Engine/Text/Utf.hpp b/Source/Asura.Engine/Text/Utf.hpp deleted file mode 100644 index 2e04ee4..0000000 --- a/Source/Asura.Engine/Text/Utf.hpp +++ /dev/null @@ -1,720 +0,0 @@ -#ifndef __ASURA_UTF_HPP__ -#define __ASURA_UTF_HPP__ - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include -#include -#include -#include - -namespace AsuraEngine -{ - namespace Text - { - - template - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); - }; - -#include "Utf.inl" - - // 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/Asura.Engine/Text/Utf.inl b/Source/Asura.Engine/Text/Utf.inl deleted file mode 100644 index 69a523b..0000000 --- a/Source/Asura.Engine/Text/Utf.inl +++ /dev/null @@ -1,752 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2019 Laurent Gomila (laurent@sfml-dev.org) -// -// This software is provided 'as-is', without any express or implied warranty. -// In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it freely, -// subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; -// you must not claim that you wrote the original software. -// If you use this software in a product, an acknowledgment -// in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, -// and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -// -//////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////// -// References: -// -// https://www.unicode.org/ -// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c -// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h -// https://people.w3.org/rishida/scripts/uniview/conversion -// -//////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////// -template -In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement) -{ - // Some useful precomputed data - static const int trailing[256] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 - }; - static const Uint32 offsets[6] = - { - 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080 - }; - - // decode the character - int trailingBytes = trailing[static_cast(*begin)]; - if (begin + trailingBytes < end) - { - output = 0; - switch (trailingBytes) - { - case 5: output += static_cast(*begin++); output <<= 6; - case 4: output += static_cast(*begin++); output <<= 6; - case 3: output += static_cast(*begin++); output <<= 6; - case 2: output += static_cast(*begin++); output <<= 6; - case 1: output += static_cast(*begin++); output <<= 6; - case 0: output += static_cast(*begin++); - } - output -= offsets[trailingBytes]; - } - else - { - // Incomplete character - begin = end; - output = replacement; - } - - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement) -{ - // Some useful precomputed data - static const Uint8 firstBytes[7] = - { - 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC - }; - - // encode the character - if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) - { - // Invalid character - if (replacement) - *output++ = replacement; - } - else - { - // Valid character - - // Get the number of bytes to write - std::size_t bytestoWrite = 1; - if (input < 0x80) bytestoWrite = 1; - else if (input < 0x800) bytestoWrite = 2; - else if (input < 0x10000) bytestoWrite = 3; - else if (input <= 0x0010FFFF) bytestoWrite = 4; - - // Extract the bytes to write - Uint8 bytes[4]; - switch (bytestoWrite) - { - case 4: bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 3: bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 2: bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 1: bytes[0] = static_cast (input | firstBytes[bytestoWrite]); - } - - // Add them to the output - output = std::copy(bytes, bytes + bytestoWrite, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<8>::Next(In begin, In end) -{ - Uint32 codepoint; - return Decode(begin, end, codepoint); -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<8>::Count(In begin, In end) -{ - std::size_t length = 0; - while (begin < end) - { - begin = Next(begin, end); - ++length; - } - - return length; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeWide(*begin++); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - output = Encode(*begin++, output); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeWide(codepoint, output, replacement); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint < 256 ? static_cast(codepoint) : replacement; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf8(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf16(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<16>::Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf32(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<16>::Decode(In begin, In end, Uint32& output, Uint32 replacement) -{ - Uint16 first = *begin++; - - // If it's a surrogate pair, first convert to a single UTF-32 character - if ((first >= 0xD800) && (first <= 0xDBFF)) - { - if (begin < end) - { - Uint32 second = *begin++; - if ((second >= 0xDC00) && (second <= 0xDFFF)) - { - // The second element is valid: convert the two elements to a UTF-32 character - output = ((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000; - } - else - { - // Invalid character - output = replacement; - } - } - else - { - // Invalid character - begin = end; - output = replacement; - } - } - else - { - // We can make a direct copy - output = first; - } - - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::Encode(Uint32 input, Out output, Uint16 replacement) -{ - if (input <= 0xFFFF) - { - // The character can be copied directly, we just need to check if it's in the valid range - if ((input >= 0xD800) && (input <= 0xDFFF)) - { - // Invalid character (this range is reserved) - if (replacement) - *output++ = replacement; - } - else - { - // Valid character directly convertible to a single UTF-16 character - *output++ = static_cast(input); - } - } - else if (input > 0x0010FFFF) - { - // Invalid character (greater than the maximum Unicode value) - if (replacement) - *output++ = replacement; - } - else - { - // The input character will be converted to two UTF-16 elements - input -= 0x0010000; - *output++ = static_cast((input >> 10) + 0xD800); - *output++ = static_cast((input & 0x3FFUL) + 0xDC00); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<16>::Next(In begin, In end) -{ - Uint32 codepoint; - return Decode(begin, end, codepoint); -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<16>::Count(In begin, In end) -{ - std::size_t length = 0; - while (begin < end) - { - begin = Next(begin, end); - ++length; - } - - return length; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeWide(*begin++); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeWide(codepoint, output, replacement); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - *output++ = *begin < 256 ? static_cast(*begin) : replacement; - begin++; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf8(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<8>::Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf16(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf32(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<32>::Decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/) -{ - output = *begin++; - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::Encode(Uint32 input, Out output, Uint32 /*replacement*/) -{ - *output++ = input; - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<32>::Next(In begin, In /*end*/) -{ - return ++begin; -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<32>::Count(In begin, In end) -{ - return begin - end; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - *output++ = DecodeAnsi(*begin++, locale); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - *output++ = DecodeWide(*begin++); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - output = EncodeAnsi(*begin++, output, replacement, locale); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - output = EncodeWide(*begin++, output, replacement); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - *output++ = *begin < 256 ? static_cast(*begin) : replacement; - begin++; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf8(In begin, In end, Out output) -{ - while (begin < end) - output = Utf<8>::Encode(*begin++, output); - - return output; -} - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf16(In begin, In end, Out output) -{ - while (begin < end) - output = Utf<16>::Encode(*begin++, output); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf32(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Uint32 Utf<32>::DecodeAnsi(In input, const std::locale& locale) -{ - // On Windows, GCC's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - - #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - (void)locale; // to avoid warnings - - wchar_t character = 0; - mbtowc(&character, &input, 1); - return static_cast(character); - - #else - - // Get the facet of the locale which deals with character conversion - const std::ctype& facet = std::use_facet< std::ctype >(locale); - - // Use the facet to convert each character of the input string - return static_cast(facet.widen(input)); - - #endif -} - - -//////////////////////////////////////////////////////////// -template -Uint32 Utf<32>::DecodeWide(In input) -{ - // The encoding of wide characters is not well defined and is left to the system; - // however we can safely assume that it is UCS-2 on Windows and - // UCS-4 on Unix systems. - // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4, - // and UCS-4 *is* UTF-32). - - return input; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::EncodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale) -{ - // On Windows, gcc's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - - #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - (void)locale; // to avoid warnings - - char character = 0; - if (wctomb(&character, static_cast(codepoint)) >= 0) - *output++ = character; - else if (replacement) - *output++ = replacement; - - return output; - - #else - - // Get the facet of the locale which deals with character conversion - const std::ctype& facet = std::use_facet< std::ctype >(locale); - - // Use the facet to convert each character of the input string - *output++ = facet.narrow(static_cast(codepoint), replacement); - - return output; - - #endif -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::EncodeWide(Uint32 codepoint, Out output, wchar_t replacement) -{ - // The encoding of wide characters is not well defined and is left to the system; - // however we can safely assume that it is UCS-2 on Windows and - // UCS-4 on Unix systems. - // For UCS-2 we need to check if the source characters fits in (UCS-2 is a subset of UCS-4). - // For UCS-4 we can do a direct copy (UCS-4 *is* UTF-32). - - switch (sizeof(wchar_t)) - { - case 4: - { - *output++ = static_cast(codepoint); - break; - } - - default: - { - if ((codepoint <= 0xFFFF) && ((codepoint < 0xD800) || (codepoint > 0xDFFF))) - { - *output++ = static_cast(codepoint); - } - else if (replacement) - { - *output++ = replacement; - } - break; - } - } - - return output; -} diff --git a/Source/Asura.Engine/Time/Timer.cpp b/Source/Asura.Engine/Time/Timer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Time/Timer.h b/Source/Asura.Engine/Time/Timer.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/Type.h b/Source/Asura.Engine/Type.h deleted file mode 100644 index 88848d5..0000000 --- a/Source/Asura.Engine/Type.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __ASURA_ENGINE_TYPE_H__ -#define __ASURA_ENGINE_TYPE_H__ - -#include - -namespace AsuraEngine -{ - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/application.cpp b/Source/Asura.Engine/application.cpp deleted file mode 100644 index 598bca8..0000000 --- a/Source/Asura.Engine/application.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "Sdl2/SDL.h" -#include "Exceptions/Exception.h" -#include "Scripting/Luax.hpp" -#include "Application.h" - -using namespace Luax; - -namespace AsuraEngine -{ - - Application::Application() - { - - } - - Application::~Application() - { - - } - - bool Application::InitSubModules(uint flag) - { - // 初始化子模块 - #define TryInitSubModule(module_name, func_name) \ - if((flag&ASURA_MODULE_##module_name) && !Application::Init##func_name()) \ - throw Exception("Asura init submodule %s failed.", #module_name); - - TryInitSubModule(GRAPHICS, Graphics); - TryInitSubModule(AUDIO, Audio); - TryInitSubModule(FONT, Font); - TryInitSubModule(INPUT, Input); - TryInitSubModule(MATH, Math); - TryInitSubModule(PHYSICS, Physics); - TryInitSubModule(TIME, Time); - TryInitSubModule(WINDOW, Window); - - } - - void Application::PortToLua() - { - LuaxState state(mLuaState); - -#define RegisterLuaFactory(T) state.RegisterFactory(); - - state.SetToGlobalNamespace(); - state.PushNamespace("AsuraEngine"); - - RegisterLuaFactory(AEGraphics::Image>); - -#ifdef ASURA_AUTHOR - state.PushNamespace("Version"); - - state.PopNamespace(); // AsuraEngine.Version -#endif - - state.PopNamespace(); // AsuraEngine - } - -} \ No newline at end of file diff --git a/Source/Asura.Engine/application.h b/Source/Asura.Engine/application.h deleted file mode 100644 index a260cf8..0000000 --- a/Source/Asura.Engine/application.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __ASURA_ENGINE_APPLICATION_H__ -#define __ASURA_ENGINE_APPLICATION_H__ - -#include "scripting/portable.hpp" -#include "config.h" - -namespace 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 - }; - - /// - /// 管理主循环 - /// - ASURA_ABSTRACT class Application - { - public: - - Application(); - - virtual ~Application(); - - /// - /// 初始化进入前的子系统 - /// - bool InitSubModules(uint flag = ASURA_MODULE_ALL); - - /// - /// 注册lua类,可以被重载,自定义导出的类 - /// - virtual void PortToLua(); - - /// - /// 进入入口 - /// - virtual void Run(int argc, char* args[]); - - /// - /// 退出run时的处理 - /// - virtual void Exit(); - - private: - - /// - /// 子模块初始化函数,在各自模块的文件夹下面实现。 - /// - bool InitGraphics(); - bool InitAudio(); - bool InitFont(); - bool InitInput(); - bool InitMath(); - bool InitPhysics(); - bool InitTime(); - bool InitWindow(); - - /// - /// Lua state. - /// - lua_State* mLuaState; - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/asura.h b/Source/Asura.Engine/asura.h deleted file mode 100644 index 5ca56f3..0000000 --- a/Source/Asura.Engine/asura.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASURA_ENGINE_H__ -#define __ASURA_ENGINE_H__ - -#include "Application.h" - -#include "Graphics/Shader.h" - -//namespace AEGraphics = AsuraEngine::Graphics; -//namespace AEMath = AsuraEngine::Math; -//namespace AETime = AsuraEngine::Time; -//namespace AEInput = AsuraEngine::Input; -//namespace AEProfiler = AsuraEngine::Profiler; -//namespace AEFont = AsuraEngine::Font; - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/audio/sound.cpp b/Source/Asura.Engine/audio/sound.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/audio/sound.h b/Source/Asura.Engine/audio/sound.h deleted file mode 100644 index 095bdb7..0000000 --- a/Source/Asura.Engine/audio/sound.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_SOUND_H__ -#define __ASURA_ENGINE_SOUND_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Audio - { - - class Sound ASURA_FINAL: virtual public Scripting::Portable - { - public: - - Sound(); - ~Sound(); - - private: - - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/audio/sound_decoder.h b/Source/Asura.Engine/audio/sound_decoder.h deleted file mode 100644 index ad9f761..0000000 --- a/Source/Asura.Engine/audio/sound_decoder.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ASURA_ENGINE_SOUND_DECODER_H__ -#define __ASURA_ENGINE_SOUND_DECODER_H__ - -#include "Sound.h" -#include "FileSystem/DataBuffer.h" - -namespace AsuraEngine -{ - namespace Audio - { - - /// - /// 解析音频文件 - /// - class SoundDecoder - { - public: - - SoundDecoder(); - virtual ~SoundDecoder(); - - virtual Sound* Decode(const Filesystem::DataBuffer* db); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/config.h b/Source/Asura.Engine/config.h deleted file mode 100644 index f02a2ba..0000000 --- a/Source/Asura.Engine/config.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __ASURA_CONFIG_H__ -#define __ASURA_CONFIG_H__ - -namespace AsuraEngine -{ - - //---------------------------------------------------------------------------------------------------------------- - // 基本类型 - - typedef int8_t int8; - typedef uint8_t uint8; - typedef uint8 byte; - typedef int16_t int16; - typedef uint16_t uint16; - typedef int32_t int32; - typedef uint32_t uint32; - typedef int64_t int64; - typedef uint64_t uint64; - - typedef uint32_t uint; - typedef int32_t sint; - - typedef std::size_t size_t; - - //---------------------------------------------------------------------------------------------------------------- - // assert - -#ifndef ASSERT - #ifdef NDEBUG - #define ASSERT(x) { false ? (void)(x) : (void)0; } - #else - #ifdef _WIN32 - #define ASURA_DEBUG_BREAK() __debugbreak() - #else - #define ASURA_DEBUG_BREAK() raise(SIGTRAP) - #endif - #define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) - #endif -#endif - - //---------------------------------------------------------------------------------------------------------------- - // 导出定义 - -#ifdef _WIN32 - #define ASURA_FINAL final - #define ASURA_LIBRARY_EXPORT __declspec(dllexport) - #define ASURA_LIBRARY_IMPORT __declspec(dllimport) - #define ASURA_FORCE_INLINE __forceinline - #define ASURA_RESTRICT __restrict - #define ASURA_ATTRIBUTE_USED - #define ASURA_ABSTRACT - #define ASURA_API ASURA_LIBRARY_EXPORT -#else - #define ASURA_FINAL final - #define ASURA_LIBRARY_EXPORT __attribute__((visibility("default"))) - #define ASURA_LIBRARY_IMPORT - #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline - #define ASURA_RESTRICT __restrict__ - #define ASURA_ATTRIBUTE_USED __attribute__((used)) - #define ASURA_ABSTRACT - #define ASURA_API ASURA_LIBRARY_EXPORT -#endif - - //---------------------------------------------------------------------------------------------------------------- - // 默认入口 - -#define ASURA_RUN(App) \ -int main(int argc, char* args[]) \ -{ \ - App app; \ - app.InitSubModules(); \ - app.PortToLua(); \ - app.Run(argc, args); \ - return 0; \ -} - - //---------------------------------------------------------------------------------------------------------------- - // - -} // namespace AsuraEngine - -#endif // __ASURA_CONFIG_H__ \ No newline at end of file diff --git a/Source/Asura.Engine/exceptions/exception.cpp b/Source/Asura.Engine/exceptions/exception.cpp deleted file mode 100644 index dbb36ca..0000000 --- a/Source/Asura.Engine/exceptions/exception.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Exception.h" - -#include -#include - -namespace AsuraEngine -{ - - Exception::Exception(const char *fmt, ...) - { - va_list args; - int size_buffer = 256, size_out; - char *buffer; - while (true) - { - buffer = new char[size_buffer]; - memset(buffer, 0, size_buffer); - - va_start(args, fmt); - size_out = vsnprintf(buffer, size_buffer, fmt, args); - va_end(args); - - // see http://perfec.to/vsnprintf/pasprintf.c - // if size_out ... - // == -1 --> output was truncated - // == size_buffer --> output was truncated - // == size_buffer-1 --> ambiguous, /may/ have been truncated - // > size_buffer --> output was truncated, and size_out - // bytes would have been written - if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1) - size_buffer *= 2; - else if (size_out > size_buffer) - size_buffer = size_out + 2; // to avoid the ambiguous case - else - break; - - delete[] buffer; - } - message = std::string(buffer); - delete[] buffer; - } - - Exception::~Exception() throw() - { - } - -} diff --git a/Source/Asura.Engine/exceptions/exception.h b/Source/Asura.Engine/exceptions/exception.h deleted file mode 100644 index bed8a9a..0000000 --- a/Source/Asura.Engine/exceptions/exception.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __ASURA_ENGINE_EXCEPTION_H__ -#define __ASURA_ENGINE_EXCEPTION_H__ - -#include - -namespace AsuraEngine -{ - - /** - * A convenient vararg-enabled exception class. - **/ - class Exception : public std::exception - { - public: - - /** - * Creates a new Exception according to printf-rules. - * - * See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ - * - * @param fmt The format string (see printf). - **/ - Exception(const char *fmt, ...); - virtual ~Exception() throw(); - - /** - * Returns a string containing reason for the exception. - * @return A description of the exception. - **/ - inline virtual const char *what() const throw() - { - return message.c_str(); - } - - private: - - std::string message; - - }; // Exception - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/filesystem/data_buffer.cpp b/Source/Asura.Engine/filesystem/data_buffer.cpp deleted file mode 100644 index 3c80aa1..0000000 --- a/Source/Asura.Engine/filesystem/data_buffer.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "data_buffer.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - DataBuffer::~DataBuffer() - { - delete[] data; - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/filesystem/data_buffer.h b/Source/Asura.Engine/filesystem/data_buffer.h deleted file mode 100644 index 84d445c..0000000 --- a/Source/Asura.Engine/filesystem/data_buffer.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __ASURA_ENGINE_DATABUFFER_H__ -#define __ASURA_ENGINE_DATABUFFER_H__ - -#include - -#include "Scripting/Luax.hpp" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 对内存数据的封装,所有的数据使用Data buffer包装,不直接使用const void*。通过resource manager读取。 - /// - class DataBuffer ASURA_FINAL: public Scripting::Portable - { - public: - - DataBuffer(const void* data, std::size_t size); - - ~DataBuffer(); - - byte* data; - size_t size; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(DataBuffer); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/filesystem/decoded_data.cpp b/Source/Asura.Engine/filesystem/decoded_data.cpp deleted file mode 100644 index 125c652..0000000 --- a/Source/Asura.Engine/filesystem/decoded_data.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "DecodedData.h" -#include "Exceptions/Exception.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - DecodedData::DecodedData(const DataBuffer* databuffer) - { - Decode(databuffer); - } - - DecodedData::~DecodedData() - { - - } - - } -} diff --git a/Source/Asura.Engine/filesystem/decoded_data.h b/Source/Asura.Engine/filesystem/decoded_data.h deleted file mode 100644 index 0b661b6..0000000 --- a/Source/Asura.Engine/filesystem/decoded_data.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __ASURA_ENGINE_DATA_H__ -#define __ASURA_ENGINE_DATA_H__ - -#include - -#include "DataBuffer.h" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 可以在另一个线程构建的data继承此类。如图片数据、音频数据等,可以在另一个线程中解析原文件,生成内部数据格式,如像素 - /// 等。 - /// - ASURA_ABSTRACT class DecodedData - { - public: - - /// - /// 从内存中构建data,可以放在另一个线程里面,从资源管理系统里面加载。 - /// - DecodedData(const DataBuffer& databuffer); - - virtual ~DecodedData(); - - protected: - - /// - /// 解码内存中的数据。 - /// - virtual void Decode(const DataBuffer& buffer) = 0; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/filesystem/reloadable.h b/Source/Asura.Engine/filesystem/reloadable.h deleted file mode 100644 index eb35d3e..0000000 --- a/Source/Asura.Engine/filesystem/reloadable.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_RELOADABLE_H__ -#define __ASURA_ENGINE_RELOADABLE_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 可以重新构建的数据结构。比如图片、音频这种,从外部数据可以直接构建,可以在编辑器内重新构建,适用于不改变handle的资源。 - /// - ASURA_ABSTRACT class Reloadable - { - public: - Reloadable(); - virtual ~Reloadable(); - - // 继承Reloadable的需要提供一个load方法 - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/filesystem/resource_manager.cpp b/Source/Asura.Engine/filesystem/resource_manager.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/filesystem/resource_manager.h b/Source/Asura.Engine/filesystem/resource_manager.h deleted file mode 100644 index e22ce91..0000000 --- a/Source/Asura.Engine/filesystem/resource_manager.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __ASURA_ENGINE_RESOURCE_MANAGER_H__ -#define __ASURA_ENGINE_RESOURCE_MANAGER_H__ - -#include - -#include "DataBuffer.h" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// 资源管理,负责加载、存储资源,指定根目录等。 - /// - class ResourceManager ASURA_FINAL - { - public: - - ResourceManager(); - ~ResourceManager(); - - /// - /// 装载根目录 - /// - void Mount(const std::string& root); - - /// - /// 读取文件并返回一个data buffer,注意如果要确保正确回收内存,在调用处使用unique_ptr - /// - DataBuffer* LoadFile(const std::string& path); - - /// - /// 保存data buffer里的数据 - /// - void SaveFile(const std::string& path, const DataBuffer* buffer); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/application.graphics.cpp b/Source/Asura.Engine/graphics/application.graphics.cpp deleted file mode 100644 index 4d3102f..0000000 --- a/Source/Asura.Engine/graphics/application.graphics.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Application.h" -#include "Sdl2/SDL.h" -#include "Exceptions/Exception.h" - -namespace AsuraEngine -{ - - /// - /// 初始化graphics模块 - /// - bool Application::InitGraphics() - { - - if (SDL_Init(SDL_INIT_VIDEO) < 0) - return false; - - } - -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/binding/canvas.binding.cpp b/Source/Asura.Engine/graphics/binding/canvas.binding.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/binding/color.binding.cpp b/Source/Asura.Engine/graphics/binding/color.binding.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/binding/image.binding.cpp b/Source/Asura.Engine/graphics/binding/image.binding.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/binding/image_data.binding.cpp b/Source/Asura.Engine/graphics/binding/image_data.binding.cpp deleted file mode 100644 index d576718..0000000 --- a/Source/Asura.Engine/graphics/binding/image_data.binding.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "../image.h" - -using namespace Luax; - -namespace AsuraEngine -{ - namespace Graphics - { - - void Image::RegisterLuaxInterface(LuaxState& state) - { - - } - - void Image::RegisterLuaxClass(LuaxState& state) - { - - } - - void Image::RegisterLuaxPostprocess(LuaxState& state) - { - // blend方法枚举,AsuraEngine.EBlendMode - LuaxEnum EBlendMode[] = { - { "Additive", 1 }, - { "PreBlend", 2 }, - { "Substruction", 3 }, - { "Multiplied", 4 }, - {0, 0} - }; - - state.RegisterEnum("EBlendMode", EBlendMode); - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp b/Source/Asura.Engine/graphics/binding/mesh2d.binding.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp b/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp deleted file mode 100644 index 6e15052..0000000 --- a/Source/Asura.Engine/graphics/binding/mesh2d_data.binding.cpp +++ /dev/null @@ -1,9 +0,0 @@ -namespace AsuraEngine -{ - namespace Graphics - { - - - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/binding/shader.binding.cpp b/Source/Asura.Engine/graphics/binding/shader.binding.cpp deleted file mode 100644 index 1190997..0000000 --- a/Source/Asura.Engine/graphics/binding/shader.binding.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "../shader.h" - -using namespace Luax; - -namespace AsuraEngine -{ - namespace Graphics - { - - void Shader::RegisterLuaxInterface(LuaxState& state) - { - - } - - void Shader::RegisterLuaxClass(LuaxState& state) - { - - LuaxEnum EBuiltIn[] = { - {0, 0} - }; - - state.RegisterEnum("EBuiltIn", EBuiltIn); - - } - - void Shader::RegisterLuaxPostprocess(LuaxState& state) - { - - } - - /// - /// 将此shader设置为活动。 - /// - int Shader::l_Use(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// 将此shader设置为非活动。 - /// - int Shader::l_Unuse(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// 从着色器代码中构建shader程序。如果成功返回true,失败返回false。 - /// - int Shader::l_Load(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// 判断shader是否有这个uniform,如果有返回true,否则返回false - /// - int Shader::l_HasUniform(lua_State* L) - { - LUAX_STATE(L); - - } - - /// - /// 后的uniforms的location,如果没有这个uniform,返回nil,否则返回对应的loc - /// - int Shader::l_GetUniformLocation(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetBuiltInUniforms(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformFloat(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformTexture(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector2(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector3(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformVector4(lua_State* L) - { - LUAX_STATE(L); - - } - - int Shader::l_SetUniformColor(lua_State* L) - { - LUAX_STATE(L); - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp b/Source/Asura.Engine/graphics/binding/sprite_batch.binding.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/binding/window.binding.cpp b/Source/Asura.Engine/graphics/binding/window.binding.cpp deleted file mode 100644 index 3befc8c..0000000 --- a/Source/Asura.Engine/graphics/binding/window.binding.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "../Window.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - - - } -} diff --git a/Source/Asura.Engine/graphics/blend_mode.h b/Source/Asura.Engine/graphics/blend_mode.h deleted file mode 100644 index 775cc45..0000000 --- a/Source/Asura.Engine/graphics/blend_mode.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_ENGINE_BLEND_MODE_H__ -#define __ASURA_ENGINE_BLEND_MODE_H__ - -namespace AsuraEngine -{ - namespace Graphics - { - - enum BlendMode - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/canvas.cpp b/Source/Asura.Engine/graphics/canvas.cpp deleted file mode 100644 index 61787b6..0000000 --- a/Source/Asura.Engine/graphics/canvas.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "Canvas.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Canvas::Canvas() - : Texture() - , mWidth(0) - , mHeight(0) - { - glGenFramebuffers(1, &mFBO); - GLint current_fbo; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureHandle, 0); - glBindFramebuffer(GL_FRAMEBUFFER, current_fbo); - } - - void Canvas::SetSize(uint w, uint h) - { - GLint current_tex; - glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_tex); - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - - glBindTexture(GL_TEXTURE_2D, current_tex); - } - - void Canvas::Bind() - { - - } - - void Canvas::Unbind() - { - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/canvas.h b/Source/Asura.Engine/graphics/canvas.h deleted file mode 100644 index c4e0f65..0000000 --- a/Source/Asura.Engine/graphics/canvas.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __ASURA_ENGINE_CANVAS_H__ -#define __ASURA_ENGINE_CANVAS_H__ - -#include - -#include "Math/Rect.hpp" -#include "GL.h" -#include "Texture.h" -#include "RenderTarget.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Canvas也可以称为render texture,自身也可以作为texture渲染。 - /// - class Canvas ASURA_FINAL - : public Drawable - , public RenderTarget - , public Scripting::Portable - { - public: - - Canvas(); - - ~Canvas(); - - /// - /// 设置render texture的大小 - /// - void SetSize(uint w, uint h); - - 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: - - /// - /// Frame buffer object id. - /// - GLuint mFBO; - - /// - /// canvas的大小 - /// - uint mWidth, mHeight; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(SimCanvas); - - LUAX_DECL_METHOD(l_SetSize); - LUAX_DECL_METHOD(l_Bind); - LUAX_DECL_METHOD(l_Unbind); - - //---------------------------------------------------------------------------------------------------------- - - }; - - /// - /// Canvas别名为RenderTexture - /// - using RenderTexture = Canvas; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/color.cpp b/Source/Asura.Engine/graphics/color.cpp deleted file mode 100644 index 106493d..0000000 --- a/Source/Asura.Engine/graphics/color.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "Color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - 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; - } - - int Color32::l_GetRed(lua_State* L) - { - - } - - int Color32::l_GetGreen(lua_State* L) - { - - } - - int Color32::l_GetBlue(lua_State* L) - { - - } - - int Color32::l_GetAlpha(lua_State* L) - { - - } - - //------------------------------------------------------------------------------------------------------------ - - 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::operator *(const Color& c) - { - r *= c.r; - g *= c.g; - b *= c.b; - a *= c.a; - } - - int Color::l_GetRed(lua_State* L) - { - - } - - int Color::l_GetGreen(lua_State* L) - { - - } - - int Color::l_GetBlue(lua_State* L) - { - - } - - int Color::l_GetAlpha(lua_State* L) - { - - } - - int Color::l_Add(lua_State* L) - { - - } - - int Color::l_Minus(lua_State* L) - { - - } - - int Color::l_Multiply(lua_State* L) - { - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/color.h b/Source/Asura.Engine/graphics/color.h deleted file mode 100644 index 0d65cb1..0000000 --- a/Source/Asura.Engine/graphics/color.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __ASURA_ENGINE_COLOR_H__ -#define __ASURA_ENGINE_COLOR_H__ - -#include "Scripting/Luax.hpp" -#include "Scripting/Portable.h" -#include "Config.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Color; - - /// - /// 32bits颜色 - /// - class Color32 ASURA_FINAL: public Scripting::Portable - { - public: - - Color32(); - - ~Color32(); - - Color32(const Color32& c); - - Color32(const Color& c); - - Color32(byte r, byte g, byte b, byte a); - - byte r, g, b, a; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Color32); - - LUAX_DECL_METHOD(l_ToColor); - LUAX_DECL_METHOD(l_GetRed); - LUAX_DECL_METHOD(l_GetGreen); - LUAX_DECL_METHOD(l_GetBlue); - LUAX_DECL_METHOD(l_GetAlpha); - LUAX_DECL_METHOD(l_Multiply); - LUAX_DECL_METHOD(l_Index); //索引r,g,b,a - LUAX_DECL_METHOD(l_NewIndex); //修改r,g,b,a - - //---------------------------------------------------------------------------------------------------------- - - }; - - /// - /// 规范化颜色 - /// - class Color ASURA_FINAL: public Scripting::Portable - { - 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); - - float r, g, b, a; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Color); - - LUAX_DECL_METHOD(l_ToColor32); - LUAX_DECL_METHOD(l_SetColor); - LUAX_DECL_METHOD(l_GetColor); - LUAX_DECL_METHOD(l_Multiply); // 颜色乘法 - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/color_palette.h b/Source/Asura.Engine/graphics/color_palette.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/gif.cpp b/Source/Asura.Engine/graphics/gif.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/gif.h b/Source/Asura.Engine/graphics/gif.h deleted file mode 100644 index 36a3259..0000000 --- a/Source/Asura.Engine/graphics/gif.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __ASURA_GIF_H__ -#define __ASURA_GIF_H__ - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/gl.cpp b/Source/Asura.Engine/graphics/gl.cpp deleted file mode 100644 index dac2ea4..0000000 --- a/Source/Asura.Engine/graphics/gl.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "OpenGL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/gl.h b/Source/Asura.Engine/graphics/gl.h deleted file mode 100644 index 0661e17..0000000 --- a/Source/Asura.Engine/graphics/gl.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ASURA_ENGINE_OPENGL_H__ -#define __ASURA_ENGINE_OPENGL_H__ - -#include "glad/glad.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class OpenGL - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/image.cpp b/Source/Asura.Engine/graphics/image.cpp deleted file mode 100644 index e704945..0000000 --- a/Source/Asura.Engine/graphics/image.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Config.h" -#include "Image.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Image::Image() - { - } - - Image::~Image() - { - } - - //创建\更新纹理像素信息 - bool Image::Load(ImageData* data) - { - ASSERT(data); - - glBindTexture(GL_TEXTURE_2D, mTextureHandle); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data->pixels); - glBindTexture(GL_TEXTURE_2D, 0); - return true; - - RRA(data, mImageData); - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/image.h b/Source/Asura.Engine/graphics/image.h deleted file mode 100644 index 916c365..0000000 --- a/Source/Asura.Engine/graphics/image.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_H__ -#define __ASURA_ENGINE_IMAGE_H__ - -#include "math/vector2.hpp" -#include "scripting/portable.hpp" -#include "fileSystem/reloadable.h" -#include "stringmap.hpp" -#include "manager.hpp" -#include "texture.h" -#include "color.h" -#include "image_data.h" -#include "render_state.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageFactory; - - /// - /// Image是图片从内存中载入后,读取进游戏后保存的结果。一个Image在内存、显存中只会保存一份,不会产生副本。需要特征 - /// 化的区别image,如锚点位置,缩放和旋转角度,使用sprite。是一个只读类。主要是考虑到editor和engine使用不同的封装。 - /// - class Image ASURA_FINAL - : public Drawable - , public Scripting::Portable - , public Filesystem::Reloadable - { - public: - - Image(); - - ~Image(); - - /// - /// 从数据buffer构建image像素信息,如果mPixels不为空,先清空数据。用来重新构建image,使用glTexImage2D重新提交image - /// 的像素数据。 - /// - bool Load(ImageData* data); - - uint GetWidth(); - uint GetHeight(); - Math::Vector2u GetSize(); - - /// - /// 获得某一个位置的像素 - /// - Color32 GetPixel(uint x, uint y); - - void Render(const RenderTarget* rt, const RenderState& state) override; - - void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override; - - private: - - ImageData* mImageData; - - Math::Vector2u mSize; - - public: - - LUAX_DECL_FACTORY(SimImage); - - LUAX_DECL_METHOD(l_Load); - LUAX_DECL_METHOD(l_GetWidth); - LUAX_DECL_METHOD(l_GetHeight); - LUAX_DECL_METHOD(l_GetSize); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/image_data.cpp b/Source/Asura.Engine/graphics/image_data.cpp deleted file mode 100644 index 821bfd6..0000000 --- a/Source/Asura.Engine/graphics/image_data.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "image_data.h" -#include "png_decoder.h" -#include "stb_decoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - using namespace std; - - // 解析image的decoder,用来作为解析策略。 - list ImageData::ImageDecoders = { - new PNGDecoder(), // png - new STBDecoder() // jpeg, tga, bmp - }; - - ImageData::ImageData(const Filesystem::DataBuffer& buffer) - : DecodedData(buffer) - { - } - - ImageData::~ImageData() - { - if (pixels) - delete[] pixels; - } - - /// - /// 解析,如果无法成功,抛出异常 - /// - void ImageData::Decode(const Filesystem::DataBuffer& buffer) - { - for (ImageDecoder* decoder : ImageDecoders) - { - if (decoder->CanDecode(buffer)) - { - decoder->Decode(buffer, this); - return; - } - } - } - - Color ImageData::GetPixel(uint x, uint y) - { - - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/image_data.h b/Source/Asura.Engine/graphics/image_data.h deleted file mode 100644 index 1e711a8..0000000 --- a/Source/Asura.Engine/graphics/image_data.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGEDATA_H__ -#define __ASURA_ENGINE_IMAGEDATA_H__ - -#include - -#include "scripting/luax.hpp" -#include "filesystem/decoded_data.h" -#include "image_decoder.h" -#include "pixel_format.h" -#include "color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageData ASURA_FINAL - : public Filesystem::DecodedData - , public Scripting::Portable - { - public: - - /// - /// 解析图片数据文件,并构建像素信息,如果解析失败,抛出异常 - /// - ImageData(const Filesystem::DataBuffer& buffer); - - ~ImageData(); - - Color GetPixel(uint x, uint y); - - uint width, height; - PixelFormat format; - std::size_t size; - byte* pixels; - - private: - - void Decode(const Filesystem::DataBuffer& buffer) override; - - /// - /// 在第一次准备image data时构建所有提供的decoder。在几个decoders中间选择解析策略。 - /// - static std::list ImageDecoders; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(ImageData); - - LUAX_DECL_METHOD(l_GetPixel); - LUAX_DECL_METHOD(l_GetSize); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/image_decoder.h b/Source/Asura.Engine/graphics/image_decoder.h deleted file mode 100644 index 2c73fd1..0000000 --- a/Source/Asura.Engine/graphics/image_decoder.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __ASURA_ENGINE_IMAGE_DECODER_H__ -#define __ASURA_ENGINE_IMAGE_DECODER_H__ - -#include "FileSystem/DataBuffer.h" - -#include "ImageData.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class ImageDecoder - { - public: - - ImageDecoder(); - virtual ~ImageDecoder(); - - /// - /// 判断内存是否能用本decoder解压 - /// - virtual bool CanDecode(const Filesystem::DataBuffer& buffer) = 0; - - /// - /// 输入一个编码后的内存,输出一个解压后的Image data,如果解压失败返回nullptr - /// - virtual void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) = 0; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/mesh2d.cpp b/Source/Asura.Engine/graphics/mesh2d.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/mesh2d.h b/Source/Asura.Engine/graphics/mesh2d.h deleted file mode 100644 index 2c58f00..0000000 --- a/Source/Asura.Engine/graphics/mesh2d.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_MESH2D_H__ -#define __ASURA_ENGINE_MESH2D_H__ - -#include "Scripting/Luax.hpp" - -#include "scripting/portable.hpp" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 2D mesh,用于做一些顶点动画。 - /// - class Mesh2D ASURA_FINAL - : public Scripting::Portable - { - public: - - Mesh2D(); - - ~Mesh2D(); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/mesh2d_data.cpp b/Source/Asura.Engine/graphics/mesh2d_data.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/mesh2d_data.h b/Source/Asura.Engine/graphics/mesh2d_data.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/pixel_format.h b/Source/Asura.Engine/graphics/pixel_format.h deleted file mode 100644 index 8df07d5..0000000 --- a/Source/Asura.Engine/graphics/pixel_format.h +++ /dev/null @@ -1,91 +0,0 @@ -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 像素格式 - /// - enum PixelFormat - { - PIXELFORMAT_UNKNOWN, - - // these are converted to an actual format by love - PIXELFORMAT_NORMAL, - PIXELFORMAT_HDR, - - // "regular" formats - PIXELFORMAT_R8, - PIXELFORMAT_RG8, - PIXELFORMAT_RGBA8, - PIXELFORMAT_sRGBA8, - PIXELFORMAT_R16, - PIXELFORMAT_RG16, - PIXELFORMAT_RGBA16, - PIXELFORMAT_R16F, - PIXELFORMAT_RG16F, - PIXELFORMAT_RGBA16F, - PIXELFORMAT_R32F, - PIXELFORMAT_RG32F, - PIXELFORMAT_RGBA32F, - - PIXELFORMAT_LA8, // Same as RG8, but accessed as (L, L, L, A) - - // packed formats - PIXELFORMAT_RGBA4, - PIXELFORMAT_RGB5A1, - PIXELFORMAT_RGB565, - PIXELFORMAT_RGB10A2, - PIXELFORMAT_RG11B10F, - - // depth/stencil formats - PIXELFORMAT_STENCIL8, - PIXELFORMAT_DEPTH16, - PIXELFORMAT_DEPTH24, - PIXELFORMAT_DEPTH32F, - PIXELFORMAT_DEPTH24_STENCIL8, - PIXELFORMAT_DEPTH32F_STENCIL8, - - // compressed formats - PIXELFORMAT_DXT1, - PIXELFORMAT_DXT3, - PIXELFORMAT_DXT5, - PIXELFORMAT_BC4, - PIXELFORMAT_BC4s, - PIXELFORMAT_BC5, - PIXELFORMAT_BC5s, - PIXELFORMAT_BC6H, - PIXELFORMAT_BC6Hs, - PIXELFORMAT_BC7, - PIXELFORMAT_PVR1_RGB2, - PIXELFORMAT_PVR1_RGB4, - PIXELFORMAT_PVR1_RGBA2, - PIXELFORMAT_PVR1_RGBA4, - PIXELFORMAT_ETC1, - PIXELFORMAT_ETC2_RGB, - PIXELFORMAT_ETC2_RGBA, - PIXELFORMAT_ETC2_RGBA1, - PIXELFORMAT_EAC_R, - PIXELFORMAT_EAC_Rs, - PIXELFORMAT_EAC_RG, - PIXELFORMAT_EAC_RGs, - PIXELFORMAT_ASTC_4x4, - PIXELFORMAT_ASTC_5x4, - PIXELFORMAT_ASTC_5x5, - PIXELFORMAT_ASTC_6x5, - PIXELFORMAT_ASTC_6x6, - PIXELFORMAT_ASTC_8x5, - PIXELFORMAT_ASTC_8x6, - PIXELFORMAT_ASTC_8x8, - PIXELFORMAT_ASTC_10x5, - PIXELFORMAT_ASTC_10x6, - PIXELFORMAT_ASTC_10x8, - PIXELFORMAT_ASTC_10x10, - PIXELFORMAT_ASTC_12x10, - PIXELFORMAT_ASTC_12x12, - - PIXELFORMAT_MAX_ENUM - }; - - } -} diff --git a/Source/Asura.Engine/graphics/png_decoder.cpp b/Source/Asura.Engine/graphics/png_decoder.cpp deleted file mode 100644 index f919090..0000000 --- a/Source/Asura.Engine/graphics/png_decoder.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "PNGDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - bool PNGDecoder::CanDecode(const Filesystem::DataBuffer& buffer) - { - return false; - } - - void PNGDecoder::Decode(const Filesystem::DataBuffer& buffer, ImageData& data) - { - - } - - } -} diff --git a/Source/Asura.Engine/graphics/png_decoder.h b/Source/Asura.Engine/graphics/png_decoder.h deleted file mode 100644 index 980753f..0000000 --- a/Source/Asura.Engine/graphics/png_decoder.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ASURA_ENGINE_PNGDECODER_H__ -#define __ASURA_ENGINE_PNGDECODER_H__ - -#include "ImageDecoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 使用lodepng解压png文件 - /// - class PNGDecoder ASURA_FINAL: public ImageDecoder - { - public: - - bool CanDecode(const Filesystem::DataBuffer& buffer) override; - - void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/quad.cpp b/Source/Asura.Engine/graphics/quad.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/quad.h b/Source/Asura.Engine/graphics/quad.h deleted file mode 100644 index b7dd3d9..0000000 --- a/Source/Asura.Engine/graphics/quad.h +++ /dev/null @@ -1 +0,0 @@ -// Quad和rect的区别在于,rect是的边偏向于轴,quad不一定。 diff --git a/Source/Asura.Engine/graphics/render_state.h b/Source/Asura.Engine/graphics/render_state.h deleted file mode 100644 index a80efd3..0000000 --- a/Source/Asura.Engine/graphics/render_state.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDER_STATE_H__ -#define __ASURA_ENGINE_RENDER_STATE_H__ - -#include "Math/Vector2.hpp" -#include "Math/Rect.hpp" -#include "Math/Transform.h" - -#include "Shader.h" -#include "blend_mode.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 渲染当前纹理的方式 - /// - struct RenderState ASURA_FINAL - { - /// - /// 默认的render state - /// - static RenderState Default; - - RenderState(); - ~RenderState(); - - /// - /// 位置、缩放、中心位置和旋转 - /// - - Math::Transform transform; - - /// - /// 着色器 - /// - Shader* shader; - - /// - /// 混合方式 - /// - BlendMode blendMode; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/render_target.cpp b/Source/Asura.Engine/graphics/render_target.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/render_target.h b/Source/Asura.Engine/graphics/render_target.h deleted file mode 100644 index d6de164..0000000 --- a/Source/Asura.Engine/graphics/render_target.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __ASURA_ENGINE_RENDERTARGET_H__ -#define __ASURA_ENGINE_RENDERTARGET_H__ - -#include "Math/Rect.hpp" -#include "Texture.h" -#include "Scripting/Portable.h" -#include "Color.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class Drawable; - - /// - /// 可被作为渲染目标的类,派生类有 - /// Canvas(RenderTexture) - /// Window(RenderWindow) - /// - class RenderTarget - { - public: - - RenderTarget() {}; - - virtual ~RenderTarget() {}; - - /// - /// 用颜色col清空整个RT - /// - virtual void Clear(const Color& col = Color::Black) = 0; - - /// - /// 用颜色col清空部分RT - /// - virtual void Clear(const Math::Recti& quad, const Color& col = Color::Black) = 0; - - /// - /// 绘制texture到本RT上 - /// - virtual void Draw(const Drawable* texture, const RenderState& state) = 0; - - /// - /// 绘制一部分texture到本RT上 - /// - virtual void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) = 0; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/shader.cpp b/Source/Asura.Engine/graphics/shader.cpp deleted file mode 100644 index 1a85866..0000000 --- a/Source/Asura.Engine/graphics/shader.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "Shader.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Shader::Shader() - { - - } - - Shader::~Shader() - { - - } - - bool Shader::Load(const std::string& vertexShader, const std::string& fragmentShader) - { - - } - - uint Shader::GetUniformLocation(const std::string& uniform) - { - - } - - GLuint Shader::GetGLProgramHandle() - { - return mProgramHandle; - } - - void Shader::Use() - { - - } - - void Shader::Unuse() - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformFloat(uint loc, float value) - { - - } - - void Shader::SetUniformTexture(uint loc, const Texture& texture) - { - - } - - void Shader::SetUniformVector2(uint loc, const Math::Vector2f& vec2) - { - - } - - void Shader::SetUniformVector3(uint loc, const Math::Vector3f& vec3) - { - - } - - void Shader::SetUniformVector4(uint loc, const Math::Vector4f& vec4) - { - - } - - uint Shader::GetGLTextureUnitCount() - { - GLint maxTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); - return (uint)maxTextureUnits; - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/shader.h b/Source/Asura.Engine/graphics/shader.h deleted file mode 100644 index 65f214e..0000000 --- a/Source/Asura.Engine/graphics/shader.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef __ASURA_ENGINE_SHADER_H__ -#define __ASURA_ENGINE_SHADER_H__ - -#include -#include - -#include "FileSystem/Reloadable.h" -#include "Scripting/Luax.hpp" -#include "Math/Vector2.hpp" -#include "Math/Vector3.hpp" -#include "Math/Vector4.h" -#include "Math/Matrix44.h" -#include "StringMap.hpp" -#include "scripting/portable.hpp" -#include "Color.h" -#include "Manager.hpp" -#include "Texture.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只提供设置uniforms和use着色器的方法。编辑 - /// 器针对每个shader,会通过shader代码找到声明的uniforms变量,并暴露给framework的material设置。 - /// - class Shader ASURA_FINAL - : public Scripting::Portable - , public Filesystem::Reloadable - { - public: - - Shader(); - - ~Shader(); - - /// - /// 从代码编译shader,编译时会先检测是否有上次缓存的uniforms location map。使用glAttachShader重新编译生成着色器, - /// 不会重新申请着色器程序。 - /// - bool Load(const std::string& vertexShader, const std::string& fragmentShader); - - /// - /// 将当期shader设置为活动 - /// - void Use(); - - /// - /// 将当期shader设置为非活动 - /// - void Unuse(); - - /// - /// 在已经知道uniform location的情况下,设置值。 - /// - void SetUniformFloat(uint loc, float value); - void SetUniformTexture(uint loc, const Texture& texture); - 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); - - uint GetUniformLocation(const std::string& uniform); - - bool HasUniform(const std::string& uniform); - - GLuint GetGLProgramHandle(); - - /// - /// 获得texture unit数量,一般为16个 - /// - static uint GetGLTextureUnitCount(); - - private: - - /// - /// 当前活动的shader - /// - static Shader* mCurrentShader; - - /// - /// 设置内置变量: - /// vec2 Asura_Time x值为进入当前场景开始的时间,y值为上一帧的时间间隔 - /// vec2 Asura_RenderTargetSize RT的大小,以像素为单位 - /// Texture Asura_MainTexture 主纹理 - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// - GLuint mProgramHandle; - - //------------------------------------------------------------------------------------------------------------ - - public: - - LUAX_DECL_FACTORY(SimShader); - - LUAX_DECL_METHOD(l_Use); - LUAX_DECL_METHOD(l_Unuse); - LUAX_DECL_METHOD(l_Load); - LUAX_DECL_METHOD(l_HasUniform); - LUAX_DECL_METHOD(l_GetUniformLocation); - LUAX_DECL_METHOD(l_SetBuiltInUniforms); - LUAX_DECL_METHOD(l_SetUniformFloat); - LUAX_DECL_METHOD(l_SetUniformTexture); - LUAX_DECL_METHOD(l_SetUniformVector2); - LUAX_DECL_METHOD(l_SetUniformVector3); - LUAX_DECL_METHOD(l_SetUniformVector4); - LUAX_DECL_METHOD(l_SetUniformColor); - - private: - - Luax::LuaxMemberRef mCodeLuaRef; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/shape.cpp b/Source/Asura.Engine/graphics/shape.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/shape.h b/Source/Asura.Engine/graphics/shape.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/sprite_batch.cpp b/Source/Asura.Engine/graphics/sprite_batch.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/graphics/sprite_batch.h b/Source/Asura.Engine/graphics/sprite_batch.h deleted file mode 100644 index 7909519..0000000 --- a/Source/Asura.Engine/graphics/sprite_batch.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__ -#define __ASURA_ENGINE_SPRITE_BATCH_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Sprite batch用在批量渲染单个图片的地方,比如粒子系统。 - /// - class SpriteBatch ASURA_FINAL - : public Scripting::Portable - { - public: - - SpriteBatch(); - - ~SpriteBatch(); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/stb_decoder.cpp b/Source/Asura.Engine/graphics/stb_decoder.cpp deleted file mode 100644 index b14d0f3..0000000 --- a/Source/Asura.Engine/graphics/stb_decoder.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "STBDecoder.h" - -#include "Exceptions/Exception.h" -#include "stb/stb_image.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - bool STBDecoder::CanDecode(const Filesystem::DataBuffer& buffer) - { - int w = 0; - int h = 0; - int comp = 0; - - int status = stbi_info_from_memory((const stbi_uc*)buffer.data, buffer.size, &w, &h, &comp); - - return status == 1 && w > 0 && h > 0; - } - - void STBDecoder::Decode(const Filesystem::DataBuffer& db, ImageData& imageData) - { - const stbi_uc *buffer = (const stbi_uc *)db.data; - int bufferlen = db.size; - int width, height; - int comp = 0; - byte* data = nullptr; - PixelFormat format = PIXELFORMAT_UNKNOWN; - std::size_t size = 0; - - if (stbi_is_hdr_from_memory(buffer, bufferlen)) - { - // 4个channel都是float - data = (byte*)stbi_loadf_from_memory(buffer, bufferlen, &width, &height, &comp, STBI_rgb_alpha); - format = PIXELFORMAT_RGBA32F; - size = width * height * 4 * sizeof(float); - } - else - { - data = (byte*)stbi_load_from_memory(buffer, bufferlen, &width, &height, &comp, STBI_rgb_alpha); - format = PIXELFORMAT_ASTC_8x5; - size = width * height * 4; - } - if (data) - { - // 保证内存被释放,做一个防护,理论上不会出现没有释放的情况,因为image data是一次性的,image才是多次的。 - if (imageData.pixels) - delete[] imageData.pixels; - imageData.pixels = (byte*)data; - imageData.format = format; - imageData.width = width; - imageData.height = height; - } - else - { - const char *err = stbi_failure_reason(); - if (err == nullptr) - err = "unknown error"; - throw Exception("Could not decode image with stb_image (%s).", err); - } - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/stb_decoder.h b/Source/Asura.Engine/graphics/stb_decoder.h deleted file mode 100644 index 57b247c..0000000 --- a/Source/Asura.Engine/graphics/stb_decoder.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_ENGINE_STBDECODER_H__ -#define __ASURA_ENGINE_STBDECODER_H__ - -#include "image_decoder.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// 使用stb_image解压JPEG、TGA、BMP文件 - /// - class STBDecoder ASURA_FINAL - : public ImageDecoder - { - public: - - bool CanDecode(const Filesystem::DataBuffer& buffer) override; - - void Decode(const Filesystem::DataBuffer& buffer, ImageData& data) override; - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/texture.cpp b/Source/Asura.Engine/graphics/texture.cpp deleted file mode 100644 index 6cb6497..0000000 --- a/Source/Asura.Engine/graphics/texture.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Texture.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Texture::Texture() - : mTextureHandle(0) - { - // 申请GL texture - glGenTextures(1, &mTextureHandle); - } - - Texture::~Texture() - { - glDeleteTextures(1, &mTextureHandle); - } - - GLuint Texture::GetGLTextureHandle() const - { - return mTextureHandle; - } - - } -} \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/texture.h b/Source/Asura.Engine/graphics/texture.h deleted file mode 100644 index 81aa469..0000000 --- a/Source/Asura.Engine/graphics/texture.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __ASURA_ENGINE_TEXTURE_H__ -#define __ASURA_ENGINE_TEXTURE_H__ - -#include "Config.h" -#include "Math/Rect.hpp" -#include "Math/Vector2.hpp" -#include "Scripting/Luax.hpp" -#include "RenderState.h" -#include "GL.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - class RenderTarget; - - /// - /// 2D纹理抽象类,在2d mesh和render target中被使用。Texture的渲染原点在左上角,游戏里面的上层会以笛卡尔坐标系为标准。 - /// 在Editor里面界面和组件也是以左上角为原点,这样是为了方便。 - /// - ASURA_ABSTRACT class Texture - { - public: - - Texture(); - - virtual ~Texture(); - - GLuint GetGLTextureHandle() const; - - /// - /// 渲染整个texture到rt上,原点在左上角,向右,向下延伸 - /// - virtual void Render(const RenderTarget* rt, const RenderState& state) = 0; - - /// - /// 渲染texture的一部分到rt上,原点在左上角,向右,向下延伸。 - /// - virtual void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) = 0; - - /// - /// 设置过滤方式 - /// - void SetSmooth(bool smooth); - - /// - /// 设置重复方式 - /// - void SetRepeated(); - - protected: - - /// - /// OpenGL texture handle。 - /// - GLuint mTextureHandle; - - }; - - using Drawable = Texture; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/graphics/window.cpp b/Source/Asura.Engine/graphics/window.cpp deleted file mode 100644 index bb941e1..0000000 --- a/Source/Asura.Engine/graphics/window.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "Config.h" -#include "Window.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - Window::Window(WindowStyle style) - { - //mWindowHandle = SDL_CreateWindow(); - } - - Window::~Window() - { - - } - - SDL_Window* Window::GetSDLWindowHandle() - { - return mWindowHandle; - } - - void Window::SetPosition(int x, int y) - { - ASSERT(mWindowHandle); - SDL_SetWindowPosition(mWindowHandle, x, y); - } - - void Window::SetTitle(const std::string& title) - { - - } - - void Window::Show() - { - - } - - void Window::Hide() - { - - } - - void Window::SetWindowStyle(WindowStyle style) - { - - } - - void Window::SwapRenderBuffer() - { - - } - - } -} diff --git a/Source/Asura.Engine/graphics/window.h b/Source/Asura.Engine/graphics/window.h deleted file mode 100644 index 973fd98..0000000 --- a/Source/Asura.Engine/graphics/window.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __ASURA_ENGINE_WINDOW_H__ -#define __ASURA_ENGINE_WINDOW_H__ - -#include "SDL2/Sdl.h" -#include "Graphics/RenderTarget.h" -#include "Math/Vector2.hpp" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - enum WindowStyle - { - WINDOW_STYLE_FULLSCREEN = 1 << 1, - }; - - /// - /// 窗口,支持多窗口。在编辑器下需要多个窗口支持,runner只需要一个窗口。 - /// - class Window ASURA_FINAL - : public RenderTarget - , public Scripting::Portable - { - public: - - Window(WindowStyle style); - - ~Window(); - - SDL_Window* GetSDLWindowHandle(); - - void SetSize(uint width, uint height); - - void SetPosition(int x, int y); - - void SetTitle(const std::string& title); - - void SetWindowStyle(WindowStyle style); - - void Show(); - - void Hide(); - - /// - /// 如果是开启双缓冲的窗口,需要交换缓冲区来展示到前台 - /// - void SwapRenderBuffer(); - - void Clear(const Color& col = Color::Black) override; - - void Clear(const Math::Recti& quad, const Color& col = Color::Black) override; - - void Draw(const Drawable* texture, const RenderState& state) override; - - void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) override; - - private: - - /// - /// SDL window handle. - /// - SDL_Window* mWindowHandle; - - Math::Vector2i mPosition; - - Math::Vector2i mSize; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Window); - - //---------------------------------------------------------------------------------------------------------- - - }; - - using RenderWindow = Window; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/input/clipboard.cpp b/Source/Asura.Engine/input/clipboard.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/input/clipboard.h b/Source/Asura.Engine/input/clipboard.h deleted file mode 100644 index 4cecd55..0000000 --- a/Source/Asura.Engine/input/clipboard.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __ASURA_ENGINE_CLIPBOARD_H__ -#define __ASURA_ENGINE_CLIPBOARD_H__ - -#include "Text/String.hpp" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Clipboard ASURA_FINAL : public InputDevice - { - public: - - Clipboard(); - - Text::String GetString(); - - void SetString(const Text::String& text); - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Clipboard); - - //---------------------------------------------------------------------------------------------------------- - - private: - - ~Clipboard(); - - }; - - }; -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/input/cursor.cpp b/Source/Asura.Engine/input/cursor.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/input/cursor.defs b/Source/Asura.Engine/input/cursor.defs deleted file mode 100644 index f8b8492..0000000 --- a/Source/Asura.Engine/input/cursor.defs +++ /dev/null @@ -1,25 +0,0 @@ - -// Types of system cursors. -enum SystemCursor -{ - CURSOR_ARROW, - CURSOR_IBEAM, - CURSOR_WAIT, - CURSOR_CROSSHAIR, - CURSOR_WAITARROW, - CURSOR_SIZENWSE, - CURSOR_SIZENESW, - CURSOR_SIZEWE, - CURSOR_SIZENS, - CURSOR_SIZEALL, - CURSOR_NO, - CURSOR_HAND, - CURSOR_MAX_ENUM -}; - -enum CursorType -{ - CURSORTYPE_SYSTEM, - CURSORTYPE_IMAGE, - CURSORTYPE_MAX_ENUM -}; diff --git a/Source/Asura.Engine/input/cursor.h b/Source/Asura.Engine/input/cursor.h deleted file mode 100644 index 7125869..0000000 --- a/Source/Asura.Engine/input/cursor.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __ASURA_ENGINE_CURSOR_H__ -#define __ASURA_ENGINE_CURSOR_H__ - -#include - -#include "Scripting/Portable.h" -#include "Graphics/ImageData.h" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Cursor : public Scripting::Portable - { - public: - - // 鼠标指针的相关枚举 - #include "Cursor.defs" - - Cursor(Graphics::ImageData& imageData, int hotx, int hoty); - Cursor(SystemCursor cursortype); - - ~Cursor(); - - SDL_Cursor* GetHandle() const; - CursorType GetType() const; - SystemCursor GetSystemType() const; - - private: - - SDL_Cursor* mCursorHandle; - - CursorType mType; - SystemCursor mSystemType; - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Cursor); - - LUAX_DECL_ENUM(EnumCursorType); - LUAX_DECL_ENUM(EnumSystemCursor); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/input/input_device.hpp b/Source/Asura.Engine/input/input_device.hpp deleted file mode 100644 index eb0b7a3..0000000 --- a/Source/Asura.Engine/input/input_device.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_INPUT_BASE_H__ -#define __ASURA_ENGINE_INPUT_BASE_H__ - -#include "Scripting/Portable.h" -#include "Config.h" -#include "Singleton.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - /// - /// 输入设备是一个单例 - /// - template - ASURA_ABSTRACT class InputDevice - : virtual public Scripting::Portable - , virtual public Singleton - { - public: - InputDevice(); - virtual ~InputDevice(); - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/input/keyboard.cpp b/Source/Asura.Engine/input/keyboard.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/input/keyboard.defs b/Source/Asura.Engine/input/keyboard.defs deleted file mode 100644 index 8f04dc2..0000000 --- a/Source/Asura.Engine/input/keyboard.defs +++ /dev/null @@ -1,482 +0,0 @@ - -/** -* 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/Asura.Engine/input/keyboard.h b/Source/Asura.Engine/input/keyboard.h deleted file mode 100644 index 488209b..0000000 --- a/Source/Asura.Engine/input/keyboard.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __ASURA_INPUT_KEYBOARD_H__ -#define __ASURA_INPUT_KEYBOARD_H__ - -#include - -#include "InputDevice.hpp" -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Input - { - - class Keyboard ASURA_FINAL : public InputDevice - { - public: - - // 键盘相关的枚举 - #include "Keyboard.defs" - - Keyboard(); - - void SetKeyRepeat(bool enable); - bool HasKeyRepeat() const; - bool IsDown(const std::vector &keylist) const; - bool IsScancodeDown(const std::vector &scancodelist) const; - - Key GetKeyFromScancode(Scancode scancode) const; - Scancode GetScancodeFromKey(Key key) const; - - void SetTextInput(bool enable); - void SetTextInput(bool enable, double x, double y, double w, double h); - bool HasTextInput() const; - bool HasScreenKeyboard() const; - - bool GetConstant(Scancode in, SDL_Scancode &out); - bool GetConstant(SDL_Scancode in, Scancode &out); - - private: - - ~Keyboard(); - - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Keyboard); // 通过AsuraEngine.Keyboard直接访问,没有New方法 - - LUAX_DECL_ENUM(Key); - LUAX_DECL_ENUM(ScanCode); - - LUAX_DECL_METHOD(SetKeyRepeat); - LUAX_DECL_METHOD(HasKeyRepeat); - LUAX_DECL_METHOD(IsDown); - LUAX_DECL_METHOD(IsScancodeDown); - - LUAX_DECL_METHOD(GetKeyFromScancode); - LUAX_DECL_METHOD(GetScancodeFromKey); - - LUAX_DECL_METHOD(SetTextInput); - LUAX_DECL_METHOD(HasTextInput); - LUAX_DECL_METHOD(HasScreenKeyboard); - - LUAX_DECL_METHOD(GetConstant); - - //---------------------------------------------------------------------------------------------------------- - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/input/mouse.cpp b/Source/Asura.Engine/input/mouse.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/input/mouse.h b/Source/Asura.Engine/input/mouse.h deleted file mode 100644 index 0f34fdd..0000000 --- a/Source/Asura.Engine/input/mouse.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __ASURA_ENGINE_MOUSE_H__ -#define __ASURA_ENGINE_MOUSE_H__ - -#include "Cursor.h" -#include "InputDevice.hpp" - -namespace AsuraEngine -{ - namespace Input - { - - class Mouse : public InputDevice - { - public: - - /// - /// 从图片数据中构建鼠标指针或者使用系统指针 - /// - Cursor *CreateCursor(Graphics::ImageData *data, int hotx, int hoty); - Cursor *GetSystemCursor(Cursor::SystemCursor cursortype); - - void SetCursor(Cursor *cursor); - void SetCursor() ; - - Cursor* GetCursor() const; - - bool IsCursorSupported() const; - - double GetX() const; - double GetY() const; - void GetPosition(double &x, double &y) const; - void GetX(double x) ; - void SetY(double y) ; - void SetPosition(double x, double y) ; - void SetVisible(bool visible) ; - bool IsDown(const std::vector &buttons) const; - bool IsVisible() const; - void SetGrabbed(bool grab) ; - bool IsGrabbed() const; - bool SetRelativeMode(bool relative) ; - bool GetRelativeMode() const; - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(Mouse); - - //---------------------------------------------------------------------------------------------------------- - - private: - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/manager.hpp b/Source/Asura.Engine/manager.hpp deleted file mode 100644 index 7b4e272..0000000 --- a/Source/Asura.Engine/manager.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_ENGINE_MANAGER_H__ -#define __ASURA_ENGINE_MANAGER_H__ - -namespace AsuraEngine -{ - - class Manager - { - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/curve.cpp b/Source/Asura.Engine/math/curve.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/curve.h b/Source/Asura.Engine/math/curve.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/functions.cpp b/Source/Asura.Engine/math/functions.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/functions.h b/Source/Asura.Engine/math/functions.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/matrix44.cpp b/Source/Asura.Engine/math/matrix44.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/matrix44.h b/Source/Asura.Engine/math/matrix44.h deleted file mode 100644 index 4ab3c0b..0000000 --- a/Source/Asura.Engine/math/matrix44.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __ASURA_ENGINE_MATRIX44_H__ -#define __ASURA_ENGINE_MATRIX44_H__ - -namespace AsuraEngine -{ - namespace Math - { - - /// - /// 4x4矩阵 - /// - class Matrix44 - { - public: - - private: - - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/ranged_value.cpp b/Source/Asura.Engine/math/ranged_value.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/ranged_value.h b/Source/Asura.Engine/math/ranged_value.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/rect.hpp b/Source/Asura.Engine/math/rect.hpp deleted file mode 100644 index f635007..0000000 --- a/Source/Asura.Engine/math/rect.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __ASURA_ENGINE_RECT_H__ -#define __ASURA_ENGINE_RECT_H__ - -namespace AsuraEngine -{ - namespace Math - { - - template - struct Rect - { - public: - Rect(); - ~Rect(T x, T y, T w, T h); - - template - explicit Rect(const Rect& rect); - - T x, y, w, h; - }; - -#include "Rect.inl" - - // Define the most common types - typedef Rect Recti; - typedef Rect Rectu; - typedef Rect Rectf; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/rect.inl b/Source/Asura.Engine/math/rect.inl deleted file mode 100644 index 891a3f8..0000000 --- a/Source/Asura.Engine/math/rect.inl +++ /dev/null @@ -1,19 +0,0 @@ -template -inline Rect::Rect() - : x(0) - , y(0) - , w(0) - , h(0) -{ - -} - -template -inline Rect::Rect(T X, T Y, T W, T H) - : x(X) - , y(Y) - , w(W) - , h(H) -{ - -} diff --git a/Source/Asura.Engine/math/transform.cpp b/Source/Asura.Engine/math/transform.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/math/transform.h b/Source/Asura.Engine/math/transform.h deleted file mode 100644 index 33c3d4b..0000000 --- a/Source/Asura.Engine/math/transform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_TRANSFORM_H__ -#define __ASURA_ENGINE_TRANSFORM_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Math - { - - class Transform - { - public: - - void Set(float x, float y, float sx, float sy, float ox, float oy, float r); - - void LoadIdentity(); - - void Move(float dx = 0, float dy = 0); - void Rotate(float r); - void Scale(float sx, float sy); - - float m[16]; //4x4 matrix - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/vector2.hpp b/Source/Asura.Engine/math/vector2.hpp deleted file mode 100644 index df78255..0000000 --- a/Source/Asura.Engine/math/vector2.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR2_H__ -#define __ASURA_ENGINE_VECTOR2_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector2 - { - public: - Vector2(); - Vector2(T X, T Y); - - template - explicit Vector2(const Vector2& vector); - - Set(T X, T Y); - - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - }; - - template - Vector2 operator -(const Vector2& right); - - template - Vector2& operator +=(Vector2& left, const Vector2& right); - - template - Vector2& operator -=(Vector2& left, const Vector2& right); - - template - Vector2 operator +(const Vector2& left, const Vector2& right); - - template - Vector2 operator -(const Vector2& left, const Vector2& right); - - template - Vector2 operator *(const Vector2& left, T right); - - template - Vector2 operator *(T left, const Vector2& right); - - template - Vector2& operator *=(Vector2& left, T right); - - template - Vector2 operator /(const Vector2& left, T right); - - template - Vector2& operator /=(Vector2& left, T right); - - template - bool operator ==(const Vector2& left, const Vector2& right); - - template - bool operator !=(const Vector2& left, const Vector2& right); - -#include "Vector2.inl" - - // Define the most common types - typedef Vector2 Vector2i; - typedef Vector2 Vector2u; - typedef Vector2 Vector2f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/vector2.inl b/Source/Asura.Engine/math/vector2.inl deleted file mode 100644 index 9e131a7..0000000 --- a/Source/Asura.Engine/math/vector2.inl +++ /dev/null @@ -1,114 +0,0 @@ -template -inline Vector2::Vector2() : - x(0), - y(0) -{ - -} - -template -inline Vector2::Vector2(T X, T Y) : - x(X), - y(Y) -{ - -} - -template -template -inline Vector2::Vector2(const Vector2& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)) -{ -} - -template -inline Vector2::Set(T X, T Y) -{ - x = X; - y = Y; -} - -template -inline Vector2 operator -(const Vector2& right) -{ - return Vector2(-right.x, -right.y); -} - -template -inline Vector2& operator +=(Vector2& left, const Vector2& right) -{ - left.x += right.x; - left.y += right.y; - - return left; -} - -template -inline Vector2& operator -=(Vector2& left, const Vector2& right) -{ - left.x -= right.x; - left.y -= right.y; - - return left; -} - -template -inline Vector2 operator +(const Vector2& left, const Vector2& right) -{ - return Vector2(left.x + right.x, left.y + right.y); -} - -template -inline Vector2 operator -(const Vector2& left, const Vector2& right) -{ - return Vector2(left.x - right.x, left.y - right.y); -} - -template -inline Vector2 operator *(const Vector2& left, T right) -{ - return Vector2(left.x * right, left.y * right); -} - -template -inline Vector2 operator *(T left, const Vector2& right) -{ - return Vector2(right.x * left, right.y * left); -} - -template -inline Vector2& operator *=(Vector2& left, T right) -{ - left.x *= right; - left.y *= right; - - return left; -} - -template -inline Vector2 operator /(const Vector2& left, T right) -{ - return Vector2(left.x / right, left.y / right); -} - -template -inline Vector2& operator /=(Vector2& left, T right) -{ - left.x /= right; - left.y /= right; - - return left; -} - -template -inline bool operator ==(const Vector2& left, const Vector2& right) -{ - return (left.x == right.x) && (left.y == right.y); -} - -template -inline bool operator !=(const Vector2& left, const Vector2& right) -{ - return (left.x != right.x) || (left.y != right.y); -} diff --git a/Source/Asura.Engine/math/vector3.hpp b/Source/Asura.Engine/math/vector3.hpp deleted file mode 100644 index 2b23406..0000000 --- a/Source/Asura.Engine/math/vector3.hpp +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR3_H__ -#define __ASURA_ENGINE_VECTOR3_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector3 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector3(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector3(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector3(T X, T Y, T Z); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template - explicit Vector3(const Vector3& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator -(const Vector3& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator +=(Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator -=(Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator +(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator -(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator *(const Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator *(T left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator *=(Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector3 operator /(const Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector3& operator /=(Vector3& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator ==(const Vector3& left, const Vector3& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator !=(const Vector3& left, const Vector3& right); - -#include "Vector3.inl" - - // Define the most common types - typedef Vector3 Vector3i; - typedef Vector3 Vector3f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/vector3.inl b/Source/Asura.Engine/math/vector3.inl deleted file mode 100644 index 3a2aa93..0000000 --- a/Source/Asura.Engine/math/vector3.inl +++ /dev/null @@ -1,145 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template -inline Vector3::Vector3() : - x(0), - y(0), - z(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3::Vector3(T X, T Y, T Z) : - x(X), - y(Y), - z(Z) -{ - -} - - -//////////////////////////////////////////////////////////// -template -template -inline Vector3::Vector3(const Vector3& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)), - z(static_cast(vector.z)) -{ -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator -(const Vector3& left) -{ - return Vector3(-left.x, -left.y, -left.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator +=(Vector3& left, const Vector3& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator -=(Vector3& left, const Vector3& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator +(const Vector3& left, const Vector3& right) -{ - return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator -(const Vector3& left, const Vector3& right) -{ - return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator *(const Vector3& left, T right) -{ - return Vector3(left.x * right, left.y * right, left.z * right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator *(T left, const Vector3& right) -{ - return Vector3(right.x * left, right.y * left, right.z * left); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator *=(Vector3& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3 operator /(const Vector3& left, T right) -{ - return Vector3(left.x / right, left.y / right, left.z / right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector3& operator /=(Vector3& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator ==(const Vector3& left, const Vector3& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator !=(const Vector3& left, const Vector3& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); -} diff --git a/Source/Asura.Engine/math/vector4.h b/Source/Asura.Engine/math/vector4.h deleted file mode 100644 index 13a9d8a..0000000 --- a/Source/Asura.Engine/math/vector4.h +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR4_H__ -#define __ASURA_ENGINE_VECTOR4_H__ - -namespace AsuraEngine -{ - namespace Math - { - template - class Vector4 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector4(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector4(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector4(T X, T Y, T Z, T W); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template - explicit Vector4(const Vector4& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - T w; ///< W coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator -(const Vector4& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator +=(Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator -=(Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator +(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator -(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator *(const Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator *(T left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator *=(Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template - Vector4 operator /(const Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template - Vector4& operator /=(Vector4& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator ==(const Vector4& left, const Vector4& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template - bool operator !=(const Vector4& left, const Vector4& right); - -#include "Vector4.inl" - - // Define the most common types - typedef Vector4 Vector4i; - typedef Vector4 Vector4f; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/math/vector4.inl b/Source/Asura.Engine/math/vector4.inl deleted file mode 100644 index 025bfcc..0000000 --- a/Source/Asura.Engine/math/vector4.inl +++ /dev/null @@ -1,152 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template -inline Vector4::Vector4() : - x(0), - y(0), - z(0), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4::Vector4(T X, T Y, T Z) : - x(X), - y(Y), - z(Z), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template -template -inline Vector4::Vector4(const Vector4& vector) : - x(static_cast(vector.x)), - y(static_cast(vector.y)), - z(static_cast(vector.z)) - w(static_cast(vector.w)) -{ -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator -(const Vector4& left) -{ - return Vector4(-left.x, -left.y, -left.z, -left.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator +=(Vector4& left, const Vector4& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - left.w += right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator -=(Vector4& left, const Vector4& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - left.w -= right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator +(const Vector4& left, const Vector4& right) -{ - return Vector4(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator -(const Vector4& left, const Vector4& right) -{ - return Vector4(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator *(const Vector4& left, T right) -{ - return Vector4(left.x * right, left.y * right, left.z * right, left.w * right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator *(T left, const Vector4& right) -{ - return Vector4(right.x * left, right.y * left, right.z * left, right.w * left); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator *=(Vector4& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - left.w *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4 operator /(const Vector4& left, T right) -{ - return Vector4(left.x / right, left.y / right, left.z / right, left.w / right); -} - - -//////////////////////////////////////////////////////////// -template -inline Vector4& operator /=(Vector4& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - left.w /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator ==(const Vector4& left, const Vector4& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z) && (left.w == right.w); -} - - -//////////////////////////////////////////////////////////// -template -inline bool operator !=(const Vector4& left, const Vector4& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z) || (left.w != right.w); -} diff --git a/Source/Asura.Engine/physics/world.h b/Source/Asura.Engine/physics/world.h deleted file mode 100644 index 971adce..0000000 --- a/Source/Asura.Engine/physics/world.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __ASURA_ENGINE_WORLD_H__ -#define __ASURA_ENGINE_WORLD_H__ - -#include "Box2D/Box2D.h" -#include "scripting/luax.hpp" - -namespace AsuraEngine -{ - namespace Physics - { - - class World - { - public: - - private: - - LUAX_DECL_FACTORY(SimWorld); //AsuraEngine.SimWorld - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/profiler/stats.cpp b/Source/Asura.Engine/profiler/stats.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/profiler/stats.h b/Source/Asura.Engine/profiler/stats.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/scripting/luax.hpp b/Source/Asura.Engine/scripting/luax.hpp deleted file mode 100644 index 2bb1160..0000000 --- a/Source/Asura.Engine/scripting/luax.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __ASURA_ENGINE_LUAX_H__ -#define __ASURA_ENGINE_LUAX_H__ - -/// -/// Scripting with Lua. -/// -extern "C" { -#include "Lua51/lua.h" -#include "Lua51/lauxlib.h" -} -#include "Luax/luax.h" - -/// -/// 暴露给lua的类用poartable派生 -/// -#include "Portable.h" - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/scripting/portable.hpp b/Source/Asura.Engine/scripting/portable.hpp deleted file mode 100644 index df0b878..0000000 --- a/Source/Asura.Engine/scripting/portable.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __ASURA_ENGINE_PORTABLE_H__ -#define __ASURA_ENGINE_PORTABLE_H__ - -#include "Config.h" -#include "Luax.hpp" -#include "Type.h" - -namespace AsuraEngine -{ - namespace Scripting - { - - /// - /// 向lua注册的native class需要继承此类。 - /// - template - class Portable : public Luax::LuaxNativeClass - { - public: - - Portable(); - virtual ~Portable(); -/* - /// - /// 在多个线程间 - /// - void Retain(); - void Release(); -*/ - private: -/* - /// - /// 多线程保护,lua调用gc后,如果在其他线程用了此native object,不会调用delete。 - /// - int mRefCount; - - /// - /// delete保险,继承portable的类,无法使用delete,只能使用Release。 - /// - bool mSafer; -*/ - }; - -#include "portable.inl" - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/scripting/portable.inl b/Source/Asura.Engine/scripting/portable.inl deleted file mode 100644 index f73046a..0000000 --- a/Source/Asura.Engine/scripting/portable.inl +++ /dev/null @@ -1,31 +0,0 @@ -/* -template -Portable::Portable() - : mRefCount(1) - , mSafer(false) -{ -} - -template -Portable::~Portable() -{ - ASSERT(mSafer); -} - -template -void Portable::Retain() -{ - ++mRefCount; -} - -template -void Portable::Release() -{ - if (--mRefCount <= 0) - { - mSafer = true; - delete this; - } -} - -*/ \ No newline at end of file diff --git a/Source/Asura.Engine/scripting/type.h b/Source/Asura.Engine/scripting/type.h deleted file mode 100644 index 0665810..0000000 --- a/Source/Asura.Engine/scripting/type.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_SCRIPTING_TYPE_H__ -#define __ASURA_SCRIPTING_TYPE_H__ - -namespace AsuraEngine -{ - namespace Scripting - { - - class Type - { - - }; - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/singleton.hpp b/Source/Asura.Engine/singleton.hpp deleted file mode 100644 index 756209a..0000000 --- a/Source/Asura.Engine/singleton.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __ASURA_SINGLETON_H__ -#define __ASURA_SINGLETON_H__ - -#include "Config.h" - -namespace AsuraEngine -{ - - /// - /// 继承Singleton的类在第一次实例化时保存实例,之后如果再次实例化会报错。 - /// - template - class Singleton - { - public: - - static T* Get() - { - // 如果之前没有创建,在这里立即创建一个并保存 - if (!instance) instance = new T; - // 返回实例 - return instance; - } - - static void Destroy() - { - delete instance; - instance = nullptr; - } - - protected: - - Singleton() - { - // 如果有instance,意味着又创建了一个实例,这是错误的。 - ASSERT(!instance); - // 否则,将本实体作为实例 - instance = static_cast(this); - }; - - virtual ~Singleton() {}; - - static T* instance; - - private: - - Singleton(const Singleton& singleton); - - Singleton& operator = (const Singleton& singleton); - - }; - - // 实例初始化为空 - template - T* Singleton::instance = nullptr; - -} - -#endif // __ASURA_SINGLETON_H__ \ No newline at end of file diff --git a/Source/Asura.Engine/stringmap.cpp b/Source/Asura.Engine/stringmap.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/stringmap.hpp b/Source/Asura.Engine/stringmap.hpp deleted file mode 100644 index ddba128..0000000 --- a/Source/Asura.Engine/stringmap.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ASURA_ENGINE_STRINGMAP_H__ -#define __ASURA_ENGINE_STRINGMAP_H__ - -#include - -namespace AsuraEngine -{ - - /// - /// 一个双向一一对应的映射,用来储存shader uniforms、statemathine state parameter的ID。 - /// - template - class StringMap - { - public: - - bool ContainsKey(const key_type& key); - - bool ContainsString(const String& str); - - std::string GetStringByKey(const key_type& key); - - key_type GetKeyByString(const String& str); - - }; - -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/text/glyph.cpp b/Source/Asura.Engine/text/glyph.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/text/glyph.h b/Source/Asura.Engine/text/glyph.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/text/string.cpp b/Source/Asura.Engine/text/string.cpp deleted file mode 100644 index 8c9c55a..0000000 --- a/Source/Asura.Engine/text/string.cpp +++ /dev/null @@ -1,376 +0,0 @@ -#include "String.hpp" -#include "Utf.hpp" - -namespace AsuraEngine -{ - namespace Text - { - - - //////////////////////////////////////////////////////////// - const std::size_t String::InvalidPos = std::basic_string::npos; - - - //////////////////////////////////////////////////////////// - String::String() - { - } - - - //////////////////////////////////////////////////////////// - String::String(char ansiChar, const std::locale& locale) - { - mString += Utf32::DecodeAnsi(ansiChar, locale); - } - - - //////////////////////////////////////////////////////////// - String::String(wchar_t wideChar) - { - mString += Utf32::DecodeWide(wideChar); - } - - - //////////////////////////////////////////////////////////// - String::String(uint32 utf32Char) - { - mString += utf32Char; - } - - - //////////////////////////////////////////////////////////// - String::String(const char* ansiString, const std::locale& locale) - { - if (ansiString) - { - std::size_t length = strlen(ansiString); - if (length > 0) - { - mString.reserve(length + 1); - Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale); - } - } - } - - - //////////////////////////////////////////////////////////// - String::String(const std::string& ansiString, const std::locale& locale) - { - mString.reserve(ansiString.length() + 1); - Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale); - } - - - //////////////////////////////////////////////////////////// - String::String(const wchar_t* wideString) - { - if (wideString) - { - std::size_t length = std::wcslen(wideString); - if (length > 0) - { - mString.reserve(length + 1); - Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString)); - } - } - } - - - //////////////////////////////////////////////////////////// - String::String(const std::wstring& wideString) - { - mString.reserve(wideString.length() + 1); - Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString)); - } - - - //////////////////////////////////////////////////////////// - String::String(const uint32* utf32String) - { - if (utf32String) - mString = utf32String; - } - - - //////////////////////////////////////////////////////////// - String::String(const std::basic_string& utf32String) : - mString(utf32String) - { - } - - - //////////////////////////////////////////////////////////// - String::String(const String& copy) : - mString(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(mString.length() + 1); - - // Convert - Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::wstring String::ToWideString() const - { - // Prepare the output string - std::wstring output; - output.reserve(mString.length() + 1); - - // Convert - Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf8() const - { - // Prepare the output string - std::basic_string output; - output.reserve(mString.length()); - - // Convert - Utf32::ToUtf8(mString.begin(), mString.end(), std::back_inserter(output)); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf16() const - { - // Prepare the output string - std::basic_string output; - output.reserve(mString.length()); - - // Convert - Utf32::ToUtf16(mString.begin(), mString.end(), std::back_inserter(output)); - - return output; - } - - - //////////////////////////////////////////////////////////// - std::basic_string String::ToUtf32() const - { - return mString; - } - - - //////////////////////////////////////////////////////////// - String& String::operator =(const String& right) - { - mString = right.mString; - return *this; - } - - - //////////////////////////////////////////////////////////// - String& String::operator +=(const String& right) - { - mString += right.mString; - return *this; - } - - - //////////////////////////////////////////////////////////// - uint32 String::operator [](std::size_t index) const - { - return mString[index]; - } - - - //////////////////////////////////////////////////////////// - uint32& String::operator [](std::size_t index) - { - return mString[index]; - } - - - //////////////////////////////////////////////////////////// - void String::Clear() - { - mString.clear(); - } - - - //////////////////////////////////////////////////////////// - std::size_t String::GetSize() const - { - return mString.size(); - } - - - //////////////////////////////////////////////////////////// - bool String::IsEmpty() const - { - return mString.empty(); - } - - - //////////////////////////////////////////////////////////// - void String::Erase(std::size_t position, std::size_t count) - { - mString.erase(position, count); - } - - - //////////////////////////////////////////////////////////// - void String::Insert(std::size_t position, const String& str) - { - mString.insert(position, str.mString); - } - - - //////////////////////////////////////////////////////////// - std::size_t String::Find(const String& str, std::size_t start) const - { - return mString.find(str.mString, start); - } - - - //////////////////////////////////////////////////////////// - void String::Replace(std::size_t position, std::size_t length, const String& replaceWith) - { - mString.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 mString.substr(position, length); - } - - - //////////////////////////////////////////////////////////// - const uint32* String::GetData() const - { - return mString.c_str(); - } - - - //////////////////////////////////////////////////////////// - String::Iterator String::Begin() - { - return mString.begin(); - } - - - //////////////////////////////////////////////////////////// - String::ConstIterator String::Begin() const - { - return mString.begin(); - } - - - //////////////////////////////////////////////////////////// - String::Iterator String::End() - { - return mString.end(); - } - - - //////////////////////////////////////////////////////////// - String::ConstIterator String::End() const - { - return mString.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/Asura.Engine/text/string.hpp b/Source/Asura.Engine/text/string.hpp deleted file mode 100644 index 226735b..0000000 --- a/Source/Asura.Engine/text/string.hpp +++ /dev/null @@ -1,594 +0,0 @@ -#ifndef __ASURA_ENGINE_STRING_H__ -#define __ASURA_ENGINE_STRING_H__ - -#include "Config.h" -#include -#include -#include - -namespace AsuraEngine -{ - namespace Text - { - - - //////////////////////////////////////////////////////////// - /// \brief Utility string class that automatically handles - /// conversions between types and encodings - /// - //////////////////////////////////////////////////////////// - class String - { - public: - - //////////////////////////////////////////////////////////// - // Types - //////////////////////////////////////////////////////////// - typedef std::basic_string::iterator Iterator; ///< Iterator type - typedef std::basic_string::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& 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 - 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 - 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. - /// - /// \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 - 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 ToUtf8() const; - - //////////////////////////////////////////////////////////// - /// \brief Convert the Unicode string to a UTF-16 string - /// - /// \return Converted UTF-16 string - /// - /// \see toUtf8, toUtf32 - /// - //////////////////////////////////////////////////////////// - std::basic_string 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 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 mString; ///< 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.inl" - - } -} - -#endif \ No newline at end of file diff --git a/Source/Asura.Engine/text/string.inl b/Source/Asura.Engine/text/string.inl deleted file mode 100644 index ef18228..0000000 --- a/Source/Asura.Engine/text/string.inl +++ /dev/null @@ -1,29 +0,0 @@ - -//////////////////////////////////////////////////////////// -template -String String::fromUtf8(T begin, T end) -{ - String string; - Utf8::toUtf32(begin, end, std::back_inserter(string.m_string)); - return string; -} - - -//////////////////////////////////////////////////////////// -template -String String::fromUtf16(T begin, T end) -{ - String string; - Utf16::toUtf32(begin, end, std::back_inserter(string.m_string)); - return string; -} - - -//////////////////////////////////////////////////////////// -template -String String::fromUtf32(T begin, T end) -{ - String string; - string.m_string.assign(begin, end); - return string; -} diff --git a/Source/Asura.Engine/text/ttf.cpp b/Source/Asura.Engine/text/ttf.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/text/ttf.h b/Source/Asura.Engine/text/ttf.h deleted file mode 100644 index 840b63e..0000000 --- a/Source/Asura.Engine/text/ttf.h +++ /dev/null @@ -1,17 +0,0 @@ -#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/Asura.Engine/text/utf.hpp b/Source/Asura.Engine/text/utf.hpp deleted file mode 100644 index 2e04ee4..0000000 --- a/Source/Asura.Engine/text/utf.hpp +++ /dev/null @@ -1,720 +0,0 @@ -#ifndef __ASURA_UTF_HPP__ -#define __ASURA_UTF_HPP__ - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include -#include -#include -#include - -namespace AsuraEngine -{ - namespace Text - { - - template - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); - }; - -#include "Utf.inl" - - // 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/Asura.Engine/text/utf.inl b/Source/Asura.Engine/text/utf.inl deleted file mode 100644 index 69a523b..0000000 --- a/Source/Asura.Engine/text/utf.inl +++ /dev/null @@ -1,752 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2019 Laurent Gomila (laurent@sfml-dev.org) -// -// This software is provided 'as-is', without any express or implied warranty. -// In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it freely, -// subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; -// you must not claim that you wrote the original software. -// If you use this software in a product, an acknowledgment -// in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, -// and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -// -//////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////// -// References: -// -// https://www.unicode.org/ -// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c -// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h -// https://people.w3.org/rishida/scripts/uniview/conversion -// -//////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////// -template -In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement) -{ - // Some useful precomputed data - static const int trailing[256] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 - }; - static const Uint32 offsets[6] = - { - 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080 - }; - - // decode the character - int trailingBytes = trailing[static_cast(*begin)]; - if (begin + trailingBytes < end) - { - output = 0; - switch (trailingBytes) - { - case 5: output += static_cast(*begin++); output <<= 6; - case 4: output += static_cast(*begin++); output <<= 6; - case 3: output += static_cast(*begin++); output <<= 6; - case 2: output += static_cast(*begin++); output <<= 6; - case 1: output += static_cast(*begin++); output <<= 6; - case 0: output += static_cast(*begin++); - } - output -= offsets[trailingBytes]; - } - else - { - // Incomplete character - begin = end; - output = replacement; - } - - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement) -{ - // Some useful precomputed data - static const Uint8 firstBytes[7] = - { - 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC - }; - - // encode the character - if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) - { - // Invalid character - if (replacement) - *output++ = replacement; - } - else - { - // Valid character - - // Get the number of bytes to write - std::size_t bytestoWrite = 1; - if (input < 0x80) bytestoWrite = 1; - else if (input < 0x800) bytestoWrite = 2; - else if (input < 0x10000) bytestoWrite = 3; - else if (input <= 0x0010FFFF) bytestoWrite = 4; - - // Extract the bytes to write - Uint8 bytes[4]; - switch (bytestoWrite) - { - case 4: bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 3: bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 2: bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; - case 1: bytes[0] = static_cast (input | firstBytes[bytestoWrite]); - } - - // Add them to the output - output = std::copy(bytes, bytes + bytestoWrite, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<8>::Next(In begin, In end) -{ - Uint32 codepoint; - return Decode(begin, end, codepoint); -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<8>::Count(In begin, In end) -{ - std::size_t length = 0; - while (begin < end) - { - begin = Next(begin, end); - ++length; - } - - return length; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeWide(*begin++); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - output = Encode(*begin++, output); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeWide(codepoint, output, replacement); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint < 256 ? static_cast(codepoint) : replacement; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf8(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf16(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<16>::Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<8>::ToUtf32(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<16>::Decode(In begin, In end, Uint32& output, Uint32 replacement) -{ - Uint16 first = *begin++; - - // If it's a surrogate pair, first convert to a single UTF-32 character - if ((first >= 0xD800) && (first <= 0xDBFF)) - { - if (begin < end) - { - Uint32 second = *begin++; - if ((second >= 0xDC00) && (second <= 0xDFFF)) - { - // The second element is valid: convert the two elements to a UTF-32 character - output = ((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000; - } - else - { - // Invalid character - output = replacement; - } - } - else - { - // Invalid character - begin = end; - output = replacement; - } - } - else - { - // We can make a direct copy - output = first; - } - - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::Encode(Uint32 input, Out output, Uint16 replacement) -{ - if (input <= 0xFFFF) - { - // The character can be copied directly, we just need to check if it's in the valid range - if ((input >= 0xD800) && (input <= 0xDFFF)) - { - // Invalid character (this range is reserved) - if (replacement) - *output++ = replacement; - } - else - { - // Valid character directly convertible to a single UTF-16 character - *output++ = static_cast(input); - } - } - else if (input > 0x0010FFFF) - { - // Invalid character (greater than the maximum Unicode value) - if (replacement) - *output++ = replacement; - } - else - { - // The input character will be converted to two UTF-16 elements - input -= 0x0010000; - *output++ = static_cast((input >> 10) + 0xD800); - *output++ = static_cast((input & 0x3FFUL) + 0xDC00); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<16>::Next(In begin, In end) -{ - Uint32 codepoint; - return Decode(begin, end, codepoint); -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<16>::Count(In begin, In end) -{ - std::size_t length = 0; - while (begin < end) - { - begin = Next(begin, end); - ++length; - } - - return length; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint = Utf<32>::DecodeWide(*begin++); - output = Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<32>::EncodeWide(codepoint, output, replacement); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - *output++ = *begin < 256 ? static_cast(*begin) : replacement; - begin++; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf8(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - output = Utf<8>::Encode(codepoint, output); - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf16(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<16>::ToUtf32(In begin, In end, Out output) -{ - while (begin < end) - { - Uint32 codepoint; - begin = Decode(begin, end, codepoint); - *output++ = codepoint; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<32>::Decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/) -{ - output = *begin++; - return begin; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::Encode(Uint32 input, Out output, Uint32 /*replacement*/) -{ - *output++ = input; - return output; -} - - -//////////////////////////////////////////////////////////// -template -In Utf<32>::Next(In begin, In /*end*/) -{ - return ++begin; -} - - -//////////////////////////////////////////////////////////// -template -std::size_t Utf<32>::Count(In begin, In end) -{ - return begin - end; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromAnsi(In begin, In end, Out output, const std::locale& locale) -{ - while (begin < end) - *output++ = DecodeAnsi(*begin++, locale); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromWide(In begin, In end, Out output) -{ - while (begin < end) - *output++ = DecodeWide(*begin++); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::FromLatin1(In begin, In end, Out output) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) -{ - while (begin < end) - output = EncodeAnsi(*begin++, output, replacement, locale); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToWide(In begin, In end, Out output, wchar_t replacement) -{ - while (begin < end) - output = EncodeWide(*begin++, output, replacement); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToLatin1(In begin, In end, Out output, char replacement) -{ - // Latin-1 is directly compatible with Unicode encodings, - // and can thus be treated as (a sub-range of) UTF-32 - while (begin < end) - { - *output++ = *begin < 256 ? static_cast(*begin) : replacement; - begin++; - } - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf8(In begin, In end, Out output) -{ - while (begin < end) - output = Utf<8>::Encode(*begin++, output); - - return output; -} - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf16(In begin, In end, Out output) -{ - while (begin < end) - output = Utf<16>::Encode(*begin++, output); - - return output; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::ToUtf32(In begin, In end, Out output) -{ - return std::copy(begin, end, output); -} - - -//////////////////////////////////////////////////////////// -template -Uint32 Utf<32>::DecodeAnsi(In input, const std::locale& locale) -{ - // On Windows, GCC's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - - #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - (void)locale; // to avoid warnings - - wchar_t character = 0; - mbtowc(&character, &input, 1); - return static_cast(character); - - #else - - // Get the facet of the locale which deals with character conversion - const std::ctype& facet = std::use_facet< std::ctype >(locale); - - // Use the facet to convert each character of the input string - return static_cast(facet.widen(input)); - - #endif -} - - -//////////////////////////////////////////////////////////// -template -Uint32 Utf<32>::DecodeWide(In input) -{ - // The encoding of wide characters is not well defined and is left to the system; - // however we can safely assume that it is UCS-2 on Windows and - // UCS-4 on Unix systems. - // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4, - // and UCS-4 *is* UTF-32). - - return input; -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::EncodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale) -{ - // On Windows, gcc's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - - #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - (void)locale; // to avoid warnings - - char character = 0; - if (wctomb(&character, static_cast(codepoint)) >= 0) - *output++ = character; - else if (replacement) - *output++ = replacement; - - return output; - - #else - - // Get the facet of the locale which deals with character conversion - const std::ctype& facet = std::use_facet< std::ctype >(locale); - - // Use the facet to convert each character of the input string - *output++ = facet.narrow(static_cast(codepoint), replacement); - - return output; - - #endif -} - - -//////////////////////////////////////////////////////////// -template -Out Utf<32>::EncodeWide(Uint32 codepoint, Out output, wchar_t replacement) -{ - // The encoding of wide characters is not well defined and is left to the system; - // however we can safely assume that it is UCS-2 on Windows and - // UCS-4 on Unix systems. - // For UCS-2 we need to check if the source characters fits in (UCS-2 is a subset of UCS-4). - // For UCS-4 we can do a direct copy (UCS-4 *is* UTF-32). - - switch (sizeof(wchar_t)) - { - case 4: - { - *output++ = static_cast(codepoint); - break; - } - - default: - { - if ((codepoint <= 0xFFFF) && ((codepoint < 0xD800) || (codepoint > 0xDFFF))) - { - *output++ = static_cast(codepoint); - } - else if (replacement) - { - *output++ = replacement; - } - break; - } - } - - return output; -} diff --git a/Source/Asura.Engine/time/timer.cpp b/Source/Asura.Engine/time/timer.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/time/timer.h b/Source/Asura.Engine/time/timer.h deleted file mode 100644 index e69de29..0000000 diff --git a/Source/Asura.Engine/type.h b/Source/Asura.Engine/type.h deleted file mode 100644 index 88848d5..0000000 --- a/Source/Asura.Engine/type.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __ASURA_ENGINE_TYPE_H__ -#define __ASURA_ENGINE_TYPE_H__ - -#include - -namespace AsuraEngine -{ - -} - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0