aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-19 08:36:44 +0800
committerchai <chaifix@163.com>2018-10-19 08:36:44 +0800
commit7d5f055547e70fa93ee9ac944e62f8d657b9dc55 (patch)
tree081782a1541854db4b8eb69c4b43081f52711286
parent02dd1f38008594048f0e28bad01e7c6d18844198 (diff)
*修改文件名
-rw-r--r--src/libjin/Audio/SDL/je_sdl_audio.cpp (renamed from src/libjin/Audio/SDL/SDLAudio.cpp)12
-rw-r--r--src/libjin/Audio/SDL/je_sdl_audio.h (renamed from src/libjin/Audio/SDL/SDLAudio.h)8
-rw-r--r--src/libjin/Audio/SDL/je_sdl_source.cpp (renamed from src/libjin/Audio/SDL/SDLSource.cpp)14
-rw-r--r--src/libjin/Audio/SDL/je_sdl_source.h (renamed from src/libjin/Audio/SDL/SDLSource.h)4
-rw-r--r--src/libjin/Audio/Source.h47
-rw-r--r--src/libjin/Audio/je_audio.cpp (renamed from src/libjin/Audio/Audio.cpp)4
-rw-r--r--src/libjin/Audio/je_audio.h (renamed from src/libjin/Audio/Audio.h)9
-rw-r--r--src/libjin/Audio/je_source.cpp (renamed from src/libjin/Audio/Source.cpp)5
-rw-r--r--src/libjin/Audio/je_source.h (renamed from src/libjin/audio/source.h)2
-rw-r--r--src/libjin/Common/je_array.hpp (renamed from src/libjin/Common/Array.hpp)23
-rw-r--r--src/libjin/Common/je_common.h (renamed from src/libjin/Common/common.h)2
-rw-r--r--src/libjin/Common/je_exception.cpp (renamed from src/libjin/Common/Exception.cpp)0
-rw-r--r--src/libjin/Common/je_exception.h (renamed from src/libjin/Common/Exception.h)0
-rw-r--r--src/libjin/Common/je_object.cpp (renamed from src/libjin/Common/Object.cpp)2
-rw-r--r--src/libjin/Common/je_object.h (renamed from src/libjin/Common/Object.h)0
-rw-r--r--src/libjin/Common/je_singleton.hpp (renamed from src/libjin/Common/Singleton.hpp)0
-rw-r--r--src/libjin/Common/je_stringmap.hpp (renamed from src/libjin/Common/StringMap.hpp)0
-rw-r--r--src/libjin/Common/je_subsystem.hpp (renamed from src/libjin/Common/Subsystem.hpp)5
-rw-r--r--src/libjin/Common/je_types.h (renamed from src/libjin/Common/types.h)0
-rw-r--r--src/libjin/Common/je_utf8.cpp (renamed from src/libjin/Common/utf8.cpp)4
-rw-r--r--src/libjin/Common/je_utf8.h (renamed from src/libjin/Common/utf8.h)2
-rw-r--r--src/libjin/Filesystem/je_buffer.h (renamed from src/libjin/Filesystem/Buffer.h)0
-rw-r--r--src/libjin/Filesystem/je_filesystem.cpp (renamed from src/libjin/Filesystem/Filesystem.cpp)3
-rw-r--r--src/libjin/Filesystem/je_filesystem.h (renamed from src/libjin/Filesystem/Filesystem.h)2
-rw-r--r--src/libjin/Game/je_game.cpp (renamed from src/libjin/Game/Game.cpp)12
-rw-r--r--src/libjin/Game/je_game.h (renamed from src/libjin/Game/Game.h)8
-rw-r--r--src/libjin/Graphics/Font/Decoder.h44
-rw-r--r--src/libjin/Graphics/Font/Page.h38
-rw-r--r--src/libjin/Graphics/Font/je_decoder.cpp (renamed from src/libjin/Graphics/Font/Decoder.cpp)2
-rw-r--r--src/libjin/Graphics/Font/je_decoder.h88
-rw-r--r--src/libjin/Graphics/Font/je_font.h (renamed from src/libjin/Graphics/Font/Font.h)6
-rw-r--r--src/libjin/Graphics/Font/je_page.h51
-rw-r--r--src/libjin/Graphics/Font/je_text.cpp (renamed from src/libjin/Graphics/Font/Text.cpp)4
-rw-r--r--src/libjin/Graphics/Font/je_text.h (renamed from src/libjin/Graphics/Font/Text.h)15
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.cpp (renamed from src/libjin/Graphics/Font/TextureFont.cpp)8
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.h (renamed from src/libjin/Graphics/Font/TextureFont.h)23
-rw-r--r--src/libjin/Graphics/Font/je_ttf.cpp (renamed from src/libjin/Graphics/Font/TTF.cpp)18
-rw-r--r--src/libjin/Graphics/Font/je_ttf.h (renamed from src/libjin/Graphics/Font/TTF.h)16
-rw-r--r--src/libjin/Graphics/Graphics.h21
-rw-r--r--src/libjin/Graphics/Shader/je_base.shader.h (renamed from src/libjin/Graphics/Shader/base.shader.h)0
-rw-r--r--src/libjin/Graphics/Shader/je_default.shader.h (renamed from src/libjin/Graphics/Shader/default.shader.h)0
-rw-r--r--src/libjin/Graphics/Shader/je_font.shader.h (renamed from src/libjin/Graphics/Shader/font.shader.h)0
-rw-r--r--src/libjin/Graphics/Shader/je_shader.cpp (renamed from src/libjin/Graphics/Shader/Shader.cpp)12
-rw-r--r--src/libjin/Graphics/Shader/je_shader.h (renamed from src/libjin/Graphics/Shader/Shader.h)13
-rw-r--r--src/libjin/Graphics/Shader/je_texture.shader.h (renamed from src/libjin/Graphics/Shader/texture.shader.h)0
-rw-r--r--src/libjin/Graphics/Window.h56
-rw-r--r--src/libjin/Graphics/je_bitmap.cpp (renamed from src/libjin/Graphics/Bitmap.cpp)5
-rw-r--r--src/libjin/Graphics/je_bitmap.h (renamed from src/libjin/Graphics/Bitmap.h)6
-rw-r--r--src/libjin/Graphics/je_canvas.cpp (renamed from src/libjin/Graphics/Canvas.cpp)8
-rw-r--r--src/libjin/Graphics/je_canvas.h (renamed from src/libjin/Graphics/Canvas.h)4
-rw-r--r--src/libjin/Graphics/je_color.cpp (renamed from src/libjin/Graphics/Color.cpp)2
-rw-r--r--src/libjin/Graphics/je_color.h (renamed from src/libjin/Graphics/Color.h)4
-rw-r--r--src/libjin/Graphics/je_drawable.cpp (renamed from src/libjin/Graphics/Drawable.cpp)10
-rw-r--r--src/libjin/Graphics/je_drawable.h (renamed from src/libjin/Graphics/Drawable.h)11
-rw-r--r--src/libjin/Graphics/je_gl.cpp (renamed from src/libjin/Graphics/OpenGL.cpp)2
-rw-r--r--src/libjin/Graphics/je_gl.h (renamed from src/libjin/Graphics/OpenGL.h)3
-rw-r--r--src/libjin/Graphics/je_graphics.h21
-rw-r--r--src/libjin/Graphics/je_image.cpp (renamed from src/libjin/Graphics/Image.cpp)5
-rw-r--r--src/libjin/Graphics/je_image.h (renamed from src/libjin/Graphics/Image.h)2
-rw-r--r--src/libjin/Graphics/je_mesh.cpp (renamed from src/libjin/Graphics/Mesh.cpp)2
-rw-r--r--src/libjin/Graphics/je_mesh.h (renamed from src/libjin/Graphics/Mesh.h)0
-rw-r--r--src/libjin/Graphics/je_shapes.cpp (renamed from src/libjin/Graphics/Shapes.cpp)12
-rw-r--r--src/libjin/Graphics/je_shapes.h (renamed from src/libjin/Graphics/Shapes.h)8
-rw-r--r--src/libjin/Graphics/je_sprite.cpp (renamed from src/libjin/Graphics/Sprite.cpp)0
-rw-r--r--src/libjin/Graphics/je_sprite.h (renamed from src/libjin/Graphics/Sprite.h)0
-rw-r--r--src/libjin/Graphics/je_texture.cpp (renamed from src/libjin/Graphics/Texture.cpp)10
-rw-r--r--src/libjin/Graphics/je_texture.h (renamed from src/libjin/Graphics/Texture.h)10
-rw-r--r--src/libjin/Graphics/je_window.cpp (renamed from src/libjin/Graphics/Window.cpp)18
-rw-r--r--src/libjin/Graphics/je_window.h96
-rw-r--r--src/libjin/Input/Event.cpp7
-rw-r--r--src/libjin/Input/Event.h105
-rw-r--r--src/libjin/Input/Input.h9
-rw-r--r--src/libjin/Input/Mouse.cpp27
-rw-r--r--src/libjin/Input/Mouse.h31
-rw-r--r--src/libjin/Input/je_event.cpp8
-rw-r--r--src/libjin/Input/je_event.h (renamed from src/libjin/input/event.h)2
-rw-r--r--src/libjin/Input/je_input.h9
-rw-r--r--src/libjin/Input/je_joypad.cpp (renamed from src/libjin/Input/Joypad.cpp)0
-rw-r--r--src/libjin/Input/je_joypad.h (renamed from src/libjin/Input/Joypad.h)0
-rw-r--r--src/libjin/Input/je_keyboard.cpp (renamed from src/libjin/Input/Keyboard.cpp)0
-rw-r--r--src/libjin/Input/je_keyboard.h (renamed from src/libjin/Input/Keyboard.h)0
-rw-r--r--src/libjin/Input/je_mouse.cpp (renamed from src/libjin/input/mouse.cpp)5
-rw-r--r--src/libjin/Input/je_mouse.h (renamed from src/libjin/input/mouse.h)4
-rw-r--r--src/libjin/Math/je_constant.h (renamed from src/libjin/Math/constant.h)0
-rw-r--r--src/libjin/Math/je_math.h (renamed from src/libjin/Math/Math.h)6
-rw-r--r--src/libjin/Math/je_matrix.cpp (renamed from src/libjin/Math/Matrix.cpp)2
-rw-r--r--src/libjin/Math/je_matrix.h (renamed from src/libjin/Math/Matrix.h)0
-rw-r--r--src/libjin/Math/je_quad.h (renamed from src/libjin/Math/Quad.h)0
-rw-r--r--src/libjin/Math/je_vector2.hpp (renamed from src/libjin/Math/Vector2.hpp)0
-rw-r--r--src/libjin/Math/je_vector3.hpp (renamed from src/libjin/Math/Vector3.hpp)0
-rw-r--r--src/libjin/Math/je_vector4.hpp (renamed from src/libjin/Math/Vector4.hpp)0
-rw-r--r--src/libjin/Net/Net.cpp24
-rw-r--r--src/libjin/Net/je_net.cpp (renamed from src/libjin/net/net.cpp)2
-rw-r--r--src/libjin/Net/je_net.h (renamed from src/libjin/Net/Net.h)7
-rw-r--r--src/libjin/Net/je_socket.cpp (renamed from src/libjin/Net/Socket.cpp)2
-rw-r--r--src/libjin/Net/je_socket.h (renamed from src/libjin/Net/Socket.h)2
-rw-r--r--src/libjin/Net/net.cpp24
-rw-r--r--src/libjin/Net/net.h31
-rw-r--r--src/libjin/Thread/Thread.h166
-rw-r--r--src/libjin/Thread/je_thread.cpp (renamed from src/libjin/Thread/Thread.cpp)4
-rw-r--r--src/libjin/Thread/je_thread.h (renamed from src/libjin/thread/thread.h)10
-rw-r--r--src/libjin/Thread/thread.cpp301
-rw-r--r--src/libjin/Thread/thread.h166
-rw-r--r--src/libjin/Time/je_timer.cpp (renamed from src/libjin/Time/Timer.cpp)4
-rw-r--r--src/libjin/Time/je_timer.h (renamed from src/libjin/Time/Timer.h)4
-rw-r--r--src/libjin/Utils/Log.h134
-rw-r--r--src/libjin/Utils/je_endian.h (renamed from src/libjin/Utils/endian.h)0
-rw-r--r--src/libjin/Utils/je_log.cpp (renamed from src/libjin/Utils/Log.cpp)2
-rw-r--r--src/libjin/Utils/je_log.h (renamed from src/libjin/utils/log.h)1
-rw-r--r--src/libjin/Utils/je_macros.h (renamed from src/libjin/Utils/macros.h)0
-rw-r--r--src/libjin/Utils/je_unittest.cpp (renamed from src/libjin/utils/unittest.cpp)2
-rw-r--r--src/libjin/Utils/je_utils.h (renamed from src/libjin/Utils/utils.h)4
-rw-r--r--src/libjin/Utils/log.h134
-rw-r--r--src/libjin/Utils/unittest.cpp108
-rw-r--r--src/libjin/audio/audio.cpp15
-rw-r--r--src/libjin/audio/audio.h52
-rw-r--r--src/libjin/audio/source.cpp29
-rw-r--r--src/libjin/core/je_configuration.h (renamed from src/libjin/configuration.h)0
-rw-r--r--src/libjin/core/je_types.h24
-rw-r--r--src/libjin/input/event.cpp7
-rw-r--r--src/libjin/input/input.h9
-rw-r--r--src/libjin/input/joypad.cpp0
-rw-r--r--src/libjin/input/joypad.h50
-rw-r--r--src/libjin/input/keyboard.cpp0
-rw-r--r--src/libjin/input/keyboard.h17
-rw-r--r--src/libjin/jin.h24
-rw-r--r--src/libjin/math/constant.h10
-rw-r--r--src/libjin/math/math.h77
-rw-r--r--src/libjin/math/matrix.cpp194
-rw-r--r--src/libjin/math/matrix.h159
-rw-r--r--src/libjin/math/quad.h17
-rw-r--r--src/libjin/net/net.h31
-rw-r--r--src/libjin/thread/thread.cpp301
-rw-r--r--src/libjin/utils/endian.h23
-rw-r--r--src/libjin/utils/log.cpp2
-rw-r--r--src/libjin/utils/macros.h17
-rw-r--r--src/libjin/utils/utils.h9
137 files changed, 548 insertions, 2688 deletions
diff --git a/src/libjin/Audio/SDL/SDLAudio.cpp b/src/libjin/Audio/SDL/je_sdl_audio.cpp
index 96bb304..0cc8380 100644
--- a/src/libjin/Audio/SDL/SDLAudio.cpp
+++ b/src/libjin/Audio/SDL/je_sdl_audio.cpp
@@ -1,11 +1,13 @@
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <iostream>
-#include "SDLAudio.h"
-#include "SDLSource.h"
-#include "../../math/math.h"
-#include "../../utils/log.h"
+
+#include "../../math/je_math.h"
+#include "../../utils/je_log.h"
+
+#include "je_sdl_audio.h"
+#include "je_sdl_source.h"
namespace jin
{
diff --git a/src/libjin/Audio/SDL/SDLAudio.h b/src/libjin/Audio/SDL/je_sdl_audio.h
index 1a29595..c64b109 100644
--- a/src/libjin/Audio/SDL/SDLAudio.h
+++ b/src/libjin/Audio/SDL/je_sdl_audio.h
@@ -1,11 +1,13 @@
#ifndef __LIBJIN_AUDIO_SDL_H
#define __LIBJIN_AUDIO_SDL_H
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
-#include "SDLSource.h"
#include <vector>
-#include "../audio.h"
+
+#include "../je_audio.h"
+
+#include "je_sdl_source.h"
namespace jin
{
diff --git a/src/libjin/Audio/SDL/SDLSource.cpp b/src/libjin/Audio/SDL/je_sdl_source.cpp
index 34fc0f5..5fbce49 100644
--- a/src/libjin/Audio/SDL/SDLSource.cpp
+++ b/src/libjin/Audio/SDL/je_sdl_source.cpp
@@ -1,16 +1,18 @@
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <exception>
#include <fstream>
#include <climits>
-#include "../../math/math.h"
-#include "../../utils/macros.h"
-#include "SDLSource.h"
-#include "../../3rdparty/wav/wav.h"
+
#define STB_VORBIS_HEADER_ONLY
#include "../../3rdparty/stb/stb_vorbis.c"
-#include "SDLAudio.h"
+#include "../../math/je_math.h"
+#include "../../utils/je_macros.h"
+#include "../../3rdparty/wav/wav.h"
+
+#include "je_sdl_audio.h"
+#include "je_sdl_source.h"
namespace jin
{
diff --git a/src/libjin/Audio/SDL/SDLSource.h b/src/libjin/Audio/SDL/je_sdl_source.h
index 4977ec8..15676d6 100644
--- a/src/libjin/Audio/SDL/SDLSource.h
+++ b/src/libjin/Audio/SDL/je_sdl_source.h
@@ -1,6 +1,6 @@
#ifndef __LIBJIN_SOURCE_SDL_H
#define __LIBJIN_SOURCE_SDL_H
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <vector>
@@ -8,7 +8,7 @@
#include <stack>
#include <exception>
-#include "../source.h"
+#include "../je_source.h"
namespace jin
{
diff --git a/src/libjin/Audio/Source.h b/src/libjin/Audio/Source.h
deleted file mode 100644
index 6dfc86c..0000000
--- a/src/libjin/Audio/Source.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __LIBJIN_AUDIO_SOURCE_H
-#define __LIBJIN_AUDIO_SOURCE_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_AUDIO
-
-#include "SDL2/SDL.h"
-
-namespace jin
-{
- namespace audio
- {
-
- enum SourceType
- {
- INVALID = 0,
- WAV,
- OGG,
- };
-
- class Source
- {
- public:
- Source() {};
- virtual ~Source() {};
- /* interface */
- virtual void play() = 0;
- virtual void stop() = 0;
- virtual void pause() = 0;
- virtual void resume() = 0;
- virtual void rewind() = 0;
- virtual bool isStopped() const = 0;
- virtual bool isPaused() const = 0;
- virtual void setPitch(float pitch) = 0;
- virtual void setVolume(float volume) = 0;
- virtual bool setLoop(bool loop) = 0;
- virtual void setRate(float rate) = 0;
-
- protected:
- static SourceType getType(const void* mem, int size);
-
- };
-
- } // namespace audio
-} // namespace jin
-
-#endif // LIBJIN_MODULES_AUDIO
-#endif // __LIBJIN_AUDIO_SOURCE_H
diff --git a/src/libjin/Audio/Audio.cpp b/src/libjin/Audio/je_audio.cpp
index 928f01a..81201b7 100644
--- a/src/libjin/Audio/Audio.cpp
+++ b/src/libjin/Audio/je_audio.cpp
@@ -1,8 +1,8 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
-#include "audio.h"
+#include "je_audio.h"
namespace jin
{
diff --git a/src/libjin/Audio/Audio.h b/src/libjin/Audio/je_audio.h
index fd391aa..341e4c9 100644
--- a/src/libjin/Audio/Audio.h
+++ b/src/libjin/Audio/je_audio.h
@@ -1,12 +1,13 @@
#ifndef __LIBJIN_AUDIO_H
#define __LIBJIN_AUDIO_H
-#include "../configuration.h"
+
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO
-#include "SDL2/SDL.h"
+#include "../utils/je_macros.h"
+#include "../common/je_subsystem.hpp"
-#include "../utils/macros.h"
-#include "../common/Subsystem.hpp"
+#include "SDL2/SDL.h"
namespace jin
{
diff --git a/src/libjin/Audio/Source.cpp b/src/libjin/Audio/je_source.cpp
index 646e5ef..e20cd69 100644
--- a/src/libjin/Audio/Source.cpp
+++ b/src/libjin/Audio/je_source.cpp
@@ -1,8 +1,9 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO
#include <cstring>
-#include "source.h"
+
+#include "je_source.h"
namespace jin
{
diff --git a/src/libjin/audio/source.h b/src/libjin/Audio/je_source.h
index 6dfc86c..bcac214 100644
--- a/src/libjin/audio/source.h
+++ b/src/libjin/Audio/je_source.h
@@ -1,6 +1,6 @@
#ifndef __LIBJIN_AUDIO_SOURCE_H
#define __LIBJIN_AUDIO_SOURCE_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
diff --git a/src/libjin/Common/Array.hpp b/src/libjin/Common/je_array.hpp
index 45082db..eadd36f 100644
--- a/src/libjin/Common/Array.hpp
+++ b/src/libjin/Common/je_array.hpp
@@ -3,7 +3,6 @@
namespace jin
{
-
/* ԶͷŶڴջϴĶ̬ */
template<typename T>
class Array
@@ -62,15 +61,19 @@ namespace jin
}
private:
- /**
- * http://blog.jobbole.com/106923/
- * new ڴ洴
- * 1. new ڴ
- * 2. ù캯
- *
- * new, deleteڷͷڴ棬
- */
+ ///
+ /// http://blog.jobbole.com/106923/
+ /// new ڴ洴
+ /// 1. new ڴ
+ /// 2. ù캯
+ ///
+ /// new, deleteڷͷڴ棬
+ ///
void* operator new(size_t t);
+
+ ///
+ /// Disable delete.
+ ///
void operator delete(void* ptr);
T * data;
@@ -78,6 +81,6 @@ namespace jin
};
-}
+} // namespace jin
#endif \ No newline at end of file
diff --git a/src/libjin/Common/common.h b/src/libjin/Common/je_common.h
index 9586c82..63528b0 100644
--- a/src/libjin/Common/common.h
+++ b/src/libjin/Common/je_common.h
@@ -1,6 +1,6 @@
#ifndef __LIBJIN_COMMON_H
#define __LIBJIN_COMMON_H
-#include "Array.hpp"
+#include "je_array.hpp"
#endif \ No newline at end of file
diff --git a/src/libjin/Common/Exception.cpp b/src/libjin/Common/je_exception.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Common/Exception.cpp
+++ b/src/libjin/Common/je_exception.cpp
diff --git a/src/libjin/Common/Exception.h b/src/libjin/Common/je_exception.h
index e69de29..e69de29 100644
--- a/src/libjin/Common/Exception.h
+++ b/src/libjin/Common/je_exception.h
diff --git a/src/libjin/Common/Object.cpp b/src/libjin/Common/je_object.cpp
index 6c3b667..e3b4ca5 100644
--- a/src/libjin/Common/Object.cpp
+++ b/src/libjin/Common/je_object.cpp
@@ -1,5 +1,5 @@
// LOVE
-#include "Object.h"
+#include "je_object.h"
namespace jin
{
diff --git a/src/libjin/Common/Object.h b/src/libjin/Common/je_object.h
index c4bf225..c4bf225 100644
--- a/src/libjin/Common/Object.h
+++ b/src/libjin/Common/je_object.h
diff --git a/src/libjin/Common/Singleton.hpp b/src/libjin/Common/je_singleton.hpp
index 12b1450..12b1450 100644
--- a/src/libjin/Common/Singleton.hpp
+++ b/src/libjin/Common/je_singleton.hpp
diff --git a/src/libjin/Common/StringMap.hpp b/src/libjin/Common/je_stringmap.hpp
index 641e32d..641e32d 100644
--- a/src/libjin/Common/StringMap.hpp
+++ b/src/libjin/Common/je_stringmap.hpp
diff --git a/src/libjin/Common/Subsystem.hpp b/src/libjin/Common/je_subsystem.hpp
index 293b88d..2875058 100644
--- a/src/libjin/Common/Subsystem.hpp
+++ b/src/libjin/Common/je_subsystem.hpp
@@ -1,8 +1,9 @@
#ifndef __LIBJIN_COMMON_SUBSYSTEM_H
#define __LIBJIN_COMMON_SUBSYSTEM_H
-#include "singleton.hpp"
-#include "../utils/macros.h"
+#include "../utils/je_macros.h"
+
+#include "je_singleton.hpp"
namespace jin
{
diff --git a/src/libjin/Common/types.h b/src/libjin/Common/je_types.h
index 2d257c3..2d257c3 100644
--- a/src/libjin/Common/types.h
+++ b/src/libjin/Common/je_types.h
diff --git a/src/libjin/Common/utf8.cpp b/src/libjin/Common/je_utf8.cpp
index b912a51..de539c7 100644
--- a/src/libjin/Common/utf8.cpp
+++ b/src/libjin/Common/je_utf8.cpp
@@ -1,7 +1,7 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_OS == LIBJIN_WINDOWS
-#include "utf8.h"
+#include "je_utf8.h"
namespace jin
{
diff --git a/src/libjin/Common/utf8.h b/src/libjin/Common/je_utf8.h
index 9abb916..0193abd 100644
--- a/src/libjin/Common/utf8.h
+++ b/src/libjin/Common/je_utf8.h
@@ -1,7 +1,7 @@
#ifndef __LIBJIN_COMMON_UTF8_H
#define __LIBJIN_COMMON_UTF8_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_OS == LIBJIN_WINDOWS
#include <string>
diff --git a/src/libjin/Filesystem/Buffer.h b/src/libjin/Filesystem/je_buffer.h
index f0d987a..f0d987a 100644
--- a/src/libjin/Filesystem/Buffer.h
+++ b/src/libjin/Filesystem/je_buffer.h
diff --git a/src/libjin/Filesystem/Filesystem.cpp b/src/libjin/Filesystem/je_filesystem.cpp
index 8dce5a3..339d470 100644
--- a/src/libjin/Filesystem/Filesystem.cpp
+++ b/src/libjin/Filesystem/je_filesystem.cpp
@@ -1,8 +1,9 @@
-#include "filesystem.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h> /* defines FILENAME_MAX */
+#include "je_filesystem.h"
+
namespace jin
{
namespace filesystem
diff --git a/src/libjin/Filesystem/Filesystem.h b/src/libjin/Filesystem/je_filesystem.h
index b13e207..5d65fea 100644
--- a/src/libjin/Filesystem/Filesystem.h
+++ b/src/libjin/Filesystem/je_filesystem.h
@@ -1,4 +1,4 @@
-#include "buffer.h"
+#include "je_buffer.h"
#include "../3rdparty/smount/smount.h"
namespace jin
diff --git a/src/libjin/Game/Game.cpp b/src/libjin/Game/je_game.cpp
index b04661f..10e9e44 100644
--- a/src/libjin/Game/Game.cpp
+++ b/src/libjin/Game/je_game.cpp
@@ -1,10 +1,12 @@
-#include "game.h"
-#include "../Time/Timer.h"
-#include "../input/Event.h"
-#include "../Graphics/Window.h"
-#include "../Math/Math.h"
#include <iostream>
+#include "../time/je_timer.h"
+#include "../input/je_event.h"
+#include "../graphics/je_window.h"
+#include "../math/je_math.h"
+
+#include "je_game.h"
+
namespace jin
{
namespace core
diff --git a/src/libjin/Game/Game.h b/src/libjin/Game/je_game.h
index c7607a1..9323177 100644
--- a/src/libjin/Game/Game.h
+++ b/src/libjin/Game/je_game.h
@@ -1,11 +1,11 @@
#ifndef __LIBJIN_CORE_GAME_H
#define __LIBJIN_CORE_GAME_H
-#include "SDL2/SDL.h"
+#include "../common/je_subsystem.hpp"
+#include "../utils/je_macros.h"
+#include "../input/je_Event.h"
-#include "../Common/Subsystem.hpp"
-#include "../utils/macros.h"
-#include "../Input/Event.h"
+#include "SDL2/SDL.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Font/Decoder.h b/src/libjin/Graphics/Font/Decoder.h
deleted file mode 100644
index 533f60b..0000000
--- a/src/libjin/Graphics/Font/Decoder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __LIBJIN_UTF8_H
-#define __LIBJIN_UTF8_H
-
-#include <vector>
-
-#include "Text.h"
-
-namespace jin
-{
- namespace graphics
- {
-
- class Decoder
- {
- public:
- virtual const void* decode(const void* data, Codepoint* c) const = 0 ;
- virtual const void* next(const void* data) const = 0;
- };
-
- class Utf8 : public Decoder
- {
- public:
- const void* decode(const void* data, Codepoint* c) const override;
- const void* next(const void* data) const override;
- };
- /*
- class Utf16 : public Decoder
- {
- public:
- const void* decode(const void* data, Codepoint* c) const override;
- const void* next(const void* data) const override;
- };
- */
- class Ascii : public Decoder
- {
- public:
- const void* decode(const void* data, Codepoint* c) const override;
- const void* next(const void* data) const override;
- };
-
- } // namespace graphics
-} // namespace jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/Page.h b/src/libjin/Graphics/Font/Page.h
deleted file mode 100644
index e1430e1..0000000
--- a/src/libjin/Graphics/Font/Page.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __LIBJIN_PAGE_H
-#define __LIBJIN_PAGE_H
-#include "../../math/Vector2.hpp"
-#include "Font.h"
-
-namespace jin
-{
- namespace graphics
- {
-
- class Font;
-
- struct GlyphVertex
- {
- int x, y; // screen coordinates
- float u, v; // texture uv
- };
-
- struct GlyphArrayDrawInfo
- {
- GLuint texture; // atlas
- unsigned int start; // glyph vertex indecies
- unsigned int count; // glyph vertex count
- };
-
- /* for reduce draw call */
- struct Page
- {
- Font* font;
- std::vector<GlyphArrayDrawInfo> glyphinfolist;
- std::vector<GlyphVertex> glyphvertices;
- math::Vector2<int> size;
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/Decoder.cpp b/src/libjin/Graphics/Font/je_decoder.cpp
index 362fd2a..20695e7 100644
--- a/src/libjin/Graphics/Font/Decoder.cpp
+++ b/src/libjin/Graphics/Font/je_decoder.cpp
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include <string.h>
-#include "Decoder.h"
+#include "je_decoder.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Font/je_decoder.h b/src/libjin/Graphics/Font/je_decoder.h
new file mode 100644
index 0000000..e95f7c3
--- /dev/null
+++ b/src/libjin/Graphics/Font/je_decoder.h
@@ -0,0 +1,88 @@
+#ifndef __LIBJIN_UTF8_H
+#define __LIBJIN_UTF8_H
+
+#include <vector>
+
+#include "je_text.h"
+
+namespace jin
+{
+ namespace graphics
+ {
+
+ ///
+ /// Text decoder.
+ ///
+ class Decoder
+ {
+ public:
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ virtual const void* decode(const void* data, Codepoint* codepoint) const = 0 ;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ virtual const void* next(const void* data) const = 0;
+ };
+
+ ///
+ /// Utf-8 decoder.
+ ///
+ class Utf8 : public Decoder
+ {
+ public:
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ const void* decode(const void* data, Codepoint* codepoint) const override;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ const void* next(const void* data) const override;
+ };
+
+ ///
+ /// Ascii decoder.
+ ///
+ class Ascii : public Decoder
+ {
+ public:
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ const void* decode(const void* data, Codepoint* codepoint) const override;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ const void* next(const void* data) const override;
+ };
+
+ } // namespace graphics
+} // namespace jin
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/Font.h b/src/libjin/Graphics/Font/je_font.h
index 1d09cfc..9fde723 100644
--- a/src/libjin/Graphics/Font/Font.h
+++ b/src/libjin/Graphics/Font/je_font.h
@@ -1,7 +1,8 @@
#ifndef __LIBJIN_FONT_H
#define __LIBJIN_FONT_H
+
#include <vector>
-#include "Text.h"
+#include "je_text.h"
namespace jin
{
@@ -10,6 +11,9 @@ namespace jin
struct Page;
+ ///
+ /// Base Font class.
+ ///
class Font
{
public:
diff --git a/src/libjin/Graphics/Font/je_page.h b/src/libjin/Graphics/Font/je_page.h
new file mode 100644
index 0000000..d887c9b
--- /dev/null
+++ b/src/libjin/Graphics/Font/je_page.h
@@ -0,0 +1,51 @@
+#ifndef __LIBJIN_PAGE_H
+#define __LIBJIN_PAGE_H
+
+#include "../../math/je_vector2.hpp"
+
+#include "je_font.h"
+
+namespace jin
+{
+ namespace graphics
+ {
+
+ class Font;
+
+ ///
+ /// Glyphs data to be rendered.
+ ///
+ struct GlyphVertex
+ {
+ int x, y; ///< screen coordinates
+ float u, v; ///< normalized texture uv
+ };
+
+ ///
+ /// Glyphs info for reducing draw call.
+ ///
+ struct GlyphArrayDrawInfo
+ {
+ GLuint texture; ///< atlas
+ unsigned int start; ///< glyph vertex indecies
+ unsigned int count; ///< glyph vertex count
+ };
+
+ ///
+ /// Page to be rendered.
+ ///
+ /// A page is a pre-rendered text struct for reducing draw call. Each page
+ /// keeps a font pointer which should not be changed.
+ ///
+ struct Page
+ {
+ Font* font;
+ std::vector<GlyphArrayDrawInfo> glyphinfolist;
+ std::vector<GlyphVertex> glyphvertices;
+ math::Vector2<int> size;
+ };
+
+ } // namespace graphics
+} // namespace jin
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/Text.cpp b/src/libjin/Graphics/Font/je_text.cpp
index f2231f8..aa5cbda 100644
--- a/src/libjin/Graphics/Font/Text.cpp
+++ b/src/libjin/Graphics/Font/je_text.cpp
@@ -1,7 +1,7 @@
#include <cstring>
-#include "Text.h"
-#include "Decoder.h"
+#include "je_text.h"
+#include "je_decoder.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Font/Text.h b/src/libjin/Graphics/Font/je_text.h
index 7256a52..38e60ca 100644
--- a/src/libjin/Graphics/Font/Text.h
+++ b/src/libjin/Graphics/Font/je_text.h
@@ -13,17 +13,22 @@ namespace jin
typedef std::vector<Codepoint> Content;
class Text;
+
class Decoder;
+ ///
+ /// Supported text encoding.
+ ///
enum Encode
{
- UTF8, // utf-8
- //UTF16, // utf-16
- ASCII, // ASCII
+ UTF8, ///< utf-8
+ ASCII, ///< ASCII
};
- /* raw encoded text */
- class Text
+ ///
+ /// Decoded text. Saved as unicode codepoints.
+ ///
+ class Text
{
public:
Text(Encode encode, const void* data);
diff --git a/src/libjin/Graphics/Font/TextureFont.cpp b/src/libjin/Graphics/Font/je_texture_font.cpp
index 4f6f5d6..3df77e5 100644
--- a/src/libjin/Graphics/Font/TextureFont.cpp
+++ b/src/libjin/Graphics/Font/je_texture_font.cpp
@@ -1,8 +1,10 @@
#include <vector>
-#include "../../Math/Vector2.hpp"
-#include "../Shader/Shader.h"
-#include "TextureFont.h"
+#include "../../math/je_vector2.hpp"
+
+#include "../shader/je_shader.h"
+
+#include "je_texture_font.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Font/TextureFont.h b/src/libjin/Graphics/Font/je_texture_font.h
index a1d1a37..fa3f72e 100644
--- a/src/libjin/Graphics/Font/TextureFont.h
+++ b/src/libjin/Graphics/Font/je_texture_font.h
@@ -4,20 +4,23 @@
#include <map>
#include <vector>
-#include "../../Math/Vector4.hpp"
-#include "../Drawable.h"
-#include "../Bitmap.h"
+#include "../../math/je_vector4.hpp"
-#include "Page.h"
-#include "Font.h"
-#include "Text.h"
+#include "../je_drawable.h"
+#include "../je_bitmap.h"
+
+#include "je_page.h"
+#include "je_font.h"
+#include "je_text.h"
namespace jin
{
namespace graphics
{
-
- /* Texture font */
+
+ ///
+ ///
+ ///
class TextureFont : public Font
, public Drawable
{
@@ -56,7 +59,7 @@ namespace jin
};
- }
-}
+ } // namespace graphics
+} // namespace jin
#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/TTF.cpp b/src/libjin/Graphics/Font/je_ttf.cpp
index fe47630..d44b2c7 100644
--- a/src/libjin/Graphics/Font/TTF.cpp
+++ b/src/libjin/Graphics/Font/je_ttf.cpp
@@ -1,14 +1,16 @@
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
#include <stdio.h>
-#include "../../Common/Array.hpp"
-#include "../OpenGL.h"
-#include "../Color.h"
-#include "../Shader/Shader.h"
-#include "TTF.h"
-#include "Page.h"
+#include "../../common/je_array.hpp"
+
+#include "../je_gl.h"
+#include "../je_color.h"
+#include "../shader/je_shader.h"
+
+#include "je_ttf.h"
+#include "je_page.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "../../3rdparty/stb/stb_truetype.h"
@@ -142,7 +144,7 @@ namespace jin
// TTF
/////////////////////////////////////////////////////////////////////////////
- #include "../Shader/font.shader.h"
+ #include "../shader/je_font.shader.h"
using namespace std;
using namespace jin::math;
diff --git a/src/libjin/Graphics/Font/TTF.h b/src/libjin/Graphics/Font/je_ttf.h
index 88ddfd6..f3761ac 100644
--- a/src/libjin/Graphics/Font/TTF.h
+++ b/src/libjin/Graphics/Font/je_ttf.h
@@ -1,19 +1,20 @@
#ifndef __LIBJINTTF_H
#define __LIBJIN_TTF_H
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
#include <vector>
#include <map>
#include "../../3rdparty/stb/stb_truetype.h"
-#include "../../math/quad.h"
-#include "../Color.h"
-#include "../drawable.h"
+#include "../../math/je_quad.h"
-#include "Page.h"
-#include "Font.h"
-#include "Text.h"
+#include "../je_color.h"
+#include "../je_drawable.h"
+
+#include "je_page.h"
+#include "je_font.h"
+#include "je_text.h"
namespace jin
{
@@ -129,4 +130,5 @@ namespace jin
} // namespace jin
#endif // LIBJIN_MODULES_RENDER
+
#endif // __LIBJIN_FONT_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Graphics.h b/src/libjin/Graphics/Graphics.h
deleted file mode 100644
index 68579e5..0000000
--- a/src/libjin/Graphics/Graphics.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __LIBJIN_GRAPHICS_H
-#define __LIBJIN_GRAPHICS_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_RENDER
-
-#include "canvas.h"
-#include "color.h"
-#include "Shapes.h"
-#include "texture.h"
-#include "window.h"
-#include "Bitmap.h"
-#include "Image.h"
-
-#include "./Shader/Shader.h"
-
-#include "./Font/TTF.h"
-#include "./Font/Text.h"
-#include "./Font/TextureFont.h"
-
-#endif // LIBJIN_MODULES_RENDER
-#endif // __LIBJIN_GRAPHICS_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/base.shader.h b/src/libjin/Graphics/Shader/je_base.shader.h
index 45b63cd..45b63cd 100644
--- a/src/libjin/Graphics/Shader/base.shader.h
+++ b/src/libjin/Graphics/Shader/je_base.shader.h
diff --git a/src/libjin/Graphics/Shader/default.shader.h b/src/libjin/Graphics/Shader/je_default.shader.h
index f0175d7..f0175d7 100644
--- a/src/libjin/Graphics/Shader/default.shader.h
+++ b/src/libjin/Graphics/Shader/je_default.shader.h
diff --git a/src/libjin/Graphics/Shader/font.shader.h b/src/libjin/Graphics/Shader/je_font.shader.h
index e04c225..e04c225 100644
--- a/src/libjin/Graphics/Shader/font.shader.h
+++ b/src/libjin/Graphics/Shader/je_font.shader.h
diff --git a/src/libjin/Graphics/Shader/Shader.cpp b/src/libjin/Graphics/Shader/je_shader.cpp
index a075d7d..686f2b9 100644
--- a/src/libjin/Graphics/Shader/Shader.cpp
+++ b/src/libjin/Graphics/Shader/je_shader.cpp
@@ -1,12 +1,14 @@
#include <regex>
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if defined(jin_graphics_shader)
#include <iostream>
-#include "../../Filesystem/Buffer.h"
-#include "../../utils/macros.h"
-#include "Shader.h"
+#include "../../filesystem/je_buffer.h"
+#include "../../utils/je_macros.h"
+
+#include "je_shader.h"
+
namespace jin
{
namespace graphics
@@ -21,7 +23,7 @@ namespace jin
// SHADER_FORMAT_SIZE
// formatShader
//
- #include "default.shader.h"
+ #include "je_default.shader.h"
//
// https://stackoverflow.com/questions/27941496/use-sampler-without-passing-through-value
diff --git a/src/libjin/Graphics/Shader/Shader.h b/src/libjin/Graphics/Shader/je_shader.h
index 71579a9..bcee584 100644
--- a/src/libjin/Graphics/Shader/Shader.h
+++ b/src/libjin/Graphics/Shader/je_shader.h
@@ -1,22 +1,25 @@
#ifndef __LIBJIN_SHADER_H
#define __LIBJIN_SHADER_H
-#include "../../configuration.h"
+#include "../../core/je_configuration.h"
#if defined(jin_graphics) && defined(jin_graphics_shader)
#include <string>
#include <map>
#include "../../3rdparty/GLee/GLee.h"
-#include "../color.h"
-#include "../texture.h"
-#include "../canvas.h"
-#include "base.shader.h"
+
+#include "../je_color.h"
+#include "../je_texture.h"
+#include "../je_canvas.h"
+
+#include "je_base.shader.h"
namespace jin
{
namespace graphics
{
+
///
/// Built in shader program.
///
diff --git a/src/libjin/Graphics/Shader/texture.shader.h b/src/libjin/Graphics/Shader/je_texture.shader.h
index d1fc86f..d1fc86f 100644
--- a/src/libjin/Graphics/Shader/texture.shader.h
+++ b/src/libjin/Graphics/Shader/je_texture.shader.h
diff --git a/src/libjin/Graphics/Window.h b/src/libjin/Graphics/Window.h
deleted file mode 100644
index 8d6c4f5..0000000
--- a/src/libjin/Graphics/Window.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __LIBJIN_RENDER_WINDOW
-#define __LIBJIN_RENDER_WINDOW
-#include "../configuration.h"
-#if LIBJIN_MODULES_RENDER
-
-#include "SDL2/SDL.h"
-#include "../utils/utils.h"
-#include "../math/Vector2.hpp"
-#include "../common/Subsystem.hpp"
-
-namespace jin
-{
- namespace graphics
- {
-
- class Window : public Subsystem<Window>
- {
- public:
- struct Setting : SettingBase
- {
- public:
- const char* title; //
- bool fullscreen; // ȫ
- int width, height; // ڴС
- bool vsync; // ֱͬ
- int fps; // FPS
- bool resizable; // resize
- };
-
- void setTitle(const char* title);
- inline int getW(){ return size.w; }
- inline int getH(){ return size.h; }
- inline int getFPS(){ return fps; }
- void swapBuffers();
-
- private:
- // declare a singleton
- singleton(Window);
-
- Window() {};
-
- virtual ~Window() {};
- bool initSystem(const SettingBase* setting) override;
- void quitSystem() override;
-
- SDL_Window* wnd;
- jin::math::Vector2<unsigned int> size;
- int fps;
-
- };
-
- } // namespace graphics
-} // namespace jin
-
-#endif // LIBJIN_MODULES_RENDER
-#endif // __LIBJIN_RENDER_WINDOW \ No newline at end of file
diff --git a/src/libjin/Graphics/Bitmap.cpp b/src/libjin/Graphics/je_bitmap.cpp
index 8769e8f..2a619ac 100644
--- a/src/libjin/Graphics/Bitmap.cpp
+++ b/src/libjin/Graphics/je_bitmap.cpp
@@ -1,7 +1,8 @@
-#include "Bitmap.h"
#define STB_IMAGE_IMPLEMENTATION
#include "../3rdparty/stb/stb_image.h"
-#include "../Math/math.h"
+#include "../math/je_math.h"
+
+#include "je_bitmap.h"
using namespace jin::math;
diff --git a/src/libjin/Graphics/Bitmap.h b/src/libjin/Graphics/je_bitmap.h
index 4341256..b9747f2 100644
--- a/src/libjin/Graphics/Bitmap.h
+++ b/src/libjin/Graphics/je_bitmap.h
@@ -1,11 +1,11 @@
#ifndef __LIBJIN_BITMAP_H
#define __LIBJIN_BITMAP_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "../Math/Vector2.hpp"
#include "../3rdparty/GLee/GLee.h"
-#include "Color.h"
+#include "../math/je_vector2.hpp"
+#include "je_color.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Canvas.cpp b/src/libjin/Graphics/je_canvas.cpp
index f222721..af9868b 100644
--- a/src/libjin/Graphics/Canvas.cpp
+++ b/src/libjin/Graphics/je_canvas.cpp
@@ -1,9 +1,9 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "../utils/macros.h"
-#include "canvas.h"
-#include "window.h"
+#include "../utils/je_macros.h"
+#include "je_canvas.h"
+#include "je_window.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Canvas.h b/src/libjin/Graphics/je_canvas.h
index 53070bf..12611d9 100644
--- a/src/libjin/Graphics/Canvas.h
+++ b/src/libjin/Graphics/je_canvas.h
@@ -1,9 +1,9 @@
#ifndef __LIBJIN_CANVAS_H
#define __LIBJIN_CANVAS_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "drawable.h"
+#include "je_drawable.h"
namespace jin
{
namespace graphics
diff --git a/src/libjin/Graphics/Color.cpp b/src/libjin/Graphics/je_color.cpp
index 517af50..821f19e 100644
--- a/src/libjin/Graphics/Color.cpp
+++ b/src/libjin/Graphics/je_color.cpp
@@ -1,4 +1,4 @@
-#include "Color.h"
+#include "je_color.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Color.h b/src/libjin/Graphics/je_color.h
index 2a6feca..b13d882 100644
--- a/src/libjin/Graphics/Color.h
+++ b/src/libjin/Graphics/je_color.h
@@ -3,10 +3,10 @@
*/
#ifndef __LIBJIN_COLOR_H
#define __LIBJIN_COLOR_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "../utils/endian.h"
+#include "../utils/je_endian.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Drawable.cpp b/src/libjin/Graphics/je_drawable.cpp
index f819c9c..9b5746a 100644
--- a/src/libjin/Graphics/Drawable.cpp
+++ b/src/libjin/Graphics/je_drawable.cpp
@@ -1,11 +1,13 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "./Shader/Shader.h"
-#include "drawable.h"
-#include "../math/matrix.h"
#include <stdlib.h>
+#include "../math/je_matrix.h"
+
+#include "shader/je_shader.h"
+#include "je_drawable.h"
+
namespace jin
{
namespace graphics
diff --git a/src/libjin/Graphics/Drawable.h b/src/libjin/Graphics/je_drawable.h
index 007a9a1..13464f0 100644
--- a/src/libjin/Graphics/Drawable.h
+++ b/src/libjin/Graphics/je_drawable.h
@@ -1,12 +1,13 @@
#ifndef __LIBJIN_DRAWABLE
#define __LIBJIN_DRAWABLE
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "../math/Quad.h"
-#include "../math/Vector2.hpp"
-#include "OpenGL.h"
-#include "Bitmap.h"
+#include "../math/je_quad.h"
+#include "../math/je_vector2.hpp"
+
+#include "je_gl.h"
+#include "je_bitmap.h"
namespace jin
{
diff --git a/src/libjin/Graphics/OpenGL.cpp b/src/libjin/Graphics/je_gl.cpp
index 6bc176e..d228bb5 100644
--- a/src/libjin/Graphics/OpenGL.cpp
+++ b/src/libjin/Graphics/je_gl.cpp
@@ -1,5 +1,5 @@
#define OGL2D_IMPLEMENT
-#include "OpenGL.h"
+#include "je_gl.h"
namespace jin
{
diff --git a/src/libjin/Graphics/OpenGL.h b/src/libjin/Graphics/je_gl.h
index 47011a2..296b8aa 100644
--- a/src/libjin/Graphics/OpenGL.h
+++ b/src/libjin/Graphics/je_gl.h
@@ -1,8 +1,9 @@
#ifndef __LIBJIN_OPENGL_H
#define __LIBJIN_OPENGL_H
+
#include "../3rdparty/GLee/GLee.h"
#include "../3rdparty/ogl/OpenGL.h"
-#include "../Math/Matrix.h"
+#include "../math/je_matrix.h"
namespace jin
{
diff --git a/src/libjin/Graphics/je_graphics.h b/src/libjin/Graphics/je_graphics.h
new file mode 100644
index 0000000..6f099cd
--- /dev/null
+++ b/src/libjin/Graphics/je_graphics.h
@@ -0,0 +1,21 @@
+#ifndef __LIBJIN_GRAPHICS_H
+#define __LIBJIN_GRAPHICS_H
+#include "../core/je_configuration.h"
+#if LIBJIN_MODULES_RENDER
+
+#include "je_canvas.h"
+#include "je_color.h"
+#include "je_shapes.h"
+#include "je_texture.h"
+#include "je_window.h"
+#include "je_bitmap.h"
+#include "je_image.h"
+
+#include "shader/je_shader.h"
+
+#include "font/je_ttf.h"
+#include "font/je_text.h"
+#include "font/je_texture_font.h"
+
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_GRAPHICS_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Image.cpp b/src/libjin/Graphics/je_image.cpp
index 358a144..cca78a3 100644
--- a/src/libjin/Graphics/Image.cpp
+++ b/src/libjin/Graphics/je_image.cpp
@@ -1,6 +1,7 @@
#include "../3rdparty/stb/stb_image.h"
-#include "../Filesystem/Filesystem.h"
-#include "Image.h"
+#include "../filesystem/je_filesystem.h"
+
+#include "je_image.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Image.h b/src/libjin/Graphics/je_image.h
index 55798be..5c06258 100644
--- a/src/libjin/Graphics/Image.h
+++ b/src/libjin/Graphics/je_image.h
@@ -1,7 +1,7 @@
#ifndef __LIBJIN_IMAGE_H
#define __LIBJIN_IMAGE_H
-#include "Bitmap.h"
+#include "je_bitmap.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Mesh.cpp b/src/libjin/Graphics/je_mesh.cpp
index 3142894..1047e7e 100644
--- a/src/libjin/Graphics/Mesh.cpp
+++ b/src/libjin/Graphics/je_mesh.cpp
@@ -1,4 +1,4 @@
-#include "Mesh.h"
+#include "je_mesh.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Mesh.h b/src/libjin/Graphics/je_mesh.h
index 66727e4..66727e4 100644
--- a/src/libjin/Graphics/Mesh.h
+++ b/src/libjin/Graphics/je_mesh.h
diff --git a/src/libjin/Graphics/Shapes.cpp b/src/libjin/Graphics/je_shapes.cpp
index 69eda70..31c793f 100644
--- a/src/libjin/Graphics/Shapes.cpp
+++ b/src/libjin/Graphics/je_shapes.cpp
@@ -1,12 +1,14 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "./Shader/Shader.h"
-#include "Shapes.h"
-#include "../math/matrix.h"
-#include "../math/constant.h"
#include <string>
+#include "../math/je_matrix.h"
+#include "../math/je_constant.h"
+
+#include "shader/je_shader.h"
+#include "je_shapes.h"
+
namespace jin
{
namespace graphics
diff --git a/src/libjin/Graphics/Shapes.h b/src/libjin/Graphics/je_shapes.h
index 07e7567..32b5284 100644
--- a/src/libjin/Graphics/Shapes.h
+++ b/src/libjin/Graphics/je_shapes.h
@@ -1,11 +1,11 @@
#ifndef __LIBJIN_GEOMETRY_H
#define __LIBJIN_GEOMETRY_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
-#include "color.h"
-#include "canvas.h"
-#include "texture.h"
+#include "je_color.h"
+#include "je_canvas.h"
+#include "je_texture.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Sprite.cpp b/src/libjin/Graphics/je_sprite.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/Sprite.cpp
+++ b/src/libjin/Graphics/je_sprite.cpp
diff --git a/src/libjin/Graphics/Sprite.h b/src/libjin/Graphics/je_sprite.h
index 7a4e53a..7a4e53a 100644
--- a/src/libjin/Graphics/Sprite.h
+++ b/src/libjin/Graphics/je_sprite.h
diff --git a/src/libjin/Graphics/Texture.cpp b/src/libjin/Graphics/je_texture.cpp
index 226187d..d2e53e2 100644
--- a/src/libjin/Graphics/Texture.cpp
+++ b/src/libjin/Graphics/je_texture.cpp
@@ -1,10 +1,12 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
#include <fstream>
-#include "texture.h"
-#include "../utils/utils.h"
-#include "../Math/Math.h"
+
+#include "../utils/je_utils.h"
+#include "../math/je_math.h"
+
+#include "je_texture.h"
namespace jin
{
diff --git a/src/libjin/Graphics/Texture.h b/src/libjin/Graphics/je_texture.h
index 3e0161c..30c5063 100644
--- a/src/libjin/Graphics/Texture.h
+++ b/src/libjin/Graphics/je_texture.h
@@ -1,12 +1,14 @@
#ifndef __LIBJIN_TEXTURE_H
#define __LIBJIN_TEXTURE_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if defined(jin_graphics)
#include "../3rdparty/GLee/GLee.h"
-#include "Color.h"
-#include "Drawable.h"
-#include "Bitmap.h"
+
+#include "je_color.h"
+#include "je_drawable.h"
+#include "je_bitmap.h"
+
namespace jin
{
namespace graphics
diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/je_window.cpp
index 1fd1f90..680dd0e 100644
--- a/src/libjin/Graphics/Window.cpp
+++ b/src/libjin/Graphics/je_window.cpp
@@ -1,14 +1,16 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_RENDER
#include <iostream>
-#include "window.h"
-#include "OpenGL.h"
-#include "canvas.h"
-#include "./Shader/Shader.h"
-#include "../utils/utils.h"
-#include "../audio/sdl/SDLAudio.h"
-#include "../utils/log.h"
+
+#include "../utils/je_utils.h"
+#include "../audio/sdl/je_sdl_audio.h"
+#include "../utils/je_log.h"
+
+#include "shader/je_shader.h"
+#include "je_window.h"
+#include "je_gl.h"
+#include "je_canvas.h"
namespace jin
{
diff --git a/src/libjin/Graphics/je_window.h b/src/libjin/Graphics/je_window.h
new file mode 100644
index 0000000..995d8b0
--- /dev/null
+++ b/src/libjin/Graphics/je_window.h
@@ -0,0 +1,96 @@
+#ifndef __LIBJIN_RENDER_WINDOW
+#define __LIBJIN_RENDER_WINDOW
+#include "../core/je_configuration.h"
+#if defined(jin_graphics)
+
+#include "SDL2/SDL.h"
+
+#include "../utils/je_utils.h"
+#include "../math/je_vector2.hpp"
+#include "../common/je_subsystem.hpp"
+
+namespace jin
+{
+ namespace graphics
+ {
+ ///
+ ///
+ ///
+ class Window : public Subsystem<Window>
+ {
+ public:
+ ///
+ ///
+ ///
+ struct Setting : SettingBase
+ {
+ public:
+ const char* title; ///< window title
+ bool fullscreen; ///< full screen
+ int width, height; ///< window size
+ bool vsync; ///< vsync
+ int fps; ///< frame per second
+ bool resizable; ///< resizable
+ };
+
+ ///
+ ///
+ ///
+ void setTitle(const char* title);
+
+ ///
+ ///
+ ///
+ inline int getW(){ return size.w; }
+
+ ///
+ ///
+ ///
+ inline int getH(){ return size.h; }
+
+ ///
+ ///
+ ///
+ inline int getFPS(){ return fps; }
+
+ ///
+ ///
+ ///
+ void swapBuffers();
+
+ private:
+ // declare a singleton
+ singleton(Window);
+
+ ///
+ ///
+ ///
+ Window() {};
+
+ ///
+ ///
+ ///
+ virtual ~Window() {};
+
+ ///
+ ///
+ ///
+ bool initSystem(const SettingBase* setting) override;
+
+ ///
+ ///
+ ///
+ void quitSystem() override;
+
+ SDL_Window* wnd;
+ jin::math::Vector2<unsigned int> size;
+ int fps;
+
+ };
+
+ } // namespace graphics
+} // namespace jin
+
+#endif // jin_graphics
+
+#endif // __LIBJIN_RENDER_WINDOW \ No newline at end of file
diff --git a/src/libjin/Input/Event.cpp b/src/libjin/Input/Event.cpp
deleted file mode 100644
index c8eb78c..0000000
--- a/src/libjin/Input/Event.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "event.h"
-#include "SDL2\SDL.h"
-
-namespace jin
-{
-
-} // namespace jin \ No newline at end of file
diff --git a/src/libjin/Input/Event.h b/src/libjin/Input/Event.h
deleted file mode 100644
index 3f2bc8e..0000000
--- a/src/libjin/Input/Event.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef __LIBJIN_EVENT_H
-#define __LIBJIN_EVENT_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_INPUT
-
-namespace jin
-{
- namespace input
- {
- #if LIBJIN_INPUT_SDL
- #include "SDL.h"
-
- typedef SDL_Event Event;
- typedef SDL_Keycode Key;
- typedef SDL_MouseWheelEvent Wheel;
-
- enum EventType {
- QUIT = SDL_QUIT,
- /* keyboard events */
- KEY_DOWN = SDL_KEYDOWN,
- KEY_UP = SDL_KEYUP,
- /* mouse events */
- MOUSE_MOTION = SDL_MOUSEMOTION,
- MOUSE_BUTTON_DOWN = SDL_MOUSEBUTTONDOWN,
- MOUSE_BUTTON_UP = SDL_MOUSEBUTTONUP,
- MOUSE_WHEEL = SDL_MOUSEWHEEL,
- /* joypad events */
- JOYBUTTONDOWN = SDL_JOYBUTTONDOWN,
- JOYBUTTONUP = SDL_JOYBUTTONUP,
- JOYAXISMOTION = SDL_JOYAXISMOTION,
- JOYBALLMOTION = SDL_JOYBALLMOTION,
- JOYHATMOTION = SDL_JOYHATMOTION,
- JOYDEVICEADDED = SDL_JOYDEVICEADDED,
- JOYDEVICEREMOVED = SDL_JOYDEVICEREMOVED,
- CONTROLLERBUTTONDOWN = SDL_CONTROLLERBUTTONDOWN,
- CONTROLLERBUTTONUP = SDL_CONTROLLERBUTTONUP,
- CONTROLLERAXISMOTION = SDL_CONTROLLERAXISMOTION,
- /* window evnets */
- WINDOW_EVENT = SDL_WINDOWEVENT,
- };
-
- enum WindowEvent {
- WINDOW_SHOWN = SDL_WINDOWEVENT_SHOWN ,
- WINDOW_HIDDEN = SDL_WINDOWEVENT_HIDDEN ,
- WINDOW_EXPOSED = SDL_WINDOWEVENT_EXPOSED ,
- WINDOW_MOVED = SDL_WINDOWEVENT_MOVED ,
- WINDOW_RESIZED = SDL_WINDOWEVENT_RESIZED ,
- WINDOW_SIZE_CAHNGE = SDL_WINDOWEVENT_SIZE_CHANGED ,
- WINDOW_MINIMIZED = SDL_WINDOWEVENT_MINIMIZED ,
- WINDOW_MAXIMIZED = SDL_WINDOWEVENT_MAXIMIZED ,
- WINDOW_RESTORED = SDL_WINDOWEVENT_RESTORED ,
- WINDOW_ENTER = SDL_WINDOWEVENT_ENTER ,
- WINDOW_LEAVE = SDL_WINDOWEVENT_LEAVE ,
- WINDOW_FOCUS_GAINED = SDL_WINDOWEVENT_FOCUS_GAINED,
- WINDOW_FOCUS_LOST = SDL_WINDOWEVENT_FOCUS_LOST ,
- WINDOW_CLOSE = SDL_WINDOWEVENT_CLOSE ,
- WINDOW_TAKE_FOCUS = SDL_WINDOWEVENT_TAKE_FOCUS ,
- WINDOW_HIT_TEST = SDL_WINDOWEVENT_HIT_TEST ,
- };
-
- inline int pollEvent(Event* e)
- {
- return SDL_PollEvent(e);
- }
-
- inline const char* getKeyName(Key key)
- {
- return SDL_GetKeyName(key);
- }
-
- inline const char* getButtonName(int button)
- {
- switch (button)
- {
- case 1: return "Left";
- case 2: return "Middle";
- case 3: return "Right";
- case 4: return "WheelUp";
- case 5: return "WheelDown";
- default: return "?";
- }
- }
-
- /*
- inline const char* getWheelName(Wheel wheel)
- {
- if (wheel.x == -1)
- return "left";
- else if (wheel.x == 1)
- return "right";
- else if (wheel.y == -1)
- return "near";
- else if (wheel.y == 1)
- return "far";
- else
- return "none";
- }
- */
-
- #endif // LIBJIN_INPUT_SDL
- } // namespace input
-} // namespace jin
-
-#endif // LIBJIN_MODULES_INPUT
-#endif \ No newline at end of file
diff --git a/src/libjin/Input/Input.h b/src/libjin/Input/Input.h
deleted file mode 100644
index a828ac7..0000000
--- a/src/libjin/Input/Input.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __LIBJIN_INPUT_H
-#define __LIBJIN_INPUT_H
-
-#include "event.h"
-#include "keyboard.h"
-#include "mouse.h"
-#include "joypad.h"
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Input/Mouse.cpp b/src/libjin/Input/Mouse.cpp
deleted file mode 100644
index dcaa771..0000000
--- a/src/libjin/Input/Mouse.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "../configuration.h"
-#ifdef LIBJIN_MODULES_INPUT
-
-#include "SDL.h"
-#include "Mouse.h"
-
-namespace jin
-{
- namespace input
- {
-
- void Mouse::getState(int* x, int* y)
- {
- #ifdef LIBJIN_INPUT_SDL
- SDL_GetMouseState(x, y);
- #endif // LIBJIN_INPUT_SDL
- }
-
- void Mouse::setVisible(bool visible)
- {
- SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
- }
-
- } // namespace input
-} // namespace jin
-
-#endif // LIBJIN_MODULES_INPUT \ No newline at end of file
diff --git a/src/libjin/Input/Mouse.h b/src/libjin/Input/Mouse.h
deleted file mode 100644
index 7e93792..0000000
--- a/src/libjin/Input/Mouse.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __LIBJIN_MOUSE_H
-#define __LIBJIN_MOUSE_H
-#include "../configuration.h"
-#ifdef LIBJIN_MODULES_INPUT
-
-#include "../Common/Singleton.hpp"
-
-namespace jin
-{
- namespace input
- {
-
- class Mouse : public Singleton<Mouse>
- {
- public:
- void getState(int* x, int* y);
- void setVisible(bool visible);
-
- private:
- singleton(Mouse);
-
- Mouse() {};
- ~Mouse() {};
-
- };
-
- } // namespace input
-} // namespace jin
-
-#endif // LIBJIN_MODULES_INPUT
-#endif // __LIBJIN_MOUSE_H \ No newline at end of file
diff --git a/src/libjin/Input/je_event.cpp b/src/libjin/Input/je_event.cpp
new file mode 100644
index 0000000..4f55839
--- /dev/null
+++ b/src/libjin/Input/je_event.cpp
@@ -0,0 +1,8 @@
+#include "SDL2\SDL.h"
+
+#include "je_event.h"
+
+namespace jin
+{
+
+} // namespace jin \ No newline at end of file
diff --git a/src/libjin/input/event.h b/src/libjin/Input/je_event.h
index 3f2bc8e..d8ceda0 100644
--- a/src/libjin/input/event.h
+++ b/src/libjin/Input/je_event.h
@@ -1,6 +1,6 @@
#ifndef __LIBJIN_EVENT_H
#define __LIBJIN_EVENT_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_INPUT
namespace jin
diff --git a/src/libjin/Input/je_input.h b/src/libjin/Input/je_input.h
new file mode 100644
index 0000000..2f6a895
--- /dev/null
+++ b/src/libjin/Input/je_input.h
@@ -0,0 +1,9 @@
+#ifndef __LIBJIN_INPUT_H
+#define __LIBJIN_INPUT_H
+
+#include "je_event.h"
+#include "je_keyboard.h"
+#include "je_mouse.h"
+#include "je_joypad.h"
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Input/Joypad.cpp b/src/libjin/Input/je_joypad.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Input/Joypad.cpp
+++ b/src/libjin/Input/je_joypad.cpp
diff --git a/src/libjin/Input/Joypad.h b/src/libjin/Input/je_joypad.h
index 570699e..570699e 100644
--- a/src/libjin/Input/Joypad.h
+++ b/src/libjin/Input/je_joypad.h
diff --git a/src/libjin/Input/Keyboard.cpp b/src/libjin/Input/je_keyboard.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Input/Keyboard.cpp
+++ b/src/libjin/Input/je_keyboard.cpp
diff --git a/src/libjin/Input/Keyboard.h b/src/libjin/Input/je_keyboard.h
index 60f1169..60f1169 100644
--- a/src/libjin/Input/Keyboard.h
+++ b/src/libjin/Input/je_keyboard.h
diff --git a/src/libjin/input/mouse.cpp b/src/libjin/Input/je_mouse.cpp
index dcaa771..21e59fb 100644
--- a/src/libjin/input/mouse.cpp
+++ b/src/libjin/Input/je_mouse.cpp
@@ -1,8 +1,9 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#ifdef LIBJIN_MODULES_INPUT
#include "SDL.h"
-#include "Mouse.h"
+
+#include "je_mouse.h"
namespace jin
{
diff --git a/src/libjin/input/mouse.h b/src/libjin/Input/je_mouse.h
index 7e93792..e9fab42 100644
--- a/src/libjin/input/mouse.h
+++ b/src/libjin/Input/je_mouse.h
@@ -1,9 +1,9 @@
#ifndef __LIBJIN_MOUSE_H
#define __LIBJIN_MOUSE_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#ifdef LIBJIN_MODULES_INPUT
-#include "../Common/Singleton.hpp"
+#include "../common/je_singleton.hpp"
namespace jin
{
diff --git a/src/libjin/Math/constant.h b/src/libjin/Math/je_constant.h
index f8e0f5a..f8e0f5a 100644
--- a/src/libjin/Math/constant.h
+++ b/src/libjin/Math/je_constant.h
diff --git a/src/libjin/Math/Math.h b/src/libjin/Math/je_math.h
index c1b5084..b6a2ffd 100644
--- a/src/libjin/Math/Math.h
+++ b/src/libjin/Math/je_math.h
@@ -1,9 +1,9 @@
#ifndef __LIBJIN_UTILS_MATH_H
#define __LIBJIN_UTILS_MATH_H
-#include "constant.h"
-#include "matrix.h"
-#include "quad.h"
+#include "je_constant.h"
+#include "je_matrix.h"
+#include "je_quad.h"
namespace jin
{
diff --git a/src/libjin/Math/Matrix.cpp b/src/libjin/Math/je_matrix.cpp
index 9f933f8..3a878a0 100644
--- a/src/libjin/Math/Matrix.cpp
+++ b/src/libjin/Math/je_matrix.cpp
@@ -1,4 +1,4 @@
-#include "Matrix.h"
+#include "je_matrix.h"
#include <cstring> // memcpy
#include <cmath>
diff --git a/src/libjin/Math/Matrix.h b/src/libjin/Math/je_matrix.h
index 1fe6ab1..1fe6ab1 100644
--- a/src/libjin/Math/Matrix.h
+++ b/src/libjin/Math/je_matrix.h
diff --git a/src/libjin/Math/Quad.h b/src/libjin/Math/je_quad.h
index 6eb4f45..6eb4f45 100644
--- a/src/libjin/Math/Quad.h
+++ b/src/libjin/Math/je_quad.h
diff --git a/src/libjin/Math/Vector2.hpp b/src/libjin/Math/je_vector2.hpp
index 51ac4a7..51ac4a7 100644
--- a/src/libjin/Math/Vector2.hpp
+++ b/src/libjin/Math/je_vector2.hpp
diff --git a/src/libjin/Math/Vector3.hpp b/src/libjin/Math/je_vector3.hpp
index 96d4e9a..96d4e9a 100644
--- a/src/libjin/Math/Vector3.hpp
+++ b/src/libjin/Math/je_vector3.hpp
diff --git a/src/libjin/Math/Vector4.hpp b/src/libjin/Math/je_vector4.hpp
index 35be056..35be056 100644
--- a/src/libjin/Math/Vector4.hpp
+++ b/src/libjin/Math/je_vector4.hpp
diff --git a/src/libjin/Net/Net.cpp b/src/libjin/Net/Net.cpp
deleted file mode 100644
index 940b239..0000000
--- a/src/libjin/Net/Net.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Net.h"
-
-namespace jin
-{
- namespace net
- {
-
- bool Net::initSystem(const SettingBase* setting)
- {
- #ifdef _WIN32
- #if LIBJIN_NET_TEKCOS
- tk_init();
- #endif
- #endif
- return true;
- }
-
- void Net::quitSystem()
- {
-
- }
-
- } // namespace net
-} // namespace jin \ No newline at end of file
diff --git a/src/libjin/net/net.cpp b/src/libjin/Net/je_net.cpp
index 940b239..c417108 100644
--- a/src/libjin/net/net.cpp
+++ b/src/libjin/Net/je_net.cpp
@@ -1,4 +1,4 @@
-#include "Net.h"
+#include "je_net.h"
namespace jin
{
diff --git a/src/libjin/Net/Net.h b/src/libjin/Net/je_net.h
index 3324d11..7718085 100644
--- a/src/libjin/Net/Net.h
+++ b/src/libjin/Net/je_net.h
@@ -1,10 +1,11 @@
#ifndef __LIBJIN_NET_H
#define __LIBJIN_NET_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_NET
-#include "../Common/Subsystem.hpp"
-#include "Socket.h"
+#include "../common/je_subsystem.hpp"
+
+#include "je_socket.h"
namespace jin
{
diff --git a/src/libjin/Net/Socket.cpp b/src/libjin/Net/je_socket.cpp
index 770b47d..3a8be7f 100644
--- a/src/libjin/Net/Socket.cpp
+++ b/src/libjin/Net/je_socket.cpp
@@ -1,4 +1,4 @@
-#include "Socket.h"
+#include "je_socket.h"
namespace jin
{
diff --git a/src/libjin/Net/Socket.h b/src/libjin/Net/je_socket.h
index 04d3ab0..ab6a561 100644
--- a/src/libjin/Net/Socket.h
+++ b/src/libjin/Net/je_socket.h
@@ -1,6 +1,6 @@
#ifndef __LIBJIN_NET_SOCKET_H
#define __LIBJIN_NET_SOCKET_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_NET
#include "../3rdparty/tekcos/tekcos.h"
diff --git a/src/libjin/Net/net.cpp b/src/libjin/Net/net.cpp
deleted file mode 100644
index 940b239..0000000
--- a/src/libjin/Net/net.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Net.h"
-
-namespace jin
-{
- namespace net
- {
-
- bool Net::initSystem(const SettingBase* setting)
- {
- #ifdef _WIN32
- #if LIBJIN_NET_TEKCOS
- tk_init();
- #endif
- #endif
- return true;
- }
-
- void Net::quitSystem()
- {
-
- }
-
- } // namespace net
-} // namespace jin \ No newline at end of file
diff --git a/src/libjin/Net/net.h b/src/libjin/Net/net.h
deleted file mode 100644
index 3324d11..0000000
--- a/src/libjin/Net/net.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __LIBJIN_NET_H
-#define __LIBJIN_NET_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_NET
-
-#include "../Common/Subsystem.hpp"
-#include "Socket.h"
-
-namespace jin
-{
- namespace net
- {
-
- class Net : public Subsystem<Net>
- {
- public:
-
- protected:
- singleton(Net);
- Net() {};
- ~Net() {};
- bool initSystem(const SettingBase* setting) override;
- void quitSystem() override;
-
- };
-
- } // namespace net
-} // namespace jin
-
-#endif // LIBJIN_MODULES_NET
-#endif // __LIBJIN_NET_H
diff --git a/src/libjin/Thread/Thread.h b/src/libjin/Thread/Thread.h
deleted file mode 100644
index ea50444..0000000
--- a/src/libjin/Thread/Thread.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef __LIBJIN_THREAD_H
-#define __LIBJIN_THREAD_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_THREAD
-
-#include <string>
-#include <map>
-#if LIBJIN_THREAD_SDL
-# include "SDL2/SDL_thread.h"
-#elif LIBJIN_THREAD_CPP
-# include <thread>
-# include <mutex>
-# include <condition_variable>
-#endif
-
-namespace jin
-{
- namespace thread
- {
- /**
- * ӢӢMutual exclusionд Mutexһڶ̱߳Уֹ߳ͬʱͬһԴ
- * ȫֱждĻơĿͨƬһһٽcritical sectionɡٽ
- * ָһԹԴзʵĴ룬һֻƻ㷨һ򡢽̡߳̿ӵжٽ򣬵Dz
- * һӦûҪ˻ƵԴУꡢСжϴڶеĴ
- * ݡͬ״̬ȵԴάЩԴͬһºǺѵģΪһ߳̿κһʱ̱ͣ
- * ߣ߻ָѣ
- */
- class Mutex;
- class Conditional;
-
- /**
- * Thread::demand Receive a message from a thread. Wait for the message to exist before returning.
- * Thread::getName Get the name of a thread.
- * Thread::kill Forcefully terminate the thread.
- * Thread::peek Receive a message from a thread, but leave it in the message box.
- * Thread::receive Receive a message from a thread.
- * Thread::send Send a message.
- * Thread::set Set a value.
- * Thread::start Starts the thread.
- * Thread::wait Wait for a thread to finish.
- */
- class Thread
- {
- public:
- struct Variant
- {
- enum Type
- {
- NONE = 0,
- INTERGER,
- BOOLEAN,
- CHARACTER,
- CSTRING,
- POINTER,
- REAL,
- };
- Type type;
- union
- {
- int integer;
- bool boolean;
- char character;
- const char* cstring;
- void* pointer;
- float real;
- };
- Variant() :type(NONE) {};
- Variant(const Variant& v){ memcpy(this, &v, sizeof(v)); }
- Variant(int i) : integer(i), type(INTERGER) {};
- Variant(float f) : real(f), type(REAL) {};
- Variant(bool b) : boolean(b), type(BOOLEAN) {};
- Variant(char c) : character(c), type(CHARACTER) {};
- Variant(const char* s) : cstring(s), type(CSTRING) {};
- Variant(void* p) : pointer(p), type(POINTER) {};
- };
-
- private:
- class ThreadData
- {
- public:
- static const int SLOT_ERROR = -1;
- static const int SLOT_WARN = -2;
- static const int SLOT_INFO = -3;
- static const int SLOT_DEBUG = -4;
-
- ThreadData(Mutex*, Conditional*);
- ~ThreadData();
- bool exist(int slot);
- void set(int slot, Variant value);
- Variant get(int slot);
- void remove(int slot);
-
- Conditional* condition;
- Mutex* mutex;
-
- private:
- std::map<int, Variant> share; // threads shared value
-
- };
-
- public:
- typedef int(*ThreadRunner)(void* obj);
-
- Thread(const std::string name, ThreadRunner threadfuncs);
- ~Thread();
- bool start(void* p);
- void wait();
- void send(int slot, const Variant& value);
- bool receive(int slot);
- Variant fetch(int slot);
- Variant demand(int slot);
- void remove(int slot);
- const char* getName();
- bool isRunning();
- void lock();
- void unlock();
-
- protected:
- #if LIBJIN_THREAD_SDL
- SDL_Thread* handle; // SDL thread
- #elif LIBJIN_THREAD_CPP
- std::thread* handle; // cpp thread
- #endif
- Mutex* mutex; // mutex variable
- Conditional* condition; // condition variable
- ThreadRunner threadRunner; // thread function
- ThreadData* common; // threads common data
- const std::string name; // thread name, for debugging purposes
- /**
- * https://stackoverflow.com/questions/149932/naming-conventions-for-threads
- *
- * Use short names because they don't make the lines in a log file too long.
- *
- * Create names where the important part is at the beginning. Log viewers in a
- * graphical user interface tend to have tables with columns, and the thread
- * column is usually small or will be made small by you to read everything else.
- *
- * Do not use the word "thread" in the thread name because it is obvious.
- *
- * Make the thread names easily grep-able. Avoid similar sounding thread names
- *
- * If you have several threads of the same nature, enumerate them with IDs that
- * are unique to one execution of the application or one log file, whichever fits
- * your logging habits.
- *
- * Avoid generalizations like "WorkerThread" (how do you name the next 5 worker
- * threads?), "GUIThread" (which GUI? is it for one window? for everything?) or
- * "Calculation" (what does it calculate?).
- *
- * If you have a test group that uses thread names to grep your application's log
- * files, do not rename your threads after some time. Your testers will hate you for
- * doing so. Thread names in well-tested applications should be there to stay.
- *
- * When you have threads that service a network connection, try to include the target
- * network address in the thread name (e.g. channel_123.212.123.3). Don't forget about
- * enumeration though if there are multiple connections to the same host.
- */
- bool running; // running
-
- };
-
- } // namespace thread
-} // namespace jin
-
-#endif // LIBJIN_MODULES_THREAD
-#endif // __LIBJIN_THREAD_H \ No newline at end of file
diff --git a/src/libjin/Thread/Thread.cpp b/src/libjin/Thread/je_thread.cpp
index 3f2a50d..6bf6f46 100644
--- a/src/libjin/Thread/Thread.cpp
+++ b/src/libjin/Thread/je_thread.cpp
@@ -1,7 +1,7 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_THREAD
-#include "Thread.h"
+#include "je_thread.h"
namespace jin
{
diff --git a/src/libjin/thread/thread.h b/src/libjin/Thread/je_thread.h
index ea50444..bdbc093 100644
--- a/src/libjin/thread/thread.h
+++ b/src/libjin/Thread/je_thread.h
@@ -1,16 +1,16 @@
#ifndef __LIBJIN_THREAD_H
#define __LIBJIN_THREAD_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_THREAD
#include <string>
#include <map>
#if LIBJIN_THREAD_SDL
-# include "SDL2/SDL_thread.h"
+ #include "SDL2/SDL_thread.h"
#elif LIBJIN_THREAD_CPP
-# include <thread>
-# include <mutex>
-# include <condition_variable>
+ #include <thread>
+ #include <mutex>
+ #include <condition_variable>
#endif
namespace jin
diff --git a/src/libjin/Thread/thread.cpp b/src/libjin/Thread/thread.cpp
deleted file mode 100644
index 3f2a50d..0000000
--- a/src/libjin/Thread/thread.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "../configuration.h"
-#if LIBJIN_MODULES_THREAD
-
-#include "Thread.h"
-
-namespace jin
-{
- namespace thread
- {
-
- class Mutex
- {
- public:
- Mutex();
- ~Mutex();
-
- void lock();
- void unlock();
- private:
- #if LIBJIN_THREAD_SDL
- SDL_mutex* mutex;
- #endif
- friend class Conditional;
- };
-
- // ̼߳signal wait
- class Conditional
- {
- public:
- Conditional();
- ~Conditional();
- void signal();
- void broadcast();
- bool wait(Mutex* mutex, int timeout = -1);
- private:
- #if LIBJIN_THREAD_SDL
- SDL_cond* cond;
- #endif
- };
-
- class Lock
- {
- public:
- Lock(Mutex* m) : mutex(m) {
- mutex->lock();
- }
-
- Lock(Mutex& m) : mutex(&m) {
- mutex->lock();
- }
-
- ~Lock() {
- mutex->unlock();
- }
- private:
- Mutex* mutex;
-
- Lock(Lock&) {}
-
- };
-
- //////////////////////////////////////////////////////////////////////
-
- Mutex::Mutex()
- {
- #if LIBJIN_THREAD_SDL
- mutex = SDL_CreateMutex();
- #endif
- }
-
- Mutex::~Mutex()
- {
- #if LIBJIN_THREAD_SDL
- SDL_DestroyMutex(mutex);
- #endif
- }
-
- void Mutex::lock()
- {
- #if LIBJIN_THREAD_SDL
- SDL_LockMutex(mutex);
- #endif
- }
-
- void Mutex::unlock()
- {
- #if LIBJIN_THREAD_SDL
- SDL_UnlockMutex(mutex);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Conditional::Conditional()
- {
- #if LIBJIN_THREAD_SDL
- cond = SDL_CreateCond();
- #endif
- }
-
- Conditional::~Conditional()
- {
- #if LIBJIN_THREAD_SDL
- SDL_DestroyCond(cond);
- #endif
- }
-
- void Conditional::signal()
- {
- #if LIBJIN_THREAD_SDL
- SDL_CondSignal(cond);
- #endif
- }
-
- void Conditional::broadcast()
- {
- #if LIBJIN_THREAD_SDL
- SDL_CondBroadcast(cond);
- #endif
- }
-
- bool Conditional::wait(Mutex* mutex, int timeout)
- {
- #if LIBJIN_THREAD_SDL
- if (timeout < 0)
- return !SDL_CondWait(cond, mutex->mutex);
- else
- return (SDL_CondWaitTimeout(cond, mutex->mutex, timeout) == 0);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::ThreadData::ThreadData(Mutex* m, Conditional* c)
- : mutex(m)
- , condition(c)
- , share()
- {
- }
-
- Thread::ThreadData::~ThreadData()
- {
- }
-
- void Thread::ThreadData::set(int slot, Variant value)
- {
- Lock l(mutex);
- share[slot] = value;
- }
-
- Thread::Variant Thread::ThreadData::get(int slot)
- {
- Lock l(mutex);
- return share[slot];
- }
-
- bool Thread::ThreadData::exist(int slot)
- {
- Lock l(mutex);
- return share.count(slot) == 1;
- }
-
- void Thread::ThreadData::remove(int slot)
- {
- Lock l(mutex);
- if (exist(slot))
- {
- share.erase(slot);
- }
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::Thread(const std::string tname, ThreadRunner runner)
- : name(tname)
- , running(false)
- , threadRunner(runner)
- {
- mutex = new Mutex();
- condition = new Conditional();
- common = new Thread::ThreadData(mutex, condition);
- }
-
- Thread::~Thread()
- {
- #if LIBJIN_THREAD_SDL
- #endif
- }
-
- const char* Thread::getName()
- {
- Lock l(mutex);
- return name.c_str();
- };
-
- bool Thread::isRunning()
- {
- Lock l(mutex);
- return running;
- };
-
- bool Thread::start(void* p)
- {
- Lock l(mutex);
- if (running)
- return false;
- if (handle)
- {
- #if LIBJIN_THREAD_SDL
- SDL_WaitThread(handle, nullptr);
- #endif
- }
- #if LIBJIN_THREAD_SDL
- handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif LIBJIN_THREAD_CPP
- handle = new std::thread();
- #endif
- return (running = (handle != nullptr));
- }
-
- void Thread::wait()
- {
- {
- Lock l(mutex);
- if (!handle)
- return;
- }
- #if LIBJIN_THREAD_SDL
- SDL_WaitThread(handle, nullptr);
- #endif
- Lock l(mutex);
- running = false;
- handle = nullptr;
- }
-
- void Thread::lock()
- {
- if (mutex != nullptr)
- mutex->lock();
- }
-
- void Thread::unlock()
- {
- if (mutex != nullptr)
- mutex->unlock();
- }
-
- void Thread::send(int slot, const Variant& value)
- {
- lock();
- common->set(slot, value);
- unlock();
- condition->broadcast();
- }
-
- bool Thread::receive(int slot)
- {
- return common->exist(slot);
- }
-
- Thread::Variant Thread::fetch(int slot)
- {
- Thread::Variant v = common->get(slot);
- return v;
- }
-
- Thread::Variant Thread::demand(int slot)
- {
- /**
- * pthread_mutex_lock(mtx);
- * while(pass == 0)
- * {
- * pthread_mutex_unlock(mtx);
- * pthread_cond_just_wait(cv);
- * pthread_mutex_lock(mtx);
- * }
- * pthread_mutex_unlock(mtx);
- */
- lock();
- while (!common->exist(slot))
- {
- if (common->exist(ThreadData::SLOT_ERROR))
- return 0;
- condition->wait(mutex);
- }
- Thread::Variant v = common->get(slot);
- unlock();
- return v;
- }
-
- void Thread::remove(int slot)
- {
- lock();
- common->remove(slot);
- unlock();
- }
-
- } // namespace thread
-} // namespace jin
-
-#endif // LIBJIN_MODULES_THREAD \ No newline at end of file
diff --git a/src/libjin/Thread/thread.h b/src/libjin/Thread/thread.h
deleted file mode 100644
index ea50444..0000000
--- a/src/libjin/Thread/thread.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef __LIBJIN_THREAD_H
-#define __LIBJIN_THREAD_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_THREAD
-
-#include <string>
-#include <map>
-#if LIBJIN_THREAD_SDL
-# include "SDL2/SDL_thread.h"
-#elif LIBJIN_THREAD_CPP
-# include <thread>
-# include <mutex>
-# include <condition_variable>
-#endif
-
-namespace jin
-{
- namespace thread
- {
- /**
- * ӢӢMutual exclusionд Mutexһڶ̱߳Уֹ߳ͬʱͬһԴ
- * ȫֱждĻơĿͨƬһһٽcritical sectionɡٽ
- * ָһԹԴзʵĴ룬һֻƻ㷨һ򡢽̡߳̿ӵжٽ򣬵Dz
- * һӦûҪ˻ƵԴУꡢСжϴڶеĴ
- * ݡͬ״̬ȵԴάЩԴͬһºǺѵģΪһ߳̿κһʱ̱ͣ
- * ߣ߻ָѣ
- */
- class Mutex;
- class Conditional;
-
- /**
- * Thread::demand Receive a message from a thread. Wait for the message to exist before returning.
- * Thread::getName Get the name of a thread.
- * Thread::kill Forcefully terminate the thread.
- * Thread::peek Receive a message from a thread, but leave it in the message box.
- * Thread::receive Receive a message from a thread.
- * Thread::send Send a message.
- * Thread::set Set a value.
- * Thread::start Starts the thread.
- * Thread::wait Wait for a thread to finish.
- */
- class Thread
- {
- public:
- struct Variant
- {
- enum Type
- {
- NONE = 0,
- INTERGER,
- BOOLEAN,
- CHARACTER,
- CSTRING,
- POINTER,
- REAL,
- };
- Type type;
- union
- {
- int integer;
- bool boolean;
- char character;
- const char* cstring;
- void* pointer;
- float real;
- };
- Variant() :type(NONE) {};
- Variant(const Variant& v){ memcpy(this, &v, sizeof(v)); }
- Variant(int i) : integer(i), type(INTERGER) {};
- Variant(float f) : real(f), type(REAL) {};
- Variant(bool b) : boolean(b), type(BOOLEAN) {};
- Variant(char c) : character(c), type(CHARACTER) {};
- Variant(const char* s) : cstring(s), type(CSTRING) {};
- Variant(void* p) : pointer(p), type(POINTER) {};
- };
-
- private:
- class ThreadData
- {
- public:
- static const int SLOT_ERROR = -1;
- static const int SLOT_WARN = -2;
- static const int SLOT_INFO = -3;
- static const int SLOT_DEBUG = -4;
-
- ThreadData(Mutex*, Conditional*);
- ~ThreadData();
- bool exist(int slot);
- void set(int slot, Variant value);
- Variant get(int slot);
- void remove(int slot);
-
- Conditional* condition;
- Mutex* mutex;
-
- private:
- std::map<int, Variant> share; // threads shared value
-
- };
-
- public:
- typedef int(*ThreadRunner)(void* obj);
-
- Thread(const std::string name, ThreadRunner threadfuncs);
- ~Thread();
- bool start(void* p);
- void wait();
- void send(int slot, const Variant& value);
- bool receive(int slot);
- Variant fetch(int slot);
- Variant demand(int slot);
- void remove(int slot);
- const char* getName();
- bool isRunning();
- void lock();
- void unlock();
-
- protected:
- #if LIBJIN_THREAD_SDL
- SDL_Thread* handle; // SDL thread
- #elif LIBJIN_THREAD_CPP
- std::thread* handle; // cpp thread
- #endif
- Mutex* mutex; // mutex variable
- Conditional* condition; // condition variable
- ThreadRunner threadRunner; // thread function
- ThreadData* common; // threads common data
- const std::string name; // thread name, for debugging purposes
- /**
- * https://stackoverflow.com/questions/149932/naming-conventions-for-threads
- *
- * Use short names because they don't make the lines in a log file too long.
- *
- * Create names where the important part is at the beginning. Log viewers in a
- * graphical user interface tend to have tables with columns, and the thread
- * column is usually small or will be made small by you to read everything else.
- *
- * Do not use the word "thread" in the thread name because it is obvious.
- *
- * Make the thread names easily grep-able. Avoid similar sounding thread names
- *
- * If you have several threads of the same nature, enumerate them with IDs that
- * are unique to one execution of the application or one log file, whichever fits
- * your logging habits.
- *
- * Avoid generalizations like "WorkerThread" (how do you name the next 5 worker
- * threads?), "GUIThread" (which GUI? is it for one window? for everything?) or
- * "Calculation" (what does it calculate?).
- *
- * If you have a test group that uses thread names to grep your application's log
- * files, do not rename your threads after some time. Your testers will hate you for
- * doing so. Thread names in well-tested applications should be there to stay.
- *
- * When you have threads that service a network connection, try to include the target
- * network address in the thread name (e.g. channel_123.212.123.3). Don't forget about
- * enumeration though if there are multiple connections to the same host.
- */
- bool running; // running
-
- };
-
- } // namespace thread
-} // namespace jin
-
-#endif // LIBJIN_MODULES_THREAD
-#endif // __LIBJIN_THREAD_H \ No newline at end of file
diff --git a/src/libjin/Time/Timer.cpp b/src/libjin/Time/je_timer.cpp
index 6f3bc80..ac66de1 100644
--- a/src/libjin/Time/Timer.cpp
+++ b/src/libjin/Time/je_timer.cpp
@@ -1,7 +1,7 @@
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_TIME
-#include "Timer.h"
+#include "je_timer.h"
namespace jin
{
diff --git a/src/libjin/Time/Timer.h b/src/libjin/Time/je_timer.h
index ff67590..c31de42 100644
--- a/src/libjin/Time/Timer.h
+++ b/src/libjin/Time/je_timer.h
@@ -1,10 +1,10 @@
#ifndef __LIBJIN_TIMER_H
#define __LIBJIN_TIMER_H
-#include "../configuration.h"
+#include "../core/je_configuration.h"
#if LIBJIN_MODULES_TIME
-#include "SDL2/SDL.h"
#include <vector>
+#include "SDL2/SDL.h"
namespace jin
{
diff --git a/src/libjin/Utils/Log.h b/src/libjin/Utils/Log.h
deleted file mode 100644
index e4ed879..0000000
--- a/src/libjin/Utils/Log.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
-* Single.h/loghelper.h
-* Copyright (C) 2017~2018 chai
-*/
-#ifndef __LOG_HELPER_H
-#define __LOG_HELPER_H
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <stdarg.h>
-
-class Loghelper
-{
-public:
- // logĿ
- enum Direction
- {
- DIR_CERR = 1 << 1, // ׼
- DIR_FILE = 1 << 2, // logļ
- };
-
- // ȼ
- enum Level
- {
- LV_NONE = 0, // none
- LV_ERROR = 1 << 1, // error
- LV_WARN = 1 << 2, // warn
- LV_INFO = 1 << 3, // info
- LV_DEBUG = 1 << 4, // debug
- LV_ALL = 0xffffffff
- };
-
- static void log(Level _level, const char* _fmt, ...);
-
- // ض
- static void redirect(unsigned int _dir, char* _path = nullptr);
-
- // ɸѡȼ
- static void restrict(unsigned int levels);
-
- static void close();
-
-private:
- static unsigned int dir; // Ŀ
- static unsigned int levels; // ȼ
- static std::ofstream fs; // ļ
-};
-
-typedef Loghelper::Level Loglevel;
-
-#ifdef LOGHELPER_IMPLEMENT
-
-#define hasbit(flag, bit) ((flag & bit) == bit)
-
-unsigned int Loghelper::dir = Loghelper::Direction::DIR_CERR;
-unsigned int Loghelper::levels = Loghelper::Level::LV_ALL;
-std::ofstream Loghelper::fs;
-
-void Loghelper::log(Level _level, const char* _fmt, ...)
-{
- if (!hasbit(levels, _level))
- return;
-#define FORMAT_MSG_BUFFER_SIZE (204800)
- const char* levelStr = nullptr;
- switch (_level)
- {
- case LV_ERROR:
- levelStr = "[Jin Error]:";
- break;
- case LV_WARN:
- levelStr = "[Jin Warn]:";
- break;
- case LV_INFO:
- levelStr = "[Jin Info]:";
- break;
- case LV_DEBUG:
- levelStr = "[Jin Debug]:";
- break;
- default:
- levelStr = "[Jin Unknown]:";
- break;
- }
- char buffer[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
- strcpy(buffer, levelStr);
- va_list args;
- va_start(args, _fmt);
- vsnprintf(buffer + strlen(buffer), FORMAT_MSG_BUFFER_SIZE, _fmt, args);
- va_end(args);
- if (hasbit(dir, DIR_CERR))
- {
- std::cerr << buffer << std::endl;
- }
- if (hasbit(dir, DIR_FILE))
- {
- fs << buffer << std::endl;
- }
-#undef FORMAT_MSG_BUFFER_SIZE
-}
-
-// ض
-void Loghelper::redirect(unsigned int _dir, char* _path)
-{
- dir = _dir;
- if (hasbit(dir, DIR_FILE))
- {
- try
- {
- fs.open(_path, std::ios_base::app);
- }
- catch (std::ios_base::failure& e) {
- dir = DIR_CERR;
- log(Level::LV_WARN, "ضlog· %s ʧ", _path);
- }
- }
-}
-
-// ɸѡȼ
-void Loghelper::restrict(unsigned int _levels)
-{
- levels = _levels;
-}
-
-void Loghelper::close()
-{
- if (!fs.fail())
- fs.close();
- fs.clear();
-}
-
-#undef hasbit
-
-#endif
-
-#endif
diff --git a/src/libjin/Utils/endian.h b/src/libjin/Utils/je_endian.h
index 01def88..01def88 100644
--- a/src/libjin/Utils/endian.h
+++ b/src/libjin/Utils/je_endian.h
diff --git a/src/libjin/Utils/Log.cpp b/src/libjin/Utils/je_log.cpp
index 5299942..2bcb25a 100644
--- a/src/libjin/Utils/Log.cpp
+++ b/src/libjin/Utils/je_log.cpp
@@ -1,2 +1,2 @@
#define LOGHELPER_IMPLEMENT
-#include "log.h" \ No newline at end of file
+#include "je_log.h" \ No newline at end of file
diff --git a/src/libjin/utils/log.h b/src/libjin/Utils/je_log.h
index e4ed879..9b3fe2c 100644
--- a/src/libjin/utils/log.h
+++ b/src/libjin/Utils/je_log.h
@@ -4,6 +4,7 @@
*/
#ifndef __LOG_HELPER_H
#define __LOG_HELPER_H
+
#include <string>
#include <iostream>
#include <fstream>
diff --git a/src/libjin/Utils/macros.h b/src/libjin/Utils/je_macros.h
index e19193c..e19193c 100644
--- a/src/libjin/Utils/macros.h
+++ b/src/libjin/Utils/je_macros.h
diff --git a/src/libjin/utils/unittest.cpp b/src/libjin/Utils/je_unittest.cpp
index 44f1ae5..65dbaad 100644
--- a/src/libjin/utils/unittest.cpp
+++ b/src/libjin/Utils/je_unittest.cpp
@@ -1,4 +1,4 @@
-#include "utils.h"
+#include "je_utils.h"
#if UNITTEST
#include <iostream>
diff --git a/src/libjin/Utils/utils.h b/src/libjin/Utils/je_utils.h
index 1654a8f..583f892 100644
--- a/src/libjin/Utils/utils.h
+++ b/src/libjin/Utils/je_utils.h
@@ -1,8 +1,8 @@
#ifndef __LIBJIN_UTILS_H
#define __LIBJIN_UTILS_H
-#include "macros.h"
-#include "endian.h"
+#include "je_macros.h"
+#include "je_endian.h"
#define UNITTEST 0
diff --git a/src/libjin/Utils/log.h b/src/libjin/Utils/log.h
deleted file mode 100644
index e4ed879..0000000
--- a/src/libjin/Utils/log.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
-* Single.h/loghelper.h
-* Copyright (C) 2017~2018 chai
-*/
-#ifndef __LOG_HELPER_H
-#define __LOG_HELPER_H
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <stdarg.h>
-
-class Loghelper
-{
-public:
- // logĿ
- enum Direction
- {
- DIR_CERR = 1 << 1, // ׼
- DIR_FILE = 1 << 2, // logļ
- };
-
- // ȼ
- enum Level
- {
- LV_NONE = 0, // none
- LV_ERROR = 1 << 1, // error
- LV_WARN = 1 << 2, // warn
- LV_INFO = 1 << 3, // info
- LV_DEBUG = 1 << 4, // debug
- LV_ALL = 0xffffffff
- };
-
- static void log(Level _level, const char* _fmt, ...);
-
- // ض
- static void redirect(unsigned int _dir, char* _path = nullptr);
-
- // ɸѡȼ
- static void restrict(unsigned int levels);
-
- static void close();
-
-private:
- static unsigned int dir; // Ŀ
- static unsigned int levels; // ȼ
- static std::ofstream fs; // ļ
-};
-
-typedef Loghelper::Level Loglevel;
-
-#ifdef LOGHELPER_IMPLEMENT
-
-#define hasbit(flag, bit) ((flag & bit) == bit)
-
-unsigned int Loghelper::dir = Loghelper::Direction::DIR_CERR;
-unsigned int Loghelper::levels = Loghelper::Level::LV_ALL;
-std::ofstream Loghelper::fs;
-
-void Loghelper::log(Level _level, const char* _fmt, ...)
-{
- if (!hasbit(levels, _level))
- return;
-#define FORMAT_MSG_BUFFER_SIZE (204800)
- const char* levelStr = nullptr;
- switch (_level)
- {
- case LV_ERROR:
- levelStr = "[Jin Error]:";
- break;
- case LV_WARN:
- levelStr = "[Jin Warn]:";
- break;
- case LV_INFO:
- levelStr = "[Jin Info]:";
- break;
- case LV_DEBUG:
- levelStr = "[Jin Debug]:";
- break;
- default:
- levelStr = "[Jin Unknown]:";
- break;
- }
- char buffer[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
- strcpy(buffer, levelStr);
- va_list args;
- va_start(args, _fmt);
- vsnprintf(buffer + strlen(buffer), FORMAT_MSG_BUFFER_SIZE, _fmt, args);
- va_end(args);
- if (hasbit(dir, DIR_CERR))
- {
- std::cerr << buffer << std::endl;
- }
- if (hasbit(dir, DIR_FILE))
- {
- fs << buffer << std::endl;
- }
-#undef FORMAT_MSG_BUFFER_SIZE
-}
-
-// ض
-void Loghelper::redirect(unsigned int _dir, char* _path)
-{
- dir = _dir;
- if (hasbit(dir, DIR_FILE))
- {
- try
- {
- fs.open(_path, std::ios_base::app);
- }
- catch (std::ios_base::failure& e) {
- dir = DIR_CERR;
- log(Level::LV_WARN, "ضlog· %s ʧ", _path);
- }
- }
-}
-
-// ɸѡȼ
-void Loghelper::restrict(unsigned int _levels)
-{
- levels = _levels;
-}
-
-void Loghelper::close()
-{
- if (!fs.fail())
- fs.close();
- fs.clear();
-}
-
-#undef hasbit
-
-#endif
-
-#endif
diff --git a/src/libjin/Utils/unittest.cpp b/src/libjin/Utils/unittest.cpp
deleted file mode 100644
index 44f1ae5..0000000
--- a/src/libjin/Utils/unittest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "utils.h"
-#if UNITTEST
-
-#include <iostream>
-#include <stdio.h>
-#include <fstream>
-#include "../audio/sdl/source.h"
-#include "../audio/sdl/audio.h"
-
-using namespace jin::audio;
-using namespace std;
-
-int main(int argc, char* argv[])
-{
- SDLAudio* audio = SDLAudio::get();
- audio->init(0);
- SDLSource* source = SDLSource::createSource("a.ogg");
- SDLSource* source2 = SDLSource::createSource("a.wav");
- //source->play();
- source2->play();
- source->setLoop(true);
- source2->setLoop(true);
- int i = 0;
- while (true)
- {
- SDL_Delay(1000);
- }
- audio->quit();
- return 0;
-}
-
-/*
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "SDL2/SDL.h"
-
-#include <3rdparty/cmixer/cmixer.h>
-
-static SDL_mutex* audio_mutex;
-
-static void lock_handler(cm_Event *e) {
- if (e->type == CM_EVENT_LOCK) {
- SDL_LockMutex(audio_mutex);
- }
- if (e->type == CM_EVENT_UNLOCK) {
- SDL_UnlockMutex(audio_mutex);
- }
-}
-
-
-static void audio_callback(void *udata, Uint8 *stream, int size) {
- cm_process((cm_Int16*)stream, size / 2);
-}
-
-
-int main(int argc, char **argv) {
- SDL_AudioDeviceID dev;
- SDL_AudioSpec fmt, got;
- cm_Source *src;
- cm_Source* src2;
-
-
- SDL_Init(SDL_INIT_AUDIO);
- audio_mutex = SDL_CreateMutex();
-
- memset(&fmt, 0, sizeof(fmt));
- fmt.freq = 44100;
- fmt.format = AUDIO_S16;
- fmt.channels = 2;
- fmt.samples = 1024;
- fmt.callback = audio_callback;
-
- dev = SDL_OpenAudioDevice(NULL, 0, &fmt, &got, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
- if (dev == 0) {
- fprintf(stderr, "Error: failed to open audio device '%s'\n", SDL_GetError());
- exit(EXIT_FAILURE);
- }
-
- cm_init(got.freq);
- cm_set_lock(lock_handler);
- cm_set_master_gain(0.5);
-
- SDL_PauseAudioDevice(dev, 0);
-
- src = cm_new_source_from_file("a.ogg");
- src2 = cm_new_source_from_file("loop.wav");
- if (!src) {
- fprintf(stderr, "Error: failed to create source '%s'\n", cm_get_error());
- exit(EXIT_FAILURE);
- }
- cm_set_loop(src2, 1);
-
- cm_play(src);
- cm_play(src2);
-
- printf("Press [return] to exit\n");
- getchar();
-
- cm_destroy_source(src);
- SDL_CloseAudioDevice(dev);
- SDL_Quit();
-
- return EXIT_SUCCESS;
-}
-*/
-
-#endif \ No newline at end of file
diff --git a/src/libjin/audio/audio.cpp b/src/libjin/audio/audio.cpp
deleted file mode 100644
index 928f01a..0000000
--- a/src/libjin/audio/audio.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "../configuration.h"
-#if LIBJIN_MODULES_AUDIO
-
-#include "SDL2/SDL.h"
-#include "audio.h"
-
-namespace jin
-{
- namespace audio
- {
-
- } // namespace audio
-} // namespace jin
-
-#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/audio/audio.h b/src/libjin/audio/audio.h
deleted file mode 100644
index fd391aa..0000000
--- a/src/libjin/audio/audio.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef __LIBJIN_AUDIO_H
-#define __LIBJIN_AUDIO_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_AUDIO
-
-#include "SDL2/SDL.h"
-
-#include "../utils/macros.h"
-#include "../common/Subsystem.hpp"
-
-namespace jin
-{
- namespace audio
- {
-
- class Source;
-
- template<class SubAudio>
- class Audio : public Subsystem<SubAudio>
- {
- public:
- enum State
- {
- PLAY ,
- STOP ,
- PAUSE,
- };
-
- virtual void play() = 0;
- virtual void stop() = 0;
- virtual void pause() = 0;
- virtual void resume() = 0;
- virtual void setVolume(float volume) = 0;
-
- protected:
- Audio()
- : volume(1)
- , state(State::PLAY)
- {};
- virtual ~Audio() {};
- singleton(Audio);
-
- float volume;
- State state;
-
- };
-
- } // namespace audio
-} // namespace jin
-
-#endif // LIBJIN_MODULES_AUDIO
-#endif // __LIBJIN_AUDIO_H
diff --git a/src/libjin/audio/source.cpp b/src/libjin/audio/source.cpp
deleted file mode 100644
index 646e5ef..0000000
--- a/src/libjin/audio/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "../configuration.h"
-#if LIBJIN_MODULES_AUDIO
-
-#include <cstring>
-#include "source.h"
-
-namespace jin
-{
- namespace audio
- {
-
- static int check_header(const void *data, int size, const char *str, int offset) {
- int len = strlen(str);
- return (size >= offset + len) && !memcmp((char*)data + offset, str, len);
- }
-
- SourceType Source::getType(const void* mem, int size)
- {
- if(check_header(mem, size, "WAVE", 8))
- return SourceType::WAV;
- if(check_header(mem, size, "OggS", 0))
- return SourceType::OGG;
- return SourceType::INVALID;
- }
-
- } // namespace audio
-} // namespace jin
-
-#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/configuration.h b/src/libjin/core/je_configuration.h
index 55633a1..55633a1 100644
--- a/src/libjin/configuration.h
+++ b/src/libjin/core/je_configuration.h
diff --git a/src/libjin/core/je_types.h b/src/libjin/core/je_types.h
new file mode 100644
index 0000000..71ba640
--- /dev/null
+++ b/src/libjin/core/je_types.h
@@ -0,0 +1,24 @@
+#ifndef __LIBJIN_CORE_TYPES_H
+#define __LIBJIN_CORE_TYPES_H
+
+#include <stdint.h>
+
+namespace jin
+{
+ namespace core
+ {
+
+ typedef int8_t int8; ///< Signed integer with a size of 8 bits. Supports values from -128 to 127
+ typedef uint8_t uint8; ///< Unsigned integer with a size of 8 bits. Supports values from 0 to 255.
+ typedef uint8 byte; ///< Unsigned integer with 8 bits (1 byte). Supports 256 values from 0 to 255.
+ typedef int16_t int16; ///< Signed integer with a size of 16 bits. Supports values from -32768 to 32767
+ typedef uint16_t uint16; ///< Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
+ typedef int32_t int32; ///< Signed integer with a size of 32 bits. Supports values from -2147483648 to 2147483647.
+ typedef uint32_t uint32; ///< Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1).
+ typedef int64_t int64; ///< Signed integer with a size of 64 bits. Supports values from -(2^63) to (2^63 - 1).
+ typedef uint64_t uint64; ///< Unsigned integer with a size of 64 bits, Supports values from 0 to (2^64 - 1).
+
+ }
+}
+
+#endif // __LIBJIN_CORE_TYPES_H \ No newline at end of file
diff --git a/src/libjin/input/event.cpp b/src/libjin/input/event.cpp
deleted file mode 100644
index c8eb78c..0000000
--- a/src/libjin/input/event.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "event.h"
-#include "SDL2\SDL.h"
-
-namespace jin
-{
-
-} // namespace jin \ No newline at end of file
diff --git a/src/libjin/input/input.h b/src/libjin/input/input.h
deleted file mode 100644
index a828ac7..0000000
--- a/src/libjin/input/input.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __LIBJIN_INPUT_H
-#define __LIBJIN_INPUT_H
-
-#include "event.h"
-#include "keyboard.h"
-#include "mouse.h"
-#include "joypad.h"
-
-#endif \ No newline at end of file
diff --git a/src/libjin/input/joypad.cpp b/src/libjin/input/joypad.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/input/joypad.cpp
+++ /dev/null
diff --git a/src/libjin/input/joypad.h b/src/libjin/input/joypad.h
deleted file mode 100644
index 570699e..0000000
--- a/src/libjin/input/joypad.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __LIBJIN_JOYPAD_H
-#define __LIBJIN_JOYPAD_H
-
-#include <SDL2/SDL.h>
-
-namespace jin
-{
- namespace input
- {
-
- inline const char* getJoyButtonName(int button)
- {
- switch (button)
- {
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_A: return "A"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_B : return "B"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_X : return "X"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_Y: return "Y"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_BACK: return "Back"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_GUIDE: return "Guide"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_START: return "Start"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_LEFTSTICK: return "LeftStick"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_RIGHTSTICK: return "RightStick"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_LEFTSHOULDER: return "LeftShoulder"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: return "RightShoulder"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_DPAD_UP: return "DpadUp"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_DPAD_DOWN: return "DpadDown"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_DPAD_LEFT: return "DpadLeft"; break;
- case SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return "DpadRight"; break;
- default: return NULL;
- }
- }
-
- inline const char* getJoyAxisName(int axis)
- {
- switch (axis)
- {
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_LEFTX: return "LeftX"; break;
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_LEFTY: return "LeftY"; break;
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_RIGHTX: return "RightX"; break;
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_RIGHTY: return "RightY"; break;
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_TRIGGERLEFT: return "TriggerLeft"; break;
- case SDL_GameControllerAxis::SDL_CONTROLLER_AXIS_TRIGGERRIGHT: return "TriggerRight"; break;
- }
- }
-
- } // namespace input
-} // namespace jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/input/keyboard.cpp b/src/libjin/input/keyboard.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/input/keyboard.cpp
+++ /dev/null
diff --git a/src/libjin/input/keyboard.h b/src/libjin/input/keyboard.h
deleted file mode 100644
index 60f1169..0000000
--- a/src/libjin/input/keyboard.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __LIBJIN_KEYBOARD_H
-#define __LIBJIN_KEYBOARD_H
-
-namespace jin
-{
- namespace input
- {
-
- class Keyboard
- {
-
- };
-
- } // namespace input
-} // namespace jin
-
-#endif // __LIBJIN_KEYBOARD_H \ No newline at end of file
diff --git a/src/libjin/jin.h b/src/libjin/jin.h
index ed00271..0b6a416 100644
--- a/src/libjin/jin.h
+++ b/src/libjin/jin.h
@@ -1,21 +1,21 @@
#ifndef __LIBJIN_H
#define __LIBJIN_H
-#include "configuration.h"
+#include "core/je_configuration.h"
-#include "Utils/utils.h"
+#include "utils/je_utils.h"
#ifdef LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
-#include "Audio/SDL/SDLAudio.h"
+#include "audio/sdl/je_sdl_audio.h"
#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
-#include "Game/Game.h"
-#include "Filesystem/Filesystem.h"
-#include "Filesystem/Buffer.h"
-#include "Input/Input.h"
-#include "Net/Net.h"
-#include "Graphics/Graphics.h"
-#include "Time/Timer.h"
-#include "Thread/Thread.h"
-#include "Common/common.h"
+#include "game/je_game.h"
+#include "filesystem/je_filesystem.h"
+#include "filesystem/je_buffer.h"
+#include "input/je_input.h"
+#include "net/je_net.h"
+#include "graphics/je_graphics.h"
+#include "time/je_timer.h"
+#include "thread/je_thread.h"
+#include "common/je_common.h"
#define LIBJIN_VERSION "Jin 0.1";
#define LIBJIN_AUTHOR "Chai";
diff --git a/src/libjin/math/constant.h b/src/libjin/math/constant.h
deleted file mode 100644
index f8e0f5a..0000000
--- a/src/libjin/math/constant.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __LIBJIN_MATH_CONSTANT_H
-#define __LIBJIN_MATH_CONSTANT_H
-
-#define PI 3.1415926f
-
-// int16 Χ
-#define INT16_RANGE_LEFT -32768
-#define INT16_RANGE_RIGHT 32767
-
-#endif \ No newline at end of file
diff --git a/src/libjin/math/math.h b/src/libjin/math/math.h
deleted file mode 100644
index c1b5084..0000000
--- a/src/libjin/math/math.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __LIBJIN_UTILS_MATH_H
-#define __LIBJIN_UTILS_MATH_H
-
-#include "constant.h"
-#include "matrix.h"
-#include "quad.h"
-
-namespace jin
-{
- namespace math
- {
-
- #ifdef min
- # undef min
- #endif // min
- #ifdef max
- # undef max
- #endif // max
-
- template<typename T>
- inline T min(T a, T b)
- {
- return a < b ? a : b;
- }
-
- template<typename T>
- inline T max(T a, T b)
- {
- return a > b ? a : b;
- }
-
- template<typename T>
- inline T clamp(T a, T mi, T ma)
- {
- return min<T>(max<T>(a, mi), ma);
- }
-
- template<typename T>
- inline bool within(T a, T mi, T ma)
- {
- return a >= mi && a <= ma;
- }
-
- template<typename T>
- inline bool without(T a, T mi, T ma)
- {
- return a < mi || a > ma;
- }
-
- template<typename T>
- inline T abs(T a)
- {
- return a > 0 ? a : -a;
- }
-
- template<typename T>
- inline T lowerBound(T a, T lower)
- {
- return a < lower ? lower : a;
- }
-
- template<typename T>
- inline T upperBound(T a, T upper)
- {
- return a > upper ? upper : a;
- }
-
- template<typename T>
- inline T lerp(T a, T b, float t)
- {
- return a + t * (b - a);
- }
-
- } // namespace math
-} // namespace jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/math/matrix.cpp b/src/libjin/math/matrix.cpp
deleted file mode 100644
index 9f933f8..0000000
--- a/src/libjin/math/matrix.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-#include "Matrix.h"
-
-#include <cstring> // memcpy
-#include <cmath>
-
-namespace jin
-{
- namespace math
- {
-
- const Matrix Matrix::Identity;
-
- // | e0 e4 e8 e12 |
- // | e1 e5 e9 e13 |
- // | e2 e6 e10 e14 |
- // | e3 e7 e11 e15 |
-
- Matrix::Matrix()
- {
- setIdentity();
- }
-
- Matrix::~Matrix()
- {
- }
-
- void Matrix::setOrtho(float l, float r, float b, float t, float n, float f)
- {
- setIdentity();
- float w = r - l;
- float h = t - b;
- float z = f - n;
- e[0] = 2 / w;
- e[5] = 2 / h;
- e[10] = -2 / z;
- e[12] = -(r + l) / w;
- e[13] = -(t + b) / h;
- e[14] = -(f + n) / z;
- e[15] = 1;
- }
-
- // | e0 e4 e8 e12 |
- // | e1 e5 e9 e13 |
- // | e2 e6 e10 e14 |
- // | e3 e7 e11 e15 |
- // | e0 e4 e8 e12 |
- // | e1 e5 e9 e13 |
- // | e2 e6 e10 e14 |
- // | e3 e7 e11 e15 |
-
- Matrix Matrix::operator * (const Matrix & m) const
- {
- Matrix t;
-
- t.e[0] = (e[0] * m.e[0]) + (e[4] * m.e[1]) + (e[8] * m.e[2]) + (e[12] * m.e[3]);
- t.e[4] = (e[0] * m.e[4]) + (e[4] * m.e[5]) + (e[8] * m.e[6]) + (e[12] * m.e[7]);
- t.e[8] = (e[0] * m.e[8]) + (e[4] * m.e[9]) + (e[8] * m.e[10]) + (e[12] * m.e[11]);
- t.e[12] = (e[0] * m.e[12]) + (e[4] * m.e[13]) + (e[8] * m.e[14]) + (e[12] * m.e[15]);
-
- t.e[1] = (e[1] * m.e[0]) + (e[5] * m.e[1]) + (e[9] * m.e[2]) + (e[13] * m.e[3]);
- t.e[5] = (e[1] * m.e[4]) + (e[5] * m.e[5]) + (e[9] * m.e[6]) + (e[13] * m.e[7]);
- t.e[9] = (e[1] * m.e[8]) + (e[5] * m.e[9]) + (e[9] * m.e[10]) + (e[13] * m.e[11]);
- t.e[13] = (e[1] * m.e[12]) + (e[5] * m.e[13]) + (e[9] * m.e[14]) + (e[13] * m.e[15]);
-
- t.e[2] = (e[2] * m.e[0]) + (e[6] * m.e[1]) + (e[10] * m.e[2]) + (e[14] * m.e[3]);
- t.e[6] = (e[2] * m.e[4]) + (e[6] * m.e[5]) + (e[10] * m.e[6]) + (e[14] * m.e[7]);
- t.e[10] = (e[2] * m.e[8]) + (e[6] * m.e[9]) + (e[10] * m.e[10]) + (e[14] * m.e[11]);
- t.e[14] = (e[2] * m.e[12]) + (e[6] * m.e[13]) + (e[10] * m.e[14]) + (e[14] * m.e[15]);
-
- t.e[3] = (e[3] * m.e[0]) + (e[7] * m.e[1]) + (e[11] * m.e[2]) + (e[15] * m.e[3]);
- t.e[7] = (e[3] * m.e[4]) + (e[7] * m.e[5]) + (e[11] * m.e[6]) + (e[15] * m.e[7]);
- t.e[11] = (e[3] * m.e[8]) + (e[7] * m.e[9]) + (e[11] * m.e[10]) + (e[15] * m.e[11]);
- t.e[15] = (e[3] * m.e[12]) + (e[7] * m.e[13]) + (e[11] * m.e[14]) + (e[15] * m.e[15]);
-
- return t;
- }
-
- void Matrix::operator *= (const Matrix & m)
- {
- Matrix t = (*this) * m;
- memcpy((void*)this->e, (void*)t.e, sizeof(float) * 16);
- }
-
- const float * Matrix::getElements() const
- {
- return e;
- }
-
- void Matrix::setIdentity()
- {
- memset(e, 0, sizeof(float) * 16);
- e[0] = e[5] = e[10] = e[15] = 1;
- }
-
- void Matrix::setTranslation(float x, float y)
- {
- setIdentity();
- e[12] = x;
- e[13] = y;
- }
-
- void Matrix::setRotation(float rad)
- {
- setIdentity();
- float c = cos(rad), s = sin(rad);
- e[0] = c; e[4] = -s;
- e[1] = s; e[5] = c;
- }
-
- void Matrix::setScale(float sx, float sy)
- {
- setIdentity();
- e[0] = sx;
- e[5] = sy;
- }
-
- void Matrix::setShear(float kx, float ky)
- {
- setIdentity();
- e[1] = ky;
- e[4] = kx;
- }
-
- void Matrix::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy)
- {
- memset(e, 0, sizeof(float) * 16); // zero out matrix
- float c = cos(angle), s = sin(angle);
- // matrix multiplication carried out on paper:
- // |1 x| |c -s | |sx | |1 -ox|
- // | 1 y| |s c | | sy | | 1 -oy|
- // | 1 | | 1 | | 1 | | 1 |
- // | 1| | 1| | 1| | 1 |
- // move rotate scale origin
- e[10] = e[15] = 1.0f;
- e[0] = c * sx ; // = a
- e[1] = s * sx ; // = b
- e[4] = - s * sy; // = c
- e[5] = c * sy; // = d
- e[12] = x - ox * e[0] - oy * e[4];
- e[13] = y - ox * e[1] - oy * e[5];
- }
-
- void Matrix::translate(float x, float y)
- {
- Matrix t;
- t.setTranslation(x, y);
- this->operator *=(t);
- }
-
- void Matrix::rotate(float rad)
- {
- Matrix t;
- t.setRotation(rad);
- this->operator *=(t);
- }
-
- void Matrix::scale(float sx, float sy)
- {
- Matrix t;
- t.setScale(sx, sy);
- this->operator *=(t);
- }
-
- void Matrix::shear(float kx, float ky)
- {
- Matrix t;
- t.setShear(kx, ky);
- this->operator *=(t);
- }
-
- // | x |
- // | y |
- // | 0 |
- // | 1 |
- // | e0 e4 e8 e12 |
- // | e1 e5 e9 e13 |
- // | e2 e6 e10 e14 |
- // | e3 e7 e11 e15 |
-
- void Matrix::transform(vertex * dst, const vertex * src, int size) const
- {
- for (int i = 0; i<size; ++i)
- {
- // Store in temp variables in case src = dst
- float x = (e[0] * src[i].x) + (e[4] * src[i].y) + (0) + (e[12]);
- float y = (e[1] * src[i].x) + (e[5] * src[i].y) + (0) + (e[13]);
-
- dst[i].x = x;
- dst[i].y = y;
- }
- }
-
- } // namespace math
-} // namespace jin \ No newline at end of file
diff --git a/src/libjin/math/matrix.h b/src/libjin/math/matrix.h
deleted file mode 100644
index 1fe6ab1..0000000
--- a/src/libjin/math/matrix.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef __LIBJIN_MATRIX_H
-#define __LIBJIN_MATRIX_H
-
-namespace jin
-{
- namespace math
- {
-
- struct vertex
- {
- unsigned char r, g, b, a;
- float x, y;
- float s, t;
- };
- /**
- * This class is the basis for all transformations in LOVE. Althought not
- * really needed for 2D, it contains 4x4 elements to be compatible with
- * OpenGL without conversions.
- * Ҫתõľ
- * https://blog.csdn.net/candycat1992/article/details/8830894
- **/
- class Matrix
- {
- private:
-
- /**
- * | e0 e4 e8 e12 |
- * | e1 e5 e9 e13 |
- * | e2 e6 e10 e14 |
- * | e3 e7 e11 e15 |
- **/
- float e[16];
-
- public:
-
- static const Matrix Identity;
-
- /**
- * Creates a new identity matrix.
- **/
- Matrix();
-
- /**
- * Destructor.
- **/
- ~Matrix();
-
- void setOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far);
-
- /**
- * Multiplies this Matrix with another Matrix, changing neither.
- * @param m The Matrix to multiply with this Matrix.
- * @return The combined matrix.
- **/
- Matrix operator * (const Matrix & m) const;
-
- /**
- * Multiplies a Matrix into this Matrix.
- * @param m The Matrix to combine into this Matrix.
- **/
- void operator *= (const Matrix & m);
-
- /**
- * Gets a pointer to the 16 array elements.
- * @return The array elements.
- **/
- const float * getElements() const;
-
- /**
- * Resets this Matrix to the identity matrix.
- **/
- void setIdentity();
-
- /**
- * Resets this Matrix to a translation.
- * @param x Translation along x-axis.
- * @param y Translation along y-axis.
- **/
- void setTranslation(float x, float y);
-
- /**
- * Resets this Matrix to a rotation.
- * @param r The angle in radians.
- **/
- void setRotation(float r);
-
- /**
- * Resets this Matrix to a scale transformation.
- * @param sx Scale factor along the x-axis.
- * @param sy Scale factor along the y-axis.
- **/
- void setScale(float sx, float sy);
-
- /**
- * Resets this Matrix to a shear transformation.
- * @param kx Shear along x-axis.
- * @param ky Shear along y-axis.
- **/
- void setShear(float kx, float ky);
-
- /**
- * Creates a transformation with a certain position, orientation, scale
- * and offset. Perfect for Drawables -- what a coincidence!
- *
- * @param x The translation along the x-axis.
- * @param y The translation along the y-axis.
- * @param angle The rotation (rad) around the center with offset (ox,oy).
- * @param sx Scale along x-axis.
- * @param sy Scale along y-axis.
- * @param ox The offset for rotation along the x-axis.
- * @param oy The offset for rotation along the y-axis.
- * @param kx Shear along x-axis
- * @param ky Shear along y-axis
- **/
- void setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy);
-
- /**
- * Multiplies this Matrix with a translation.
- * @param x Translation along x-axis.
- * @param y Translation along y-axis.
- **/
- void translate(float x, float y);
-
- /**
- * Multiplies this Matrix with a rotation.
- * @param r Angle in radians.
- **/
- void rotate(float r);
-
- /**
- * Multiplies this Matrix with a scale transformation.
- * @param sx Scale factor along the x-axis.
- * @param sy Scale factor along the y-axis.
- **/
- void scale(float sx, float sy);
-
- /**
- * Multiplies this Matrix with a shear transformation.
- * @param kx Shear along the x-axis.
- * @param ky Shear along the y-axis.
- **/
- void shear(float kx, float ky);
-
- /**
- * Transforms an array of vertices by this Matrix. The sources and
- * destination arrays may be the same.
- *
- * @param dst Storage for the transformed vertices.
- * @param src The source vertices.
- * @param size The number of vertices.
- **/
- void transform(vertex * dst, const vertex * src, int size) const;
-
- };
-
- } // namespace math
-} // namespace jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/math/quad.h b/src/libjin/math/quad.h
deleted file mode 100644
index 6eb4f45..0000000
--- a/src/libjin/math/quad.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __LIBJIN_QUAD_H
-#define __LIBJIN_QUAD_H
-
-namespace jin
-{
- namespace math
- {
-
- struct Quad
- {
- float x, y, w, h;
- };
-
- } // namespace math
-} // namespace jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/net/net.h b/src/libjin/net/net.h
deleted file mode 100644
index 3324d11..0000000
--- a/src/libjin/net/net.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __LIBJIN_NET_H
-#define __LIBJIN_NET_H
-#include "../configuration.h"
-#if LIBJIN_MODULES_NET
-
-#include "../Common/Subsystem.hpp"
-#include "Socket.h"
-
-namespace jin
-{
- namespace net
- {
-
- class Net : public Subsystem<Net>
- {
- public:
-
- protected:
- singleton(Net);
- Net() {};
- ~Net() {};
- bool initSystem(const SettingBase* setting) override;
- void quitSystem() override;
-
- };
-
- } // namespace net
-} // namespace jin
-
-#endif // LIBJIN_MODULES_NET
-#endif // __LIBJIN_NET_H
diff --git a/src/libjin/thread/thread.cpp b/src/libjin/thread/thread.cpp
deleted file mode 100644
index 3f2a50d..0000000
--- a/src/libjin/thread/thread.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "../configuration.h"
-#if LIBJIN_MODULES_THREAD
-
-#include "Thread.h"
-
-namespace jin
-{
- namespace thread
- {
-
- class Mutex
- {
- public:
- Mutex();
- ~Mutex();
-
- void lock();
- void unlock();
- private:
- #if LIBJIN_THREAD_SDL
- SDL_mutex* mutex;
- #endif
- friend class Conditional;
- };
-
- // ̼߳signal wait
- class Conditional
- {
- public:
- Conditional();
- ~Conditional();
- void signal();
- void broadcast();
- bool wait(Mutex* mutex, int timeout = -1);
- private:
- #if LIBJIN_THREAD_SDL
- SDL_cond* cond;
- #endif
- };
-
- class Lock
- {
- public:
- Lock(Mutex* m) : mutex(m) {
- mutex->lock();
- }
-
- Lock(Mutex& m) : mutex(&m) {
- mutex->lock();
- }
-
- ~Lock() {
- mutex->unlock();
- }
- private:
- Mutex* mutex;
-
- Lock(Lock&) {}
-
- };
-
- //////////////////////////////////////////////////////////////////////
-
- Mutex::Mutex()
- {
- #if LIBJIN_THREAD_SDL
- mutex = SDL_CreateMutex();
- #endif
- }
-
- Mutex::~Mutex()
- {
- #if LIBJIN_THREAD_SDL
- SDL_DestroyMutex(mutex);
- #endif
- }
-
- void Mutex::lock()
- {
- #if LIBJIN_THREAD_SDL
- SDL_LockMutex(mutex);
- #endif
- }
-
- void Mutex::unlock()
- {
- #if LIBJIN_THREAD_SDL
- SDL_UnlockMutex(mutex);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Conditional::Conditional()
- {
- #if LIBJIN_THREAD_SDL
- cond = SDL_CreateCond();
- #endif
- }
-
- Conditional::~Conditional()
- {
- #if LIBJIN_THREAD_SDL
- SDL_DestroyCond(cond);
- #endif
- }
-
- void Conditional::signal()
- {
- #if LIBJIN_THREAD_SDL
- SDL_CondSignal(cond);
- #endif
- }
-
- void Conditional::broadcast()
- {
- #if LIBJIN_THREAD_SDL
- SDL_CondBroadcast(cond);
- #endif
- }
-
- bool Conditional::wait(Mutex* mutex, int timeout)
- {
- #if LIBJIN_THREAD_SDL
- if (timeout < 0)
- return !SDL_CondWait(cond, mutex->mutex);
- else
- return (SDL_CondWaitTimeout(cond, mutex->mutex, timeout) == 0);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::ThreadData::ThreadData(Mutex* m, Conditional* c)
- : mutex(m)
- , condition(c)
- , share()
- {
- }
-
- Thread::ThreadData::~ThreadData()
- {
- }
-
- void Thread::ThreadData::set(int slot, Variant value)
- {
- Lock l(mutex);
- share[slot] = value;
- }
-
- Thread::Variant Thread::ThreadData::get(int slot)
- {
- Lock l(mutex);
- return share[slot];
- }
-
- bool Thread::ThreadData::exist(int slot)
- {
- Lock l(mutex);
- return share.count(slot) == 1;
- }
-
- void Thread::ThreadData::remove(int slot)
- {
- Lock l(mutex);
- if (exist(slot))
- {
- share.erase(slot);
- }
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::Thread(const std::string tname, ThreadRunner runner)
- : name(tname)
- , running(false)
- , threadRunner(runner)
- {
- mutex = new Mutex();
- condition = new Conditional();
- common = new Thread::ThreadData(mutex, condition);
- }
-
- Thread::~Thread()
- {
- #if LIBJIN_THREAD_SDL
- #endif
- }
-
- const char* Thread::getName()
- {
- Lock l(mutex);
- return name.c_str();
- };
-
- bool Thread::isRunning()
- {
- Lock l(mutex);
- return running;
- };
-
- bool Thread::start(void* p)
- {
- Lock l(mutex);
- if (running)
- return false;
- if (handle)
- {
- #if LIBJIN_THREAD_SDL
- SDL_WaitThread(handle, nullptr);
- #endif
- }
- #if LIBJIN_THREAD_SDL
- handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif LIBJIN_THREAD_CPP
- handle = new std::thread();
- #endif
- return (running = (handle != nullptr));
- }
-
- void Thread::wait()
- {
- {
- Lock l(mutex);
- if (!handle)
- return;
- }
- #if LIBJIN_THREAD_SDL
- SDL_WaitThread(handle, nullptr);
- #endif
- Lock l(mutex);
- running = false;
- handle = nullptr;
- }
-
- void Thread::lock()
- {
- if (mutex != nullptr)
- mutex->lock();
- }
-
- void Thread::unlock()
- {
- if (mutex != nullptr)
- mutex->unlock();
- }
-
- void Thread::send(int slot, const Variant& value)
- {
- lock();
- common->set(slot, value);
- unlock();
- condition->broadcast();
- }
-
- bool Thread::receive(int slot)
- {
- return common->exist(slot);
- }
-
- Thread::Variant Thread::fetch(int slot)
- {
- Thread::Variant v = common->get(slot);
- return v;
- }
-
- Thread::Variant Thread::demand(int slot)
- {
- /**
- * pthread_mutex_lock(mtx);
- * while(pass == 0)
- * {
- * pthread_mutex_unlock(mtx);
- * pthread_cond_just_wait(cv);
- * pthread_mutex_lock(mtx);
- * }
- * pthread_mutex_unlock(mtx);
- */
- lock();
- while (!common->exist(slot))
- {
- if (common->exist(ThreadData::SLOT_ERROR))
- return 0;
- condition->wait(mutex);
- }
- Thread::Variant v = common->get(slot);
- unlock();
- return v;
- }
-
- void Thread::remove(int slot)
- {
- lock();
- common->remove(slot);
- unlock();
- }
-
- } // namespace thread
-} // namespace jin
-
-#endif // LIBJIN_MODULES_THREAD \ No newline at end of file
diff --git a/src/libjin/utils/endian.h b/src/libjin/utils/endian.h
deleted file mode 100644
index 01def88..0000000
--- a/src/libjin/utils/endian.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef LIBJIN_LIL_ENDIAN && LIBJIN_BIG_ENDIAN
-
-#define LIBJIN_LIL_ENDIAN 2
-#define LIBJIN_BIG_ENDIAN 4
-
-#endif
-
-#ifndef LIBJIN_BYTEORDER
-#ifdef __linux__
-#include <endian.h>
-#define LIBJIN_BYTEORDER __BYTE_ORDER
-#else /* __linux__ */
-#if defined(__hppa__) || \
- defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
- (defined(__MIPS__) && defined(__MISPEB__)) || \
- defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
- defined(__sparc__)
-#define LIBJIN_BYTEORDER LIBJIN_BIG_ENDIAN
-#else
-#define LIBJIN_BYTEORDER LIBJIN_LIL_ENDIAN
-#endif
-#endif /* __linux__ */
-#endif /* !SDL_BYTEORDER */ \ No newline at end of file
diff --git a/src/libjin/utils/log.cpp b/src/libjin/utils/log.cpp
deleted file mode 100644
index 5299942..0000000
--- a/src/libjin/utils/log.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#define LOGHELPER_IMPLEMENT
-#include "log.h" \ No newline at end of file
diff --git a/src/libjin/utils/macros.h b/src/libjin/utils/macros.h
deleted file mode 100644
index e19193c..0000000
--- a/src/libjin/utils/macros.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __LIBJIN_MACROS_H
-#define __LIBJIN_MACROS_H
-#include <cstring>
-
-//#define implement // ʵֽӿ
-//
-//#define shared // ķ
-//
-//#define MASK // enum
-//
-//#define onlyonce // ֻһ
-//#define CALLONCE(call) static char __dummy__=(call, 1) // ֻһ
-//#define SAFECALL(func, params) if(func) func(params)
-//
-//#define zero(mem) memset(&mem, 0, sizeof(mem))
-
-#endif \ No newline at end of file
diff --git a/src/libjin/utils/utils.h b/src/libjin/utils/utils.h
deleted file mode 100644
index 1654a8f..0000000
--- a/src/libjin/utils/utils.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __LIBJIN_UTILS_H
-#define __LIBJIN_UTILS_H
-
-#include "macros.h"
-#include "endian.h"
-
-#define UNITTEST 0
-
-#endif \ No newline at end of file