aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libjin/Audio/Audio.cpp4
-rw-r--r--src/libjin/Audio/Audio.h10
-rw-r--r--src/libjin/Audio/SDL/SDLAudio.cpp6
-rw-r--r--src/libjin/Audio/SDL/SDLAudio.h10
-rw-r--r--src/libjin/Audio/SDL/SDLSource.cpp4
-rw-r--r--src/libjin/Audio/SDL/SDLSource.h10
-rw-r--r--src/libjin/Audio/Source.cpp4
-rw-r--r--src/libjin/Audio/Source.h10
-rw-r--r--src/libjin/Common/Object.h4
-rw-r--r--src/libjin/Common/Singleton.hpp6
-rw-r--r--src/libjin/Common/StringMap.hpp4
-rw-r--r--src/libjin/Common/Subsystem.hpp4
-rw-r--r--src/libjin/Common/utf8.cpp4
-rw-r--r--src/libjin/Common/utf8.h10
-rw-r--r--src/libjin/Core/Core.h4
-rw-r--r--src/libjin/Core/Game.h6
-rw-r--r--src/libjin/Filesystem/Buffer.h4
-rw-r--r--src/libjin/Graphics/Bitmap.h6
-rw-r--r--src/libjin/Graphics/Canvas.cpp4
-rw-r--r--src/libjin/Graphics/Canvas.h10
-rw-r--r--src/libjin/Graphics/Color.h12
-rw-r--r--src/libjin/Graphics/Drawable.cpp4
-rw-r--r--src/libjin/Graphics/Drawable.h10
-rw-r--r--src/libjin/Graphics/Font.cpp4
-rw-r--r--src/libjin/Graphics/Font.h10
-rw-r--r--src/libjin/Graphics/Graphics.h10
-rw-r--r--src/libjin/Graphics/Shader.cpp27
-rw-r--r--src/libjin/Graphics/Shader.h10
-rw-r--r--src/libjin/Graphics/Shapes.cpp4
-rw-r--r--src/libjin/Graphics/Shapes.h10
-rw-r--r--src/libjin/Graphics/Texture.cpp4
-rw-r--r--src/libjin/Graphics/Texture.h10
-rw-r--r--src/libjin/Graphics/Window.cpp6
-rw-r--r--src/libjin/Graphics/Window.h10
-rw-r--r--src/libjin/Input/Event.h12
-rw-r--r--src/libjin/Input/Input.h4
-rw-r--r--src/libjin/Input/Joypad.h4
-rw-r--r--src/libjin/Input/Keyboard.h6
-rw-r--r--src/libjin/Input/Mouse.cpp8
-rw-r--r--src/libjin/Input/Mouse.h10
-rw-r--r--src/libjin/Math/Math.h4
-rw-r--r--src/libjin/Math/Matrix.h4
-rw-r--r--src/libjin/Math/Quad.h4
-rw-r--r--src/libjin/Math/Vector2.hpp4
-rw-r--r--src/libjin/Math/Vector3.hpp4
-rw-r--r--src/libjin/Math/Vector4.hpp4
-rw-r--r--src/libjin/Math/constant.h4
-rw-r--r--src/libjin/Net/Net.cpp2
-rw-r--r--src/libjin/Net/Net.h10
-rw-r--r--src/libjin/Net/Socket.cpp22
-rw-r--r--src/libjin/Net/Socket.h12
-rw-r--r--src/libjin/Net/net.cpp2
-rw-r--r--src/libjin/Net/net.h10
-rw-r--r--src/libjin/Thread/Thread.cpp36
-rw-r--r--src/libjin/Thread/Thread.h18
-rw-r--r--src/libjin/Thread/thread.cpp36
-rw-r--r--src/libjin/Thread/thread.h18
-rw-r--r--src/libjin/Time/Timer.cpp4
-rw-r--r--src/libjin/Time/Timer.h16
-rw-r--r--src/libjin/Utils/endian.h14
-rw-r--r--src/libjin/Utils/macros.h4
-rw-r--r--src/libjin/Utils/utils.h4
-rw-r--r--src/libjin/audio/audio.cpp4
-rw-r--r--src/libjin/audio/audio.h10
-rw-r--r--src/libjin/audio/source.cpp4
-rw-r--r--src/libjin/audio/source.h10
-rw-r--r--src/libjin/core/core.h4
-rw-r--r--src/libjin/core/game.h6
-rw-r--r--src/libjin/input/event.h12
-rw-r--r--src/libjin/input/input.h4
-rw-r--r--src/libjin/input/joypad.h4
-rw-r--r--src/libjin/input/keyboard.h6
-rw-r--r--src/libjin/input/mouse.cpp8
-rw-r--r--src/libjin/input/mouse.h10
-rw-r--r--src/libjin/jin.h18
-rw-r--r--src/libjin/math/constant.h4
-rw-r--r--src/libjin/math/math.h4
-rw-r--r--src/libjin/math/matrix.h4
-rw-r--r--src/libjin/math/quad.h4
-rw-r--r--src/libjin/modules.h70
-rw-r--r--src/libjin/net/net.cpp2
-rw-r--r--src/libjin/net/net.h10
-rw-r--r--src/libjin/thread/thread.cpp36
-rw-r--r--src/libjin/thread/thread.h18
-rw-r--r--src/libjin/utils/endian.h14
-rw-r--r--src/libjin/utils/macros.h4
-rw-r--r--src/libjin/utils/utils.h4
-rw-r--r--src/lua/common/common.h1
-rw-r--r--src/lua/common/error.h28
-rw-r--r--src/lua/libraries/luax/luax.h1
-rw-r--r--src/lua/modules/audio/audio.cpp22
-rw-r--r--src/lua/modules/core/core.cpp8
-rw-r--r--src/lua/modules/graphics/graphics.cpp38
-rw-r--r--src/lua/modules/luax.h7
-rw-r--r--src/luax.h7
-rw-r--r--src/main.cpp2
96 files changed, 503 insertions, 420 deletions
diff --git a/src/libjin/Audio/Audio.cpp b/src/libjin/Audio/Audio.cpp
index 1ccafcd..c9a3e40 100644
--- a/src/libjin/Audio/Audio.cpp
+++ b/src/libjin/Audio/Audio.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
#include "audio.h"
@@ -12,4 +12,4 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/Audio/Audio.h b/src/libjin/Audio/Audio.h
index 674020e..9faf0bc 100644
--- a/src/libjin/Audio/Audio.h
+++ b/src/libjin/Audio/Audio.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_AUDIO_H
-#define __JIN_AUDIO_H
+#ifndef __LIBJIN_AUDIO_H
+#define __LIBJIN_AUDIO_H
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
@@ -48,5 +48,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO
-#endif // __JIN_AUDIO_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
+#endif // __LIBJIN_AUDIO_H
diff --git a/src/libjin/Audio/SDL/SDLAudio.cpp b/src/libjin/Audio/SDL/SDLAudio.cpp
index 46a80de..d457dca 100644
--- a/src/libjin/Audio/SDL/SDLAudio.cpp
+++ b/src/libjin/Audio/SDL/SDLAudio.cpp
@@ -1,5 +1,5 @@
#include "../../modules.h"
-#if JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <iostream>
#include "SDLAudio.h"
@@ -29,7 +29,7 @@ namespace audio
/*call only once*/ bool SDLAudio::initSystem(const SettingBase* s)
{
-#if JIN_DEBUG
+#if LIBJIN_DEBUG
Loghelper::log(Loglevel::LV_INFO, "Init Audio System");
#endif
@@ -138,4 +138,4 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
diff --git a/src/libjin/Audio/SDL/SDLAudio.h b/src/libjin/Audio/SDL/SDLAudio.h
index b43dcfe..97ed664 100644
--- a/src/libjin/Audio/SDL/SDLAudio.h
+++ b/src/libjin/Audio/SDL/SDLAudio.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_AUDIO_SDL_H
-#define __JIN_AUDIO_SDL_H
+#ifndef __LIBJIN_AUDIO_SDL_H
+#define __LIBJIN_AUDIO_SDL_H
#include "../../modules.h"
-#if JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include "SDLSource.h"
#include <vector>
@@ -56,5 +56,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
-#endif // __JIN_AUDIO_SDL_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
+#endif // __LIBJIN_AUDIO_SDL_H
diff --git a/src/libjin/Audio/SDL/SDLSource.cpp b/src/libjin/Audio/SDL/SDLSource.cpp
index 13f9c18..00193a4 100644
--- a/src/libjin/Audio/SDL/SDLSource.cpp
+++ b/src/libjin/Audio/SDL/SDLSource.cpp
@@ -1,5 +1,5 @@
#include "../../modules.h"
-#if JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <exception>
#include <fstream>
@@ -396,4 +396,4 @@ Manager::get()->pushCommand(cmd); \
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
diff --git a/src/libjin/Audio/SDL/SDLSource.h b/src/libjin/Audio/SDL/SDLSource.h
index a99f65e..7e407ee 100644
--- a/src/libjin/Audio/SDL/SDLSource.h
+++ b/src/libjin/Audio/SDL/SDLSource.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_SOURCE_SDL_H
-#define __JIN_SOURCE_SDL_H
+#ifndef __LIBJIN_SOURCE_SDL_H
+#define __LIBJIN_SOURCE_SDL_H
#include "../../modules.h"
-#if JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#if LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include <vector>
#include <queue>
@@ -103,5 +103,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
-#endif // __JIN_SOURCE_SDL_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
+#endif // __LIBJIN_SOURCE_SDL_H
diff --git a/src/libjin/Audio/Source.cpp b/src/libjin/Audio/Source.cpp
index ae3c19b..7ac4e60 100644
--- a/src/libjin/Audio/Source.cpp
+++ b/src/libjin/Audio/Source.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include <cstring>
#include "source.h"
@@ -26,4 +26,4 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/Audio/Source.h b/src/libjin/Audio/Source.h
index b8cfb83..b227db2 100644
--- a/src/libjin/Audio/Source.h
+++ b/src/libjin/Audio/Source.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_AUDIO_SOURCE_H
-#define __JIN_AUDIO_SOURCE_H
+#ifndef __LIBJIN_AUDIO_SOURCE_H
+#define __LIBJIN_AUDIO_SOURCE_H
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
@@ -43,5 +43,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO
-#endif // __JIN_AUDIO_SOURCE_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
+#endif // __LIBJIN_AUDIO_SOURCE_H
diff --git a/src/libjin/Common/Object.h b/src/libjin/Common/Object.h
index 6c9d093..f7f3b43 100644
--- a/src/libjin/Common/Object.h
+++ b/src/libjin/Common/Object.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_COMMON_OBJECT_H
-#define __JIN_COMMON_OBJECT_H
+#ifndef __LIBJIN_COMMON_OBJECT_H
+#define __LIBJIN_COMMON_OBJECT_H
namespace jin
{
diff --git a/src/libjin/Common/Singleton.hpp b/src/libjin/Common/Singleton.hpp
index b817901..600813a 100644
--- a/src/libjin/Common/Singleton.hpp
+++ b/src/libjin/Common/Singleton.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_SINGLETON_H
-#define __JIN_SINGLETON_H
+#ifndef __LIBJIN_SINGLETON_H
+#define __LIBJIN_SINGLETON_H
namespace jin
{
@@ -34,4 +34,4 @@ namespace jin
} // jin
-#endif // __JIN_SINGLETON_H \ No newline at end of file
+#endif // __LIBJIN_SINGLETON_H \ No newline at end of file
diff --git a/src/libjin/Common/StringMap.hpp b/src/libjin/Common/StringMap.hpp
index d301a0c..9e4b0f5 100644
--- a/src/libjin/Common/StringMap.hpp
+++ b/src/libjin/Common/StringMap.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_COMMON_SREINGMAP_H
-#define __JIN_COMMON_SREINGMAP_H
+#ifndef __LIBJIN_COMMON_SREINGMAP_H
+#define __LIBJIN_COMMON_SREINGMAP_H
namespace jin
{
diff --git a/src/libjin/Common/Subsystem.hpp b/src/libjin/Common/Subsystem.hpp
index 59013c6..70dd4ba 100644
--- a/src/libjin/Common/Subsystem.hpp
+++ b/src/libjin/Common/Subsystem.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_COMMON_SUBSYSTEM_H
-#define __JIN_COMMON_SUBSYSTEM_H
+#ifndef __LIBJIN_COMMON_SUBSYSTEM_H
+#define __LIBJIN_COMMON_SUBSYSTEM_H
#include "singleton.hpp"
#include "../utils/macros.h"
diff --git a/src/libjin/Common/utf8.cpp b/src/libjin/Common/utf8.cpp
index bef6c85..8c05da8 100644
--- a/src/libjin/Common/utf8.cpp
+++ b/src/libjin/Common/utf8.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_OS == JIN_WINDOWS
+#if LIBJIN_OS == LIBJIN_WINDOWS
#include "utf8.h"
@@ -39,4 +39,4 @@ namespace jin
} // jin
-#endif // JIN_OS == JIN_WINDOWS \ No newline at end of file
+#endif // LIBJIN_OS == LIBJIN_WINDOWS
diff --git a/src/libjin/Common/utf8.h b/src/libjin/Common/utf8.h
index f023e91..5985684 100644
--- a/src/libjin/Common/utf8.h
+++ b/src/libjin/Common/utf8.h
@@ -1,8 +1,8 @@
-#ifndef __JIN_COMMON_UTF8_H
-#define __JIN_COMMON_UTF8_H
+#ifndef __LIBJIN_COMMON_UTF8_H
+#define __LIBJIN_COMMON_UTF8_H
#include "../modules.h"
-#if JIN_OS == JIN_WINDOWS
+#if LIBJIN_OS == LIBJIN_WINDOWS
#include <string>
#include <windows.h>
@@ -27,5 +27,5 @@ namespace jin
} // jin
-#endif // JIN_OS == JIN_WINDOWS
-#endif // __JIN_COMMON_UTF8_H \ No newline at end of file
+#endif // LIBJIN_OS == LIBJIN_WINDOWS
+#endif // __LIBJIN_COMMON_UTF8_H
diff --git a/src/libjin/Core/Core.h b/src/libjin/Core/Core.h
index dd902b4..4b4df8f 100644
--- a/src/libjin/Core/Core.h
+++ b/src/libjin/Core/Core.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_CORE_H
-#define __JIN_CORE_H
+#ifndef __LIBJIN_CORE_H
+#define __LIBJIN_CORE_H
#include "game.h"
diff --git a/src/libjin/Core/Game.h b/src/libjin/Core/Game.h
index 31f32d8..725c62c 100644
--- a/src/libjin/Core/Game.h
+++ b/src/libjin/Core/Game.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_CORE_GAME_H
-#define __JIN_CORE_GAME_H
+#ifndef __LIBJIN_CORE_GAME_H
+#define __LIBJIN_CORE_GAME_H
#include "SDL2/SDL.h"
@@ -55,4 +55,4 @@ namespace core
} // core
} // jin
-#endif // __JIN_CORE_GAME_H \ No newline at end of file
+#endif // __LIBJIN_CORE_GAME_H
diff --git a/src/libjin/Filesystem/Buffer.h b/src/libjin/Filesystem/Buffer.h
index ad16c12..3cd92cd 100644
--- a/src/libjin/Filesystem/Buffer.h
+++ b/src/libjin/Filesystem/Buffer.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_BUFFER_H
-#define __JIN_BUFFER_H
+#ifndef __LIBJIN_BUFFER_H
+#define __LIBJIN_BUFFER_H
#include <string.h>
diff --git a/src/libjin/Graphics/Bitmap.h b/src/libjin/Graphics/Bitmap.h
index 6333215..53b374b 100644
--- a/src/libjin/Graphics/Bitmap.h
+++ b/src/libjin/Graphics/Bitmap.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_BITMAP_H
-#define __JIN_BITMAP_H
+#ifndef __LIBJIN_BITMAP_H
+#define __LIBJIN_BITMAP_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../Math/Vector2.hpp"
#include "../3rdparty/GLee/GLee.h"
diff --git a/src/libjin/Graphics/Canvas.cpp b/src/libjin/Graphics/Canvas.cpp
index 953278d..1d1a347 100644
--- a/src/libjin/Graphics/Canvas.cpp
+++ b/src/libjin/Graphics/Canvas.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../utils/macros.h"
#include "canvas.h"
@@ -118,4 +118,4 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
diff --git a/src/libjin/Graphics/Canvas.h b/src/libjin/Graphics/Canvas.h
index 508562d..ec94d28 100644
--- a/src/libjin/Graphics/Canvas.h
+++ b/src/libjin/Graphics/Canvas.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_CANVAS_H
-#define __JIN_CANVAS_H
+#ifndef __LIBJIN_CANVAS_H
+#define __LIBJIN_CANVAS_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "drawable.h"
namespace jin
@@ -30,5 +30,5 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_CANVAS_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_CANVAS_H
diff --git a/src/libjin/Graphics/Color.h b/src/libjin/Graphics/Color.h
index 786abde..e27c360 100644
--- a/src/libjin/Graphics/Color.h
+++ b/src/libjin/Graphics/Color.h
@@ -1,10 +1,10 @@
/**
* Some color operating here.
*/
-#ifndef __JIN_COLOR_H
-#define __JIN_COLOR_H
+#ifndef __LIBJIN_COLOR_H
+#define __LIBJIN_COLOR_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../utils/endian.h"
@@ -44,7 +44,7 @@ namespace graphics
return !(r == c.r && g == c.g && b == c.b && a == c.a);
}
- #if JIN_BYTEORDER == JIN_BIG_ENDIAN
+ #if LIBJIN_BYTEORDER == LIBJIN_BIG_ENDIAN
unsigned char r, g, b, a;
#else
unsigned char a, b, g, r;
@@ -55,5 +55,5 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_COLOR_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_COLOR_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Drawable.cpp b/src/libjin/Graphics/Drawable.cpp
index 53b4f85..fec0575 100644
--- a/src/libjin/Graphics/Drawable.cpp
+++ b/src/libjin/Graphics/Drawable.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "drawable.h"
#include "../math/matrix.h"
@@ -64,4 +64,4 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
diff --git a/src/libjin/Graphics/Drawable.h b/src/libjin/Graphics/Drawable.h
index 8bc528e..bd5dfc5 100644
--- a/src/libjin/Graphics/Drawable.h
+++ b/src/libjin/Graphics/Drawable.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_DRAWABLE
-#define __JIN_DRAWABLE
+#ifndef __LIBJIN_DRAWABLE
+#define __LIBJIN_DRAWABLE
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../math/Vector2.hpp"
#include "../3rdparty/GLee/GLee.h"
@@ -38,5 +38,5 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_DRAWABLE \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_DRAWABLE \ No newline at end of file
diff --git a/src/libjin/Graphics/Font.cpp b/src/libjin/Graphics/Font.cpp
index 6be08e7..3bdc5ca 100644
--- a/src/libjin/Graphics/Font.cpp
+++ b/src/libjin/Graphics/Font.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "font.h"
#include <stdio.h>
@@ -181,4 +181,4 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Font.h b/src/libjin/Graphics/Font.h
index d805d1c..5435581 100644
--- a/src/libjin/Graphics/Font.h
+++ b/src/libjin/Graphics/Font.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_FONT_H
-#define __JIN_FONT_H
+#ifndef __LIBJIN_FONT_H
+#define __LIBJIN_FONT_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "drawable.h"
#include "../3rdparty/stb/stb_truetype.h"
@@ -38,5 +38,5 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_FONT_H \ No newline at end of file
+#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
index 9c4ed35..dfd6048 100644
--- a/src/libjin/Graphics/Graphics.h
+++ b/src/libjin/Graphics/Graphics.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_GRAPHICS_H
-#define __JIN_GRAPHICS_H
+#ifndef __LIBJIN_GRAPHICS_H
+#define __LIBJIN_GRAPHICS_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "canvas.h"
#include "color.h"
@@ -12,5 +12,5 @@
#include "window.h"
#include "Bitmap.h"
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_GRAPHICS_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_GRAPHICS_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader.cpp b/src/libjin/Graphics/Shader.cpp
index f078648..ae64c7e 100644
--- a/src/libjin/Graphics/Shader.cpp
+++ b/src/libjin/Graphics/Shader.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../utils/macros.h"
#include "Shader.h"
@@ -39,21 +39,38 @@ namespace graphics
JSLProgram* JSLProgram::createJSLProgram(const char* program)
{
- return new JSLProgram(program);
+ JSLProgram* jsl = nullptr;
+ try
+ {
+ jsl = new JSLProgram(program);
+ }
+ catch(...)
+ {
+ return nullptr;
+ }
+ return jsl;
}
JSLProgram::JSLProgram(const char* program)
: currentTextureUnit(DEFAULT_TEXTURE_UNIT)
{
- char* fs = (char*)calloc(1, strlen(program) + SHADER_FORMAT_SIZE);
+ int size = strlen(program) + SHADER_FORMAT_SIZE;
+ char* fs = (char*)alloca(size);
+ memset(fs, 0, size);
formatShader(fs, program);
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(shader, 1, (const GLchar**)&fs, NULL);
glCompileShader(shader);
+ GLint success;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
+ if (success == GL_FALSE)
+ throw 0;
pid = glCreateProgram();
glAttachShader(pid, shader);
glLinkProgram(pid);
- free(fs);
+ glGetProgramiv(pid, GL_LINK_STATUS, &success);
+ if (success == GL_FALSE)
+ throw 0;
}
JSLProgram::~JSLProgram()
@@ -197,4 +214,4 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader.h b/src/libjin/Graphics/Shader.h
index 2e6ae16..db6126f 100644
--- a/src/libjin/Graphics/Shader.h
+++ b/src/libjin/Graphics/Shader.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_JSL_H
-#define __JIN_JSL_H
+#ifndef __LIBJIN_JSL_H
+#define __LIBJIN_JSL_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include <string>
#include <map>
@@ -49,5 +49,5 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_JSL_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_JSL_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shapes.cpp b/src/libjin/Graphics/Shapes.cpp
index b2ef3f8..4601375 100644
--- a/src/libjin/Graphics/Shapes.cpp
+++ b/src/libjin/Graphics/Shapes.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "Shapes.h"
#include "../math/matrix.h"
@@ -119,4 +119,4 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Shapes.h b/src/libjin/Graphics/Shapes.h
index 204339f..dc9f272 100644
--- a/src/libjin/Graphics/Shapes.h
+++ b/src/libjin/Graphics/Shapes.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_GEOMETRY_H
-#define __JIN_GEOMETRY_H
+#ifndef __LIBJIN_GEOMETRY_H
+#define __LIBJIN_GEOMETRY_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "color.h"
#include "canvas.h"
@@ -33,5 +33,5 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_GEOMETRY_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_GEOMETRY_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Texture.cpp b/src/libjin/Graphics/Texture.cpp
index 2095af4..9958935 100644
--- a/src/libjin/Graphics/Texture.cpp
+++ b/src/libjin/Graphics/Texture.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include <fstream>
#include "texture.h"
@@ -53,4 +53,4 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Texture.h b/src/libjin/Graphics/Texture.h
index 2586d63..f2e45f0 100644
--- a/src/libjin/Graphics/Texture.h
+++ b/src/libjin/Graphics/Texture.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_IMAGE_H
-#define __JIN_IMAGE_H
+#ifndef __LIBJIN_IMAGE_H
+#define __LIBJIN_IMAGE_H
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "../3rdparty/GLee/GLee.h"
#include "Color.h"
@@ -27,5 +27,5 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_IMAGE_H \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_IMAGE_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/Window.cpp
index 3eb76ad..e5f32ba 100644
--- a/src/libjin/Graphics/Window.cpp
+++ b/src/libjin/Graphics/Window.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include <iostream>
#include "window.h"
@@ -16,7 +16,7 @@ namespace graphics
bool Window::initSystem(const SettingBase* s)
{
-#if JIN_DEBUG
+#if LIBJIN_DEBUG
Loghelper::log(Loglevel::LV_INFO, "Init window system");
#endif
@@ -99,4 +99,4 @@ namespace graphics
} // graphics
} // jin
-#endif // JIN_MODULES_RENDER \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Window.h b/src/libjin/Graphics/Window.h
index 2ecd7e4..0d18365 100644
--- a/src/libjin/Graphics/Window.h
+++ b/src/libjin/Graphics/Window.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_RENDER_WINDOW
-#define __JIN_RENDER_WINDOW
+#ifndef __LIBJIN_RENDER_WINDOW
+#define __LIBJIN_RENDER_WINDOW
#include "../modules.h"
-#if JIN_MODULES_RENDER
+#if LIBJIN_MODULES_RENDER
#include "SDL2/SDL.h"
#include "../utils/utils.h"
@@ -49,5 +49,5 @@ namespace graphics
} // render
} // jin
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_RENDER_WINDOW \ No newline at end of file
+#endif // LIBJIN_MODULES_RENDER
+#endif // __LIBJIN_RENDER_WINDOW \ No newline at end of file
diff --git a/src/libjin/Input/Event.h b/src/libjin/Input/Event.h
index 9feb3a5..713b393 100644
--- a/src/libjin/Input/Event.h
+++ b/src/libjin/Input/Event.h
@@ -1,13 +1,13 @@
-#ifndef __JIN_EVENT_H
-#define __JIN_EVENT_H
+#ifndef __LIBJIN_EVENT_H
+#define __LIBJIN_EVENT_H
#include "../modules.h"
-#if JIN_MODULES_INPUT
+#if LIBJIN_MODULES_INPUT
namespace jin
{
namespace input
{
-#if JIN_INPUT_SDL
+#if LIBJIN_INPUT_SDL
#include "SDL.h"
typedef SDL_Event Event;
@@ -83,9 +83,9 @@ namespace input
}
*/
-#endif // JIN_INPUT_SDL
+#endif // LIBJIN_INPUT_SDL
} // input
} // jin
-#endif // JIN_MODULES_INPUT
+#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
index 217edd2..21c9a9f 100644
--- a/src/libjin/Input/Input.h
+++ b/src/libjin/Input/Input.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_INPUT_H
-#define __JIN_INPUT_H
+#ifndef __LIBJIN_INPUT_H
+#define __LIBJIN_INPUT_H
#include "event.h"
#include "keyboard.h"
diff --git a/src/libjin/Input/Joypad.h b/src/libjin/Input/Joypad.h
index 62ce076..104e52d 100644
--- a/src/libjin/Input/Joypad.h
+++ b/src/libjin/Input/Joypad.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_JOYPAD_H
-#define __JIN_JOYPAD_H
+#ifndef __LIBJIN_JOYPAD_H
+#define __LIBJIN_JOYPAD_H
namespace jin
{
diff --git a/src/libjin/Input/Keyboard.h b/src/libjin/Input/Keyboard.h
index 49ee90f..250e8f0 100644
--- a/src/libjin/Input/Keyboard.h
+++ b/src/libjin/Input/Keyboard.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_KEYBOARD_H
-#define __JIN_KEYBOARD_H
+#ifndef __LIBJIN_KEYBOARD_H
+#define __LIBJIN_KEYBOARD_H
namespace jin
{
@@ -14,4 +14,4 @@ namespace input
} // input
} // jin
-#endif // __JIN_KEYBOARD_H \ No newline at end of file
+#endif // __LIBJIN_KEYBOARD_H \ No newline at end of file
diff --git a/src/libjin/Input/Mouse.cpp b/src/libjin/Input/Mouse.cpp
index e284f78..892d140 100644
--- a/src/libjin/Input/Mouse.cpp
+++ b/src/libjin/Input/Mouse.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#ifdef JIN_MODULES_INPUT
+#ifdef LIBJIN_MODULES_INPUT
#include "SDL.h"
#include "Mouse.h"
@@ -11,9 +11,9 @@ namespace input
void Mouse::getState(int* x, int* y)
{
- #ifdef JIN_INPUT_SDL
+ #ifdef LIBJIN_INPUT_SDL
SDL_GetMouseState(x, y);
- #endif // JIN_INPUT_SDL
+ #endif // LIBJIN_INPUT_SDL
}
void Mouse::setVisible(bool visible)
@@ -24,4 +24,4 @@ namespace input
} // input
} // jin
-#endif // JIN_MODULES_INPUT \ No newline at end of file
+#endif // LIBJIN_MODULES_INPUT \ No newline at end of file
diff --git a/src/libjin/Input/Mouse.h b/src/libjin/Input/Mouse.h
index 9f6bf5d..25dd4c3 100644
--- a/src/libjin/Input/Mouse.h
+++ b/src/libjin/Input/Mouse.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_MOUSE_H
-#define __JIN_MOUSE_H
+#ifndef __LIBJIN_MOUSE_H
+#define __LIBJIN_MOUSE_H
#include "../modules.h"
-#ifdef JIN_MODULES_INPUT
+#ifdef LIBJIN_MODULES_INPUT
#include "../Common/Singleton.hpp"
@@ -27,5 +27,5 @@ namespace input
} // input
} // jin
-#endif // JIN_MODULES_INPUT
-#endif // __JIN_MOUSE_H \ No newline at end of file
+#endif // LIBJIN_MODULES_INPUT
+#endif // __LIBJIN_MOUSE_H \ No newline at end of file
diff --git a/src/libjin/Math/Math.h b/src/libjin/Math/Math.h
index d496b85..6eb4367 100644
--- a/src/libjin/Math/Math.h
+++ b/src/libjin/Math/Math.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_UTILS_MATH_H
-#define __JIN_UTILS_MATH_H
+#ifndef __LIBJIN_UTILS_MATH_H
+#define __LIBJIN_UTILS_MATH_H
#include "constant.h"
#include "matrix.h"
diff --git a/src/libjin/Math/Matrix.h b/src/libjin/Math/Matrix.h
index 8e5d1f1..b9a55d4 100644
--- a/src/libjin/Math/Matrix.h
+++ b/src/libjin/Math/Matrix.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MATRIX_H
-#define __JIN_MATRIX_H
+#ifndef __LIBJIN_MATRIX_H
+#define __LIBJIN_MATRIX_H
namespace jin
{
diff --git a/src/libjin/Math/Quad.h b/src/libjin/Math/Quad.h
index 350a0d9..ed41270 100644
--- a/src/libjin/Math/Quad.h
+++ b/src/libjin/Math/Quad.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_QUAD_H
-#define __JIN_QUAD_H
+#ifndef __LIBJIN_QUAD_H
+#define __LIBJIN_QUAD_H
namespace jin
{
diff --git a/src/libjin/Math/Vector2.hpp b/src/libjin/Math/Vector2.hpp
index a657c83..bee22f3 100644
--- a/src/libjin/Math/Vector2.hpp
+++ b/src/libjin/Math/Vector2.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_VECTOR_H
-#define __JIN_VECTOR_H
+#ifndef __LIBJIN_VECTOR_H
+#define __LIBJIN_VECTOR_H
namespace jin
{
diff --git a/src/libjin/Math/Vector3.hpp b/src/libjin/Math/Vector3.hpp
index 846dea8..77fa006 100644
--- a/src/libjin/Math/Vector3.hpp
+++ b/src/libjin/Math/Vector3.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_VECTOR3_H
-#define __JIN_VECTOR3_H
+#ifndef __LIBJIN_VECTOR3_H
+#define __LIBJIN_VECTOR3_H
namespace jin
{
diff --git a/src/libjin/Math/Vector4.hpp b/src/libjin/Math/Vector4.hpp
index e869ddf..c7dfaa8 100644
--- a/src/libjin/Math/Vector4.hpp
+++ b/src/libjin/Math/Vector4.hpp
@@ -1,5 +1,5 @@
-#ifndef __JIN_VECTOR4_H
-#define __JIN_VECTOR4_H
+#ifndef __LIBJIN_VECTOR4_H
+#define __LIBJIN_VECTOR4_H
namespace jin
{
diff --git a/src/libjin/Math/constant.h b/src/libjin/Math/constant.h
index f2f740f..f8e0f5a 100644
--- a/src/libjin/Math/constant.h
+++ b/src/libjin/Math/constant.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MATH_CONSTANT_H
-#define __JIN_MATH_CONSTANT_H
+#ifndef __LIBJIN_MATH_CONSTANT_H
+#define __LIBJIN_MATH_CONSTANT_H
#define PI 3.1415926f
diff --git a/src/libjin/Net/Net.cpp b/src/libjin/Net/Net.cpp
index 511de1a..e6c3d98 100644
--- a/src/libjin/Net/Net.cpp
+++ b/src/libjin/Net/Net.cpp
@@ -8,7 +8,7 @@ namespace net
bool Net::initSystem(const SettingBase* setting)
{
#ifdef _WIN32
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_init();
#endif
#endif
diff --git a/src/libjin/Net/Net.h b/src/libjin/Net/Net.h
index 5ca658b..4727667 100644
--- a/src/libjin/Net/Net.h
+++ b/src/libjin/Net/Net.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_NET_H
-#define __JIN_NET_H
+#ifndef __LIBJIN_NET_H
+#define __LIBJIN_NET_H
#include "../modules.h"
-#if JIN_MODULES_NET
+#if LIBJIN_MODULES_NET
#include "../Common/Subsystem.hpp"
#include "Socket.h"
@@ -27,5 +27,5 @@ namespace net
} // net
} // jin
-#endif // JIN_MODULES_NET
-#endif // __JIN_NET_H \ No newline at end of file
+#endif // LIBJIN_MODULES_NET
+#endif // __LIBJIN_NET_H
diff --git a/src/libjin/Net/Socket.cpp b/src/libjin/Net/Socket.cpp
index dfa793d..32d160c 100644
--- a/src/libjin/Net/Socket.cpp
+++ b/src/libjin/Net/Socket.cpp
@@ -32,7 +32,7 @@ namespace net
if (type == SocketType::TCP)
{
tk_IPaddress ip;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
ip.host = tk_strtohl(address);
ip.port = port;
handle.tcpHandle = tk_tcp_open(ip);
@@ -76,7 +76,7 @@ namespace net
}
}
-#if JIN_NET_TEKCOS
+#if LIBJIN_NET_TEKCOS
Socket::Socket(const tk_TCPsocket& tcphandle)
{
@@ -88,7 +88,7 @@ namespace net
handle.udpHandle = udphandle;
}
-#endif // JIN_NET_TEKCOS
+#endif // LIBJIN_NET_TEKCOS
Socket::~Socket()
{
@@ -98,7 +98,7 @@ namespace net
{
if (type != SocketType::TCP)
return;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
if (blocking)
tk_tcp_blocking(&handle.tcpHandle);
else
@@ -111,7 +111,7 @@ namespace net
if (type != SocketType::TCP)
return nullptr;
Socket* client;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_TCPsocket socket = tk_tcp_accept(&handle.tcpHandle);
client = new Socket(socket);
#endif
@@ -122,7 +122,7 @@ namespace net
{
if (type != SocketType::TCP)
return 0;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
int len;
tk_tcp_recv(&handle.tcpHandle, buffer, size, &len);
return len;
@@ -133,7 +133,7 @@ namespace net
{
if (type != SocketType::TCP)
return 0;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
int len;
tk_tcp_send(&handle.tcpHandle, buffer, size, &len);
return len;
@@ -144,7 +144,7 @@ namespace net
{
if (type != SocketType::UDP)
return;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_UDPpack pack;
pack.data = buffer;
pack.len = size;
@@ -159,7 +159,7 @@ namespace net
if (type != SocketType::UDP)
return 0;
int len;
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_UDPpack pack;
pack.data = buffer;
pack.len = size;
@@ -174,13 +174,13 @@ namespace net
{
if (type == SocketType::TCP)
{
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_tcp_close(&handle.tcpHandle);
#endif
}
else if (type == SocketType::UDP)
{
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_udp_close(&handle.udpHandle);
#endif
}
diff --git a/src/libjin/Net/Socket.h b/src/libjin/Net/Socket.h
index 5329974..1a2256c 100644
--- a/src/libjin/Net/Socket.h
+++ b/src/libjin/Net/Socket.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_NET_SOCKET_H
-#define __JIN_NET_SOCKET_H
+#ifndef __LIBJIN_NET_SOCKET_H
+#define __LIBJIN_NET_SOCKET_H
#include "../modules.h"
-#if JIN_MODULES_NET
+#if LIBJIN_MODULES_NET
#include "../3rdparty/tekcos/tekcos.h"
@@ -42,7 +42,7 @@ namespace net
void close();
protected:
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
Socket(const tk_TCPsocket& tcpHandle);
Socket(const tk_UDPsocket& udpHandle);
union
@@ -58,5 +58,5 @@ namespace net
} // net
} // jin
-#endif // JIN_MODULES_NET
-#endif // __JIN_NET_SOCKET_H \ No newline at end of file
+#endif // LIBJIN_MODULES_NET
+#endif // __LIBJIN_NET_SOCKET_H
diff --git a/src/libjin/Net/net.cpp b/src/libjin/Net/net.cpp
index 511de1a..e6c3d98 100644
--- a/src/libjin/Net/net.cpp
+++ b/src/libjin/Net/net.cpp
@@ -8,7 +8,7 @@ namespace net
bool Net::initSystem(const SettingBase* setting)
{
#ifdef _WIN32
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_init();
#endif
#endif
diff --git a/src/libjin/Net/net.h b/src/libjin/Net/net.h
index 5ca658b..4727667 100644
--- a/src/libjin/Net/net.h
+++ b/src/libjin/Net/net.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_NET_H
-#define __JIN_NET_H
+#ifndef __LIBJIN_NET_H
+#define __LIBJIN_NET_H
#include "../modules.h"
-#if JIN_MODULES_NET
+#if LIBJIN_MODULES_NET
#include "../Common/Subsystem.hpp"
#include "Socket.h"
@@ -27,5 +27,5 @@ namespace net
} // net
} // jin
-#endif // JIN_MODULES_NET
-#endif // __JIN_NET_H \ No newline at end of file
+#endif // LIBJIN_MODULES_NET
+#endif // __LIBJIN_NET_H
diff --git a/src/libjin/Thread/Thread.cpp b/src/libjin/Thread/Thread.cpp
index 13e691a..c2b7b91 100644
--- a/src/libjin/Thread/Thread.cpp
+++ b/src/libjin/Thread/Thread.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include "Thread.h"
@@ -17,7 +17,7 @@ namespace thread
void lock();
void unlock();
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_mutex* mutex;
#endif
friend class Conditional;
@@ -33,7 +33,7 @@ namespace thread
void broadcast();
bool wait(Mutex* mutex, int timeout = -1);
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_cond* cond;
#endif
};
@@ -63,28 +63,28 @@ namespace thread
Mutex::Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
mutex = SDL_CreateMutex();
#endif
}
Mutex::~Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyMutex(mutex);
#endif
}
void Mutex::lock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_LockMutex(mutex);
#endif
}
void Mutex::unlock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_UnlockMutex(mutex);
#endif
}
@@ -93,35 +93,35 @@ namespace thread
Conditional::Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
cond = SDL_CreateCond();
#endif
}
Conditional::~Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyCond(cond);
#endif
}
void Conditional::signal()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondSignal(cond);
#endif
}
void Conditional::broadcast()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondBroadcast(cond);
#endif
}
bool Conditional::wait(Mutex* mutex, int timeout)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
if (timeout < 0)
return !SDL_CondWait(cond, mutex->mutex);
else
@@ -183,7 +183,7 @@ namespace thread
Thread::~Thread()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
#endif
}
@@ -206,13 +206,13 @@ namespace thread
return false;
if (handle)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
handle = new std::thread();
#endif
return (running = (handle != nullptr));
@@ -225,7 +225,7 @@ namespace thread
if (!handle)
return;
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
Lock l(mutex);
@@ -298,4 +298,4 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD \ No newline at end of file
+#endif // LIBJIN_MODULES_THREAD \ No newline at end of file
diff --git a/src/libjin/Thread/Thread.h b/src/libjin/Thread/Thread.h
index 3300b4f..3c41949 100644
--- a/src/libjin/Thread/Thread.h
+++ b/src/libjin/Thread/Thread.h
@@ -1,13 +1,13 @@
-#ifndef __JIN_THREAD_H
-#define __JIN_THREAD_H
+#ifndef __LIBJIN_THREAD_H
+#define __LIBJIN_THREAD_H
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include <string>
#include <map>
-#if JIN_THREAD_SDL
+#if LIBJIN_THREAD_SDL
# include "SDL2/SDL_thread.h"
-#elif JIN_THREAD_CPP
+#elif LIBJIN_THREAD_CPP
# include <thread>
# include <mutex>
# include <condition_variable>
@@ -116,9 +116,9 @@ namespace thread
void unlock();
protected:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_Thread* handle; // SDL thread
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
std::thread* handle; // cpp thread
#endif
Mutex* mutex; // mutex variable
@@ -162,5 +162,5 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD
-#endif // __JIN_THREAD_H \ No newline at end of file
+#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/thread.cpp
index 13e691a..c2b7b91 100644
--- a/src/libjin/Thread/thread.cpp
+++ b/src/libjin/Thread/thread.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include "Thread.h"
@@ -17,7 +17,7 @@ namespace thread
void lock();
void unlock();
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_mutex* mutex;
#endif
friend class Conditional;
@@ -33,7 +33,7 @@ namespace thread
void broadcast();
bool wait(Mutex* mutex, int timeout = -1);
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_cond* cond;
#endif
};
@@ -63,28 +63,28 @@ namespace thread
Mutex::Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
mutex = SDL_CreateMutex();
#endif
}
Mutex::~Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyMutex(mutex);
#endif
}
void Mutex::lock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_LockMutex(mutex);
#endif
}
void Mutex::unlock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_UnlockMutex(mutex);
#endif
}
@@ -93,35 +93,35 @@ namespace thread
Conditional::Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
cond = SDL_CreateCond();
#endif
}
Conditional::~Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyCond(cond);
#endif
}
void Conditional::signal()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondSignal(cond);
#endif
}
void Conditional::broadcast()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondBroadcast(cond);
#endif
}
bool Conditional::wait(Mutex* mutex, int timeout)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
if (timeout < 0)
return !SDL_CondWait(cond, mutex->mutex);
else
@@ -183,7 +183,7 @@ namespace thread
Thread::~Thread()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
#endif
}
@@ -206,13 +206,13 @@ namespace thread
return false;
if (handle)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
handle = new std::thread();
#endif
return (running = (handle != nullptr));
@@ -225,7 +225,7 @@ namespace thread
if (!handle)
return;
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
Lock l(mutex);
@@ -298,4 +298,4 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD \ No newline at end of file
+#endif // LIBJIN_MODULES_THREAD \ No newline at end of file
diff --git a/src/libjin/Thread/thread.h b/src/libjin/Thread/thread.h
index 3300b4f..3c41949 100644
--- a/src/libjin/Thread/thread.h
+++ b/src/libjin/Thread/thread.h
@@ -1,13 +1,13 @@
-#ifndef __JIN_THREAD_H
-#define __JIN_THREAD_H
+#ifndef __LIBJIN_THREAD_H
+#define __LIBJIN_THREAD_H
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include <string>
#include <map>
-#if JIN_THREAD_SDL
+#if LIBJIN_THREAD_SDL
# include "SDL2/SDL_thread.h"
-#elif JIN_THREAD_CPP
+#elif LIBJIN_THREAD_CPP
# include <thread>
# include <mutex>
# include <condition_variable>
@@ -116,9 +116,9 @@ namespace thread
void unlock();
protected:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_Thread* handle; // SDL thread
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
std::thread* handle; // cpp thread
#endif
Mutex* mutex; // mutex variable
@@ -162,5 +162,5 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD
-#endif // __JIN_THREAD_H \ No newline at end of file
+#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/Timer.cpp
index a178ae5..e5d0799 100644
--- a/src/libjin/Time/Timer.cpp
+++ b/src/libjin/Time/Timer.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_TIME
+#if LIBJIN_MODULES_TIME
#include "Timer.h"
@@ -97,4 +97,4 @@ namespace time
} // time
} // jin
-#endif // JIN_MODULES_TIME \ No newline at end of file
+#endif // LIBJIN_MODULES_TIME
diff --git a/src/libjin/Time/Timer.h b/src/libjin/Time/Timer.h
index 401e3c5..aff2f70 100644
--- a/src/libjin/Time/Timer.h
+++ b/src/libjin/Time/Timer.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_TIMER_H
-#define __JIN_TIMER_H
+#ifndef __LIBJIN_TIMER_H
+#define __LIBJIN_TIMER_H
#include "../modules.h"
-#if JIN_MODULES_TIME
+#if LIBJIN_MODULES_TIME
#include "SDL2/SDL.h"
#include <vector>
@@ -51,21 +51,21 @@ namespace time
inline void sleep(int ms)
{
- #if JIN_TIME_SDL
+ #if LIBJIN_TIME_SDL
SDL_Delay(ms);
#endif
}
inline double getSecond()
{
- #if JIN_TIME_SDL
+ #if LIBJIN_TIME_SDL
return SDL_GetTicks() / 1000.f;
#endif
}
inline double getMilliSecond()
{
- #if JIN_TIME_SDL
+ #if LIBJIN_TIME_SDL
return SDL_GetTicks();
#endif
}
@@ -73,5 +73,5 @@ namespace time
} // time
} // jin
-#endif // JIN_MODULES_TIME
-#endif // __JIN_TIMER_H \ No newline at end of file
+#endif // LIBJIN_MODULES_TIME
+#endif // __LIBJIN_TIMER_H
diff --git a/src/libjin/Utils/endian.h b/src/libjin/Utils/endian.h
index d4c441a..01def88 100644
--- a/src/libjin/Utils/endian.h
+++ b/src/libjin/Utils/endian.h
@@ -1,23 +1,23 @@
-#ifndef JIN_LIL_ENDIAN && JIN_BIG_ENDIAN
+#ifndef LIBJIN_LIL_ENDIAN && LIBJIN_BIG_ENDIAN
-#define JIN_LIL_ENDIAN 2
-#define JIN_BIG_ENDIAN 4
+#define LIBJIN_LIL_ENDIAN 2
+#define LIBJIN_BIG_ENDIAN 4
#endif
-#ifndef JIN_BYTEORDER
+#ifndef LIBJIN_BYTEORDER
#ifdef __linux__
#include <endian.h>
-#define JIN_BYTEORDER __BYTE_ORDER
+#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 JIN_BYTEORDER JIN_BIG_ENDIAN
+#define LIBJIN_BYTEORDER LIBJIN_BIG_ENDIAN
#else
-#define JIN_BYTEORDER JIN_LIL_ENDIAN
+#define LIBJIN_BYTEORDER LIBJIN_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */ \ No newline at end of file
diff --git a/src/libjin/Utils/macros.h b/src/libjin/Utils/macros.h
index 290bcf7..e19193c 100644
--- a/src/libjin/Utils/macros.h
+++ b/src/libjin/Utils/macros.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MACROS_H
-#define __JIN_MACROS_H
+#ifndef __LIBJIN_MACROS_H
+#define __LIBJIN_MACROS_H
#include <cstring>
//#define implement // ʵֽӿ
diff --git a/src/libjin/Utils/utils.h b/src/libjin/Utils/utils.h
index cf0920e..1654a8f 100644
--- a/src/libjin/Utils/utils.h
+++ b/src/libjin/Utils/utils.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_UTILS_H
-#define __JIN_UTILS_H
+#ifndef __LIBJIN_UTILS_H
+#define __LIBJIN_UTILS_H
#include "macros.h"
#include "endian.h"
diff --git a/src/libjin/audio/audio.cpp b/src/libjin/audio/audio.cpp
index 1ccafcd..c9a3e40 100644
--- a/src/libjin/audio/audio.cpp
+++ b/src/libjin/audio/audio.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
#include "audio.h"
@@ -12,4 +12,4 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/audio/audio.h b/src/libjin/audio/audio.h
index 674020e..9faf0bc 100644
--- a/src/libjin/audio/audio.h
+++ b/src/libjin/audio/audio.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_AUDIO_H
-#define __JIN_AUDIO_H
+#ifndef __LIBJIN_AUDIO_H
+#define __LIBJIN_AUDIO_H
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
@@ -48,5 +48,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO
-#endif // __JIN_AUDIO_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
+#endif // __LIBJIN_AUDIO_H
diff --git a/src/libjin/audio/source.cpp b/src/libjin/audio/source.cpp
index ae3c19b..7ac4e60 100644
--- a/src/libjin/audio/source.cpp
+++ b/src/libjin/audio/source.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include <cstring>
#include "source.h"
@@ -26,4 +26,4 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
diff --git a/src/libjin/audio/source.h b/src/libjin/audio/source.h
index b8cfb83..b227db2 100644
--- a/src/libjin/audio/source.h
+++ b/src/libjin/audio/source.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_AUDIO_SOURCE_H
-#define __JIN_AUDIO_SOURCE_H
+#ifndef __LIBJIN_AUDIO_SOURCE_H
+#define __LIBJIN_AUDIO_SOURCE_H
#include "../modules.h"
-#if JIN_MODULES_AUDIO
+#if LIBJIN_MODULES_AUDIO
#include "SDL2/SDL.h"
@@ -43,5 +43,5 @@ namespace audio
} // audio
} // jin
-#endif // JIN_MODULES_AUDIO
-#endif // __JIN_AUDIO_SOURCE_H \ No newline at end of file
+#endif // LIBJIN_MODULES_AUDIO
+#endif // __LIBJIN_AUDIO_SOURCE_H
diff --git a/src/libjin/core/core.h b/src/libjin/core/core.h
index dd902b4..4b4df8f 100644
--- a/src/libjin/core/core.h
+++ b/src/libjin/core/core.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_CORE_H
-#define __JIN_CORE_H
+#ifndef __LIBJIN_CORE_H
+#define __LIBJIN_CORE_H
#include "game.h"
diff --git a/src/libjin/core/game.h b/src/libjin/core/game.h
index 31f32d8..725c62c 100644
--- a/src/libjin/core/game.h
+++ b/src/libjin/core/game.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_CORE_GAME_H
-#define __JIN_CORE_GAME_H
+#ifndef __LIBJIN_CORE_GAME_H
+#define __LIBJIN_CORE_GAME_H
#include "SDL2/SDL.h"
@@ -55,4 +55,4 @@ namespace core
} // core
} // jin
-#endif // __JIN_CORE_GAME_H \ No newline at end of file
+#endif // __LIBJIN_CORE_GAME_H
diff --git a/src/libjin/input/event.h b/src/libjin/input/event.h
index 9feb3a5..713b393 100644
--- a/src/libjin/input/event.h
+++ b/src/libjin/input/event.h
@@ -1,13 +1,13 @@
-#ifndef __JIN_EVENT_H
-#define __JIN_EVENT_H
+#ifndef __LIBJIN_EVENT_H
+#define __LIBJIN_EVENT_H
#include "../modules.h"
-#if JIN_MODULES_INPUT
+#if LIBJIN_MODULES_INPUT
namespace jin
{
namespace input
{
-#if JIN_INPUT_SDL
+#if LIBJIN_INPUT_SDL
#include "SDL.h"
typedef SDL_Event Event;
@@ -83,9 +83,9 @@ namespace input
}
*/
-#endif // JIN_INPUT_SDL
+#endif // LIBJIN_INPUT_SDL
} // input
} // jin
-#endif // JIN_MODULES_INPUT
+#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
index 217edd2..21c9a9f 100644
--- a/src/libjin/input/input.h
+++ b/src/libjin/input/input.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_INPUT_H
-#define __JIN_INPUT_H
+#ifndef __LIBJIN_INPUT_H
+#define __LIBJIN_INPUT_H
#include "event.h"
#include "keyboard.h"
diff --git a/src/libjin/input/joypad.h b/src/libjin/input/joypad.h
index 62ce076..104e52d 100644
--- a/src/libjin/input/joypad.h
+++ b/src/libjin/input/joypad.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_JOYPAD_H
-#define __JIN_JOYPAD_H
+#ifndef __LIBJIN_JOYPAD_H
+#define __LIBJIN_JOYPAD_H
namespace jin
{
diff --git a/src/libjin/input/keyboard.h b/src/libjin/input/keyboard.h
index 49ee90f..250e8f0 100644
--- a/src/libjin/input/keyboard.h
+++ b/src/libjin/input/keyboard.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_KEYBOARD_H
-#define __JIN_KEYBOARD_H
+#ifndef __LIBJIN_KEYBOARD_H
+#define __LIBJIN_KEYBOARD_H
namespace jin
{
@@ -14,4 +14,4 @@ namespace input
} // input
} // jin
-#endif // __JIN_KEYBOARD_H \ No newline at end of file
+#endif // __LIBJIN_KEYBOARD_H \ No newline at end of file
diff --git a/src/libjin/input/mouse.cpp b/src/libjin/input/mouse.cpp
index e284f78..892d140 100644
--- a/src/libjin/input/mouse.cpp
+++ b/src/libjin/input/mouse.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#ifdef JIN_MODULES_INPUT
+#ifdef LIBJIN_MODULES_INPUT
#include "SDL.h"
#include "Mouse.h"
@@ -11,9 +11,9 @@ namespace input
void Mouse::getState(int* x, int* y)
{
- #ifdef JIN_INPUT_SDL
+ #ifdef LIBJIN_INPUT_SDL
SDL_GetMouseState(x, y);
- #endif // JIN_INPUT_SDL
+ #endif // LIBJIN_INPUT_SDL
}
void Mouse::setVisible(bool visible)
@@ -24,4 +24,4 @@ namespace input
} // input
} // jin
-#endif // JIN_MODULES_INPUT \ No newline at end of file
+#endif // LIBJIN_MODULES_INPUT \ No newline at end of file
diff --git a/src/libjin/input/mouse.h b/src/libjin/input/mouse.h
index 9f6bf5d..25dd4c3 100644
--- a/src/libjin/input/mouse.h
+++ b/src/libjin/input/mouse.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_MOUSE_H
-#define __JIN_MOUSE_H
+#ifndef __LIBJIN_MOUSE_H
+#define __LIBJIN_MOUSE_H
#include "../modules.h"
-#ifdef JIN_MODULES_INPUT
+#ifdef LIBJIN_MODULES_INPUT
#include "../Common/Singleton.hpp"
@@ -27,5 +27,5 @@ namespace input
} // input
} // jin
-#endif // JIN_MODULES_INPUT
-#endif // __JIN_MOUSE_H \ No newline at end of file
+#endif // LIBJIN_MODULES_INPUT
+#endif // __LIBJIN_MOUSE_H \ No newline at end of file
diff --git a/src/libjin/jin.h b/src/libjin/jin.h
index 239fddd..2565cfe 100644
--- a/src/libjin/jin.h
+++ b/src/libjin/jin.h
@@ -1,12 +1,12 @@
-#ifndef __JIN_H
-#define __JIN_H
+#ifndef __LIBJIN_H
+#define __LIBJIN_H
#include "modules.h"
#include "Utils/utils.h"
-#ifdef JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#ifdef LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include "Audio/SDL/SDLAudio.h"
-#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
+#endif // LIBJIN_MODULES_AUDIO && LIBJIN_AUDIO_SDLAUDIO
#include "Core/Core.h"
#include "Filesystem/Filesystem.h"
#include "Input/Input.h"
@@ -15,9 +15,9 @@
#include "Time/Timer.h"
#include "Thread/Thread.h"
-#define JIN_VERSION "Jin 0.1";
-#define JIN_AUTHOR "Chai";
-#define JIN_RELEASE "Jin 0.1.1";
-#define JIN_VERSION_NUM 101;
+#define LIBJIN_VERSION "Jin 0.1";
+#define LIBJIN_AUTHOR "Chai";
+#define LIBJIN_RELEASE "Jin 0.1.1";
+#define LIBJIN_VERSION_NUM 101;
-#endif // __JIN_H \ No newline at end of file
+#endif // __LIBJIN_H \ No newline at end of file
diff --git a/src/libjin/math/constant.h b/src/libjin/math/constant.h
index f2f740f..f8e0f5a 100644
--- a/src/libjin/math/constant.h
+++ b/src/libjin/math/constant.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MATH_CONSTANT_H
-#define __JIN_MATH_CONSTANT_H
+#ifndef __LIBJIN_MATH_CONSTANT_H
+#define __LIBJIN_MATH_CONSTANT_H
#define PI 3.1415926f
diff --git a/src/libjin/math/math.h b/src/libjin/math/math.h
index d496b85..6eb4367 100644
--- a/src/libjin/math/math.h
+++ b/src/libjin/math/math.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_UTILS_MATH_H
-#define __JIN_UTILS_MATH_H
+#ifndef __LIBJIN_UTILS_MATH_H
+#define __LIBJIN_UTILS_MATH_H
#include "constant.h"
#include "matrix.h"
diff --git a/src/libjin/math/matrix.h b/src/libjin/math/matrix.h
index 8e5d1f1..b9a55d4 100644
--- a/src/libjin/math/matrix.h
+++ b/src/libjin/math/matrix.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MATRIX_H
-#define __JIN_MATRIX_H
+#ifndef __LIBJIN_MATRIX_H
+#define __LIBJIN_MATRIX_H
namespace jin
{
diff --git a/src/libjin/math/quad.h b/src/libjin/math/quad.h
index 350a0d9..ed41270 100644
--- a/src/libjin/math/quad.h
+++ b/src/libjin/math/quad.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_QUAD_H
-#define __JIN_QUAD_H
+#ifndef __LIBJIN_QUAD_H
+#define __LIBJIN_QUAD_H
namespace jin
{
diff --git a/src/libjin/modules.h b/src/libjin/modules.h
index 5992f0c..83eb90b 100644
--- a/src/libjin/modules.h
+++ b/src/libjin/modules.h
@@ -1,64 +1,64 @@
-#ifndef __JIN_COMMON_MODULES_H
-#define __JIN_COMMON_MODULES_H
+#ifndef __LIBJIN_COMMON_MODULES_H
+#define __LIBJIN_COMMON_MODULES_H
/*
* ģģı룬Ҫģرղ
*/
-#define JIN_MODULES_AUDIO 1
-#define JIN_AUDIO_SDLAUDIO 1
-#define JIN_AUDIO_OPENAL 1
+#define LIBJIN_MODULES_AUDIO 1
+#define LIBJIN_AUDIO_SDLAUDIO 1
+#define LIBJIN_AUDIO_OPENAL 1
-#define JIN_MODULES_RENDER 1
+#define LIBJIN_MODULES_RENDER 1
-#define JIN_MODULES_DEBUG 1
+#define LIBJIN_MODULES_DEBUG 1
-#define JIN_MODULES_FILESYSTEM 1
+#define LIBJIN_MODULES_FILESYSTEM 1
-#define JIN_MODULES_INPUT 1
-#define JIN_INPUT_SDL 1
+#define LIBJIN_MODULES_INPUT 1
+#define LIBJIN_INPUT_SDL 1
-#define JIN_MODULES_MATH 1
+#define LIBJIN_MODULES_MATH 1
-#define JIN_MODULES_NET 1
-#define JIN_NET_TEKCOS 1
+#define LIBJIN_MODULES_NET 1
+#define LIBJIN_NET_TEKCOS 1
-#define JIN_MODULES_PHYSICS 0
-#define JIN_PHYSICS_BOX2D 1
-#define JIN_PHYSICS_NEWTON 1
+#define LIBJIN_MODULES_PHYSICS 0
+#define LIBJIN_PHYSICS_BOX2D 1
+#define LIBJIN_PHYSICS_NEWTON 1
-#define JIN_MODULES_TILEMAP 1
+#define LIBJIN_MODULES_TILEMAP 1
-#define JIN_MODULES_UI 1
+#define LIBJIN_MODULES_UI 1
-#define JIN_MODULES_TOOLS 0
-#define JIN_TOOLS_COMPONENT 1
-#define JIN_TOOLS_EVENTMSGCENTER 1
-#define JIN_TOOLS_XML 1
-#define JIN_TOOLS_CSV 1
-#define JIN_TOOLS_JSON 1
+#define LIBJIN_MODULES_TOOLS 0
+#define LIBJIN_TOOLS_COMPONENT 1
+#define LIBJIN_TOOLS_EVENTMSGCENTER 1
+#define LIBJIN_TOOLS_XML 1
+#define LIBJIN_TOOLS_CSV 1
+#define LIBJIN_TOOLS_JSON 1
-#define JIN_MODULES_THREAD 1
-#define JIN_THREAD_SDL 1
-#define JIN_THREAD_CPP 0
-#define JIN_THREAD_PTHREAD 0
+#define LIBJIN_MODULES_THREAD 1
+#define LIBJIN_THREAD_SDL 1
+#define LIBJIN_THREAD_CPP 0
+#define LIBJIN_THREAD_PTHREAD 0
-#define JIN_MODULES_TIME 1
-#define JIN_TIME_SDL 1
+#define LIBJIN_MODULES_TIME 1
+#define LIBJIN_TIME_SDL 1
/*
* Open libjin debug
*/
-#define JIN_DEBUG 0
+#define LIBJIN_DEBUG 0
/*
* Operating system
*/
-#define JIN_WINDOWS 1
-#define JIN_MACOS 2
-#define JIN_LINUX 3
+#define LIBJIN_WINDOWS 1
+#define LIBJIN_MACOS 2
+#define LIBJIN_LINUX 3
-#define JIN_OS JIN_WINDOWS
+#define LIBJIN_OS LIBJIN_WINDOWS
#endif \ No newline at end of file
diff --git a/src/libjin/net/net.cpp b/src/libjin/net/net.cpp
index 511de1a..e6c3d98 100644
--- a/src/libjin/net/net.cpp
+++ b/src/libjin/net/net.cpp
@@ -8,7 +8,7 @@ namespace net
bool Net::initSystem(const SettingBase* setting)
{
#ifdef _WIN32
- #if JIN_NET_TEKCOS
+ #if LIBJIN_NET_TEKCOS
tk_init();
#endif
#endif
diff --git a/src/libjin/net/net.h b/src/libjin/net/net.h
index 5ca658b..4727667 100644
--- a/src/libjin/net/net.h
+++ b/src/libjin/net/net.h
@@ -1,7 +1,7 @@
-#ifndef __JIN_NET_H
-#define __JIN_NET_H
+#ifndef __LIBJIN_NET_H
+#define __LIBJIN_NET_H
#include "../modules.h"
-#if JIN_MODULES_NET
+#if LIBJIN_MODULES_NET
#include "../Common/Subsystem.hpp"
#include "Socket.h"
@@ -27,5 +27,5 @@ namespace net
} // net
} // jin
-#endif // JIN_MODULES_NET
-#endif // __JIN_NET_H \ No newline at end of file
+#endif // LIBJIN_MODULES_NET
+#endif // __LIBJIN_NET_H
diff --git a/src/libjin/thread/thread.cpp b/src/libjin/thread/thread.cpp
index 13e691a..c2b7b91 100644
--- a/src/libjin/thread/thread.cpp
+++ b/src/libjin/thread/thread.cpp
@@ -1,5 +1,5 @@
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include "Thread.h"
@@ -17,7 +17,7 @@ namespace thread
void lock();
void unlock();
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_mutex* mutex;
#endif
friend class Conditional;
@@ -33,7 +33,7 @@ namespace thread
void broadcast();
bool wait(Mutex* mutex, int timeout = -1);
private:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_cond* cond;
#endif
};
@@ -63,28 +63,28 @@ namespace thread
Mutex::Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
mutex = SDL_CreateMutex();
#endif
}
Mutex::~Mutex()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyMutex(mutex);
#endif
}
void Mutex::lock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_LockMutex(mutex);
#endif
}
void Mutex::unlock()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_UnlockMutex(mutex);
#endif
}
@@ -93,35 +93,35 @@ namespace thread
Conditional::Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
cond = SDL_CreateCond();
#endif
}
Conditional::~Conditional()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_DestroyCond(cond);
#endif
}
void Conditional::signal()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondSignal(cond);
#endif
}
void Conditional::broadcast()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_CondBroadcast(cond);
#endif
}
bool Conditional::wait(Mutex* mutex, int timeout)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
if (timeout < 0)
return !SDL_CondWait(cond, mutex->mutex);
else
@@ -183,7 +183,7 @@ namespace thread
Thread::~Thread()
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
#endif
}
@@ -206,13 +206,13 @@ namespace thread
return false;
if (handle)
{
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
handle = new std::thread();
#endif
return (running = (handle != nullptr));
@@ -225,7 +225,7 @@ namespace thread
if (!handle)
return;
}
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_WaitThread(handle, nullptr);
#endif
Lock l(mutex);
@@ -298,4 +298,4 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD \ No newline at end of file
+#endif // LIBJIN_MODULES_THREAD \ No newline at end of file
diff --git a/src/libjin/thread/thread.h b/src/libjin/thread/thread.h
index 3300b4f..3c41949 100644
--- a/src/libjin/thread/thread.h
+++ b/src/libjin/thread/thread.h
@@ -1,13 +1,13 @@
-#ifndef __JIN_THREAD_H
-#define __JIN_THREAD_H
+#ifndef __LIBJIN_THREAD_H
+#define __LIBJIN_THREAD_H
#include "../modules.h"
-#if JIN_MODULES_THREAD
+#if LIBJIN_MODULES_THREAD
#include <string>
#include <map>
-#if JIN_THREAD_SDL
+#if LIBJIN_THREAD_SDL
# include "SDL2/SDL_thread.h"
-#elif JIN_THREAD_CPP
+#elif LIBJIN_THREAD_CPP
# include <thread>
# include <mutex>
# include <condition_variable>
@@ -116,9 +116,9 @@ namespace thread
void unlock();
protected:
- #if JIN_THREAD_SDL
+ #if LIBJIN_THREAD_SDL
SDL_Thread* handle; // SDL thread
- #elif JIN_THREAD_CPP
+ #elif LIBJIN_THREAD_CPP
std::thread* handle; // cpp thread
#endif
Mutex* mutex; // mutex variable
@@ -162,5 +162,5 @@ namespace thread
} // thread
} // jin
-#endif // JIN_MODULES_THREAD
-#endif // __JIN_THREAD_H \ No newline at end of file
+#endif // LIBJIN_MODULES_THREAD
+#endif // __LIBJIN_THREAD_H \ No newline at end of file
diff --git a/src/libjin/utils/endian.h b/src/libjin/utils/endian.h
index d4c441a..01def88 100644
--- a/src/libjin/utils/endian.h
+++ b/src/libjin/utils/endian.h
@@ -1,23 +1,23 @@
-#ifndef JIN_LIL_ENDIAN && JIN_BIG_ENDIAN
+#ifndef LIBJIN_LIL_ENDIAN && LIBJIN_BIG_ENDIAN
-#define JIN_LIL_ENDIAN 2
-#define JIN_BIG_ENDIAN 4
+#define LIBJIN_LIL_ENDIAN 2
+#define LIBJIN_BIG_ENDIAN 4
#endif
-#ifndef JIN_BYTEORDER
+#ifndef LIBJIN_BYTEORDER
#ifdef __linux__
#include <endian.h>
-#define JIN_BYTEORDER __BYTE_ORDER
+#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 JIN_BYTEORDER JIN_BIG_ENDIAN
+#define LIBJIN_BYTEORDER LIBJIN_BIG_ENDIAN
#else
-#define JIN_BYTEORDER JIN_LIL_ENDIAN
+#define LIBJIN_BYTEORDER LIBJIN_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */ \ No newline at end of file
diff --git a/src/libjin/utils/macros.h b/src/libjin/utils/macros.h
index 290bcf7..e19193c 100644
--- a/src/libjin/utils/macros.h
+++ b/src/libjin/utils/macros.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_MACROS_H
-#define __JIN_MACROS_H
+#ifndef __LIBJIN_MACROS_H
+#define __LIBJIN_MACROS_H
#include <cstring>
//#define implement // ʵֽӿ
diff --git a/src/libjin/utils/utils.h b/src/libjin/utils/utils.h
index cf0920e..1654a8f 100644
--- a/src/libjin/utils/utils.h
+++ b/src/libjin/utils/utils.h
@@ -1,5 +1,5 @@
-#ifndef __JIN_UTILS_H
-#define __JIN_UTILS_H
+#ifndef __LIBJIN_UTILS_H
+#define __LIBJIN_UTILS_H
#include "macros.h"
#include "endian.h"
diff --git a/src/lua/common/common.h b/src/lua/common/common.h
index 536b897..0ee72cc 100644
--- a/src/lua/common/common.h
+++ b/src/lua/common/common.h
@@ -3,5 +3,6 @@
#include "Proxy.h"
#include "Reference.hpp"
+#include "error.h"
#endif \ No newline at end of file
diff --git a/src/lua/common/error.h b/src/lua/common/error.h
new file mode 100644
index 0000000..f8b62f2
--- /dev/null
+++ b/src/lua/common/error.h
@@ -0,0 +1,28 @@
+#ifndef __JIN_ERROR_H
+#define __JIN_ERROR_H
+#include "../../luax.h"
+#include "../modules/jin.h"
+#include <string.h>
+
+namespace jin
+{
+namespace lua
+{
+
+ static const int FORMAT_MSG_BUFFER_SIZE = 2048;
+
+ inline void error(lua_State* L, const char* fmt, ...)
+ {
+ char err[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
+ va_list args;
+ va_start(args, fmt);
+ vsnprintf(err + strlen(err), FORMAT_MSG_BUFFER_SIZE, fmt, args);
+ va_end(args);
+ luax_getglobal(L, MODULE_NAME);
+ luax_setfield_string(L, "error", err);
+ }
+
+}
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/libraries/luax/luax.h b/src/lua/libraries/luax/luax.h
index 56023b3..9b283bd 100644
--- a/src/lua/libraries/luax/luax.h
+++ b/src/lua/libraries/luax/luax.h
@@ -104,6 +104,7 @@ inline bool luax_checkbool(lua_State *L, int numArg)
#define luax_pushinteger lua_pushinteger
#define luax_pushboolean lua_pushboolean
#define luax_pushlightuserdata lua_pushlightuserdata
+#define luax_pushnil lua_pushnil
//inline void luax_pushuserdata(lua_State* L, void* p)
//{
diff --git a/src/lua/modules/audio/audio.cpp b/src/lua/modules/audio/audio.cpp
index 3d29e17..7590104 100644
--- a/src/lua/modules/audio/audio.cpp
+++ b/src/lua/modules/audio/audio.cpp
@@ -64,17 +64,29 @@ namespace lua
{
Filesystem* fs = Filesystem::get();
const char* f = luax_checkstring(L, 1);
+ Buffer b;
if (!fs->exists(f))
{
- printf("Error: no such image %s\n", f);
- exit(1);
+ error(L, "No such image %s", f);
+ goto fail;
+ }
+ if (!fs->read(f, &b))
+ {
+ error(L, "Failed to read source file %s", f);
+ goto fail;
}
- Buffer b;
- fs->read(f, &b);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_AUDIO_SOURCE, sizeof(Proxy));
Source* src = Source::createSource(b.data, b.size);
+ if (src == nullptr)
+ {
+ error(L, "Failed to decode source file %s", f);
+ goto fail;
+ }
+ Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_AUDIO_SOURCE, sizeof(Proxy));
proxy->bind(new Ref<Source>(src, JIN_AUDIO_SOURCE));
return 1;
+ fail:
+ luax_pushnil(L);
+ return 1;
}
static int l_destroy(lua_State* L)
diff --git a/src/lua/modules/core/core.cpp b/src/lua/modules/core/core.cpp
index 4a370db..bfd80b8 100644
--- a/src/lua/modules/core/core.cpp
+++ b/src/lua/modules/core/core.cpp
@@ -29,10 +29,10 @@ namespace lua
}
static const luaL_Reg f[] = {
- {"running", l_running },
- {"stop", l_stop },
- {"quit", l_quit },
- {0, 0 }
+ { "running", l_running },
+ { "stop", l_stop },
+ { "quit", l_quit },
+ { 0, 0 }
};
int luaopen_core(lua_State* L)
diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp
index 8a58ff0..ada4754 100644
--- a/src/lua/modules/graphics/graphics.cpp
+++ b/src/lua/modules/graphics/graphics.cpp
@@ -107,16 +107,28 @@ namespace lua
Filesystem* fs = Filesystem::get();
if (!fs->exists(f))
{
- printf("Error: no such texture %s\n", f);
- exit(1);
+ error(L, "No such image file %s", f);
+ goto fail;
}
Buffer b;
- fs->read(f, &b);
+ if (!fs->read(f, &b))
+ {
+ error(L, "Failed to read image %s", f);
+ goto fail;
+ }
bitmap = Bitmap::createBitmap(b.data, b.size);
+ if (bitmap == nullptr)
+ {
+ error(L, "Failed to decode image file %s", f);
+ goto fail;
+ }
}
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_BITMAP, sizeof(Proxy));
proxy->bind(new Ref<Bitmap>(bitmap, JIN_GRAPHICS_BITMAP));
return 1;
+ fail:
+ luax_pushnil(L);
+ return 1;
}
/* jin.graphics.newTexture(bitmap) */
@@ -126,16 +138,22 @@ namespace lua
Ref<Bitmap>& refBitmap = p->getRef<Bitmap>();
Bitmap* bitmap = refBitmap.getObject();
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TEXTURE, sizeof(Proxy));
- Texture* img = Texture::createTexture(bitmap);
- proxy->bind(new Ref<Texture>(img, JIN_GRAPHICS_TEXTURE));
+ Texture* tex = Texture::createTexture(bitmap);
+ proxy->bind(new Ref<Texture>(tex, JIN_GRAPHICS_TEXTURE));
return 1;
}
static int l_newShader(lua_State* L)
{
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_SHADER, sizeof(Proxy));
const char* program = luax_checkstring(L, 1);
JSLProgram* jsl = JSLProgram::createJSLProgram(program);
+ if (jsl == nullptr)
+ {
+ error(L, "Failed to compile shader");
+ luax_pushnil(L);
+ return 1;
+ }
+ Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_SHADER, sizeof(Proxy));
proxy->bind(new Ref<JSLProgram>(jsl, JIN_GRAPHICS_SHADER));
return 1;
}
@@ -420,11 +438,10 @@ namespace lua
luax_error(L, emsg, n * 2, tn);
return 1;
}
- float* p = new float[2 * n];
+ float* p = (float*)alloca(2 * n * sizeof(float));
for (int i = 1; i <= 2 * n; ++i)
p[i - 1] = luax_rawgetnumber(L, 3, i);
polygon(mode, p, n);
- delete[] p;
}
else
{
@@ -445,8 +462,9 @@ namespace lua
Buffer b = {};
if (!fs->exists(path))
{
- printf("Error: no such font %s\n", path);
- exit(1);
+ error(L, "No such font %s\n", path);
+ luax_pushnil(L);
+ return 1;
}
fs->read(path, &b);
font->loadMemory((const unsigned char*)b.data);
diff --git a/src/lua/modules/luax.h b/src/lua/modules/luax.h
index 89e456e..24d74e4 100644
--- a/src/lua/modules/luax.h
+++ b/src/lua/modules/luax.h
@@ -1,7 +1,6 @@
-#ifndef __JIN_LUA_LUAX_H
-#define __JIN_LUA_LUAX_H
+#ifndef __JIN_MODULES_LUAX_H
+#define __JIN_MODULES_LUAX_H
-#include "LuaJIT/lua.hpp"
-#include "lua/libraries/luax/luax.h"
+#include "../../luax.h"
#endif \ No newline at end of file
diff --git a/src/luax.h b/src/luax.h
new file mode 100644
index 0000000..89e456e
--- /dev/null
+++ b/src/luax.h
@@ -0,0 +1,7 @@
+#ifndef __JIN_LUA_LUAX_H
+#define __JIN_LUA_LUAX_H
+
+#include "LuaJIT/lua.hpp"
+#include "lua/libraries/luax/luax.h"
+
+#endif \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index f0abd16..5b6309a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,7 +3,7 @@
#include <direct.h>
#endif
-#include "lua/modules/luax.h"
+#include "luax.h"
#include "lua/modules/jin.h"
#include "libjin/jin.h"
#include <Windows.h>