diff options
author | chai <chaifix@163.com> | 2018-05-21 16:02:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-05-21 16:02:00 +0800 |
commit | fa234f9663b992cf50bcf865a1cde6845b42193c (patch) | |
tree | 34ecd41b60ef48c960a79a4077e5e0c8536102fd /src | |
parent | 51ba9cb2a6b0b9395a2912eadeb954c95e4c1d3c (diff) |
修改audio模块
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/luax/luax.h | 15 | ||||
-rw-r--r-- | src/libjin/audio/audio.cpp | 37 | ||||
-rw-r--r-- | src/libjin/audio/audio.h | 52 | ||||
-rw-r--r-- | src/libjin/audio/sdl/audio.cpp | 83 | ||||
-rw-r--r-- | src/libjin/audio/sdl/audio.h | 59 | ||||
-rw-r--r-- | src/libjin/audio/sdl/source.cpp | 2 | ||||
-rw-r--r-- | src/libjin/audio/sdl/source.h | 19 | ||||
-rw-r--r-- | src/libjin/audio/source.h | 31 | ||||
-rw-r--r-- | src/libjin/common/subsystem.h | 8 | ||||
-rw-r--r-- | src/libjin/core/thread.cpp (renamed from src/script/thread/luaopen_Thread.cpp) | 0 | ||||
-rw-r--r-- | src/libjin/core/thread.h | 1 | ||||
-rw-r--r-- | src/libjin/core/timer.cpp | 0 | ||||
-rw-r--r-- | src/libjin/core/timer.h | 1 | ||||
-rw-r--r-- | src/libjin/jin.h | 5 | ||||
-rw-r--r-- | src/libjin/math/constant.h | 4 | ||||
-rw-r--r-- | src/libjin/math/math.h | 7 | ||||
-rw-r--r-- | src/libjin/math/rect.h | 15 | ||||
-rw-r--r-- | src/libjin/physics/physics.h | 12 | ||||
-rw-r--r-- | src/libjin/render/image.cpp | 1 | ||||
-rw-r--r-- | src/libjin/utils/endian.h | 3 | ||||
-rw-r--r-- | src/libjin/utils/unittest.cpp | 33 | ||||
-rw-r--r-- | src/libjin/utils/utils.h | 6 | ||||
-rw-r--r-- | src/lua/audio/luaopen_Source.cpp (renamed from src/script/audio/luaopen_Source.cpp) | 2 | ||||
-rw-r--r-- | src/lua/audio/luaopen_audio.cpp (renamed from src/script/audio/luaopen_audio.cpp) | 2 | ||||
-rw-r--r-- | src/lua/core/luaopen_core.cpp (renamed from src/script/core/luaopen_core.cpp) | 2 | ||||
-rw-r--r-- | src/lua/debug/luaopen_debug.cpp (renamed from src/script/debug/luaopen_debug.cpp) | 0 | ||||
-rw-r--r-- | src/lua/embed/boot.lua (renamed from src/script/embed/boot.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/boot.lua.h (renamed from src/script/embed/boot.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/debug.lua (renamed from src/script/embed/debug.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/debug.lua.h (renamed from src/script/embed/debug.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/embed.h (renamed from src/script/embed/embed.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/graphics.lua (renamed from src/script/embed/graphics.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/graphics.lua.h (renamed from src/script/embed/graphics.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/keyboard.lua (renamed from src/script/embed/keyboard.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/keyboard.lua.h (renamed from src/script/embed/keyboard.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/mouse.lua (renamed from src/script/embed/mouse.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/mouse.lua.h (renamed from src/script/embed/mouse.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/embed/path.lua (renamed from src/script/embed/path.lua) | 0 | ||||
-rw-r--r-- | src/lua/embed/path.lua.h (renamed from src/script/embed/path.lua.h) | 0 | ||||
-rw-r--r-- | src/lua/event/luaopen_event.cpp (renamed from src/script/event/luaopen_event.cpp) | 2 | ||||
-rw-r--r-- | src/lua/filesystem/luaopen_filesystem.cpp (renamed from src/script/filesystem/luaopen_filesystem.cpp) | 2 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_Canvas.cpp (renamed from src/script/graphics/luaopen_Canvas.cpp) | 4 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_Font.cpp (renamed from src/script/graphics/luaopen_Font.cpp) | 4 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_Image.cpp (renamed from src/script/graphics/luaopen_Image.cpp) | 4 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_JSL.cpp (renamed from src/script/graphics/luaopen_JSL.cpp) | 4 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_graphics.cpp (renamed from src/script/graphics/luaopen_graphics.cpp) | 8 | ||||
-rw-r--r-- | src/lua/joypad/joypad.h (renamed from src/script/joypad/joypad.h) | 0 | ||||
-rw-r--r-- | src/lua/joypad/luaopen_joypad.cpp (renamed from src/script/joypad/luaopen_joypad.cpp) | 2 | ||||
-rw-r--r-- | src/lua/keyboard/luaopen_keyboard.cpp (renamed from src/script/keyboard/luaopen_keyboard.cpp) | 4 | ||||
-rw-r--r-- | src/lua/luaopen_jin.cpp (renamed from src/script/luaopen_jin.cpp) | 2 | ||||
-rw-r--r-- | src/lua/luaopen_jin.h (renamed from src/script/luaopen_jin.h) | 2 | ||||
-rw-r--r-- | src/lua/luaopen_types.h (renamed from src/script/luaopen_types.h) | 0 | ||||
-rw-r--r-- | src/lua/luax.h | 10 | ||||
-rw-r--r-- | src/lua/mouse/luaopen_mouse.cpp (renamed from src/script/mouse/luaopen_mouse.cpp) | 2 | ||||
-rw-r--r-- | src/lua/net/luaopen_net.cpp (renamed from src/script/net/luaopen_net.cpp) | 2 | ||||
-rw-r--r-- | src/lua/thread/luaopen_Thread.cpp | 0 | ||||
-rw-r--r-- | src/lua/time/luaopen_time.cpp (renamed from src/script/time/luaopen_time.cpp) | 2 | ||||
-rw-r--r-- | src/main.cpp | 4 |
58 files changed, 311 insertions, 147 deletions
diff --git a/src/3rdparty/luax/luax.h b/src/3rdparty/luax/luax.h index b5ef0f4..d3047b9 100644 --- a/src/3rdparty/luax/luax.h +++ b/src/3rdparty/luax/luax.h @@ -18,14 +18,14 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +/** +* include following 3 files before this +* lua.h +* lauxlib.h +* lualib.h +*/ #ifndef __LUAX_H #define __LUAX_H - -#include "3rdparty/lua51/lua.h" -#include "3rdparty/lua51/lauxlib.h" -#include "3rdparty/lua51/lualib.h" - // only for lua 5.1 #if LUA_VERSION_NUM == 501 @@ -331,4 +331,5 @@ inline int luax_register_searcher(lua_State * L, lua_CFunction f, int pos) } #endif -#endif + +#endif
\ No newline at end of file diff --git a/src/libjin/audio/audio.cpp b/src/libjin/audio/audio.cpp index 7142625..edba496 100644 --- a/src/libjin/audio/audio.cpp +++ b/src/libjin/audio/audio.cpp @@ -6,7 +6,7 @@ namespace jin { namespace audio { - + shared Audio* Audio::audio = NULL; bool Audio::init(const SettingBase* setting) @@ -20,40 +20,5 @@ namespace audio CallOnce(_quit()); } - onlyonce bool Audio::_init(const SettingBase* s) - { - if (SDL_Init(SDL_INIT_AUDIO) < 0) - return false; - - const AudioSetting* setting = (AudioSetting*)s; - SDL_AudioSpec wanted; - zero(wanted); - wanted.freq = setting->freq; - wanted.format = setting->format; - wanted.channels = setting->channels; - wanted.samples = setting->samples; - wanted.userdata = setting->userdata; - wanted.callback = setting->callback; - - if (SDL_OpenAudio(&wanted, NULL) < 0) - { - return false; - } - // start audio - SDL_PauseAudio(0); - return true; - } - - onlyonce void Audio::_quit() - { - SDL_CloseAudio(); - delete audio; - } - - shared void defaultCallback(void *udata, Uint8 *stream, int len) - { - - } - } }
\ No newline at end of file diff --git a/src/libjin/audio/audio.h b/src/libjin/audio/audio.h index 80e463f..6d57cd2 100644 --- a/src/libjin/audio/audio.h +++ b/src/libjin/audio/audio.h @@ -10,44 +10,42 @@ namespace jin { namespace audio { - - class Audio : public common::Subsystem + class Source; + + class IAudio { + public: - - struct Setting : SettingBase - { - int freq; - int format; - char channels; - int samples; - SDL_AudioCallback callback; - void* userdata; - }; - - bool init(const SettingBase* setting) override; - void quit() override; - static inline Audio* get() - { - return (audio == NULL ? (audio = new Audio()) : audio); - } + virtual void play() = 0; + virtual void stop() = 0; + virtual bool pause() = 0; + virtual bool pause(Source* source) = 0; + virtual bool resume() = 0; + virtual bool resume(Source* source) = 0; + virtual void rewind() = 0; + virtual void setVolume(float volume) = 0; + virtual float getVolume() = 0; - static void defaultCallback(void *udata, Uint8 *stream, int len); + }; - private: + class Audio : public common::Subsystem, IAudio + { - Audio() {}; - ~Audio() {}; + public: + + Audio() {}; + virtual ~Audio() {}; + + bool init(const SettingBase* setting) override; + void quit() override; + + protected: static Audio* audio; - onlyonce bool _init(const SettingBase* setting) override; - onlyonce void _quit() override; }; - typedef Audio::Setting AudioSetting; - } } diff --git a/src/libjin/audio/sdl/audio.cpp b/src/libjin/audio/sdl/audio.cpp new file mode 100644 index 0000000..0559c18 --- /dev/null +++ b/src/libjin/audio/sdl/audio.cpp @@ -0,0 +1,83 @@ +#include "audio.h" + +namespace jin +{ +namespace audio +{ + + onlyonce bool SDLAudio::_init(const SettingBase* s) + { + if (SDL_Init(SDL_INIT_AUDIO) < 0) + return false; + + const SDLAudioSetting* setting = (SDLAudioSetting*)s; + SDL_AudioSpec wanted; + zero(wanted); + wanted.freq = setting->rate; + wanted.format = setting->resolution; + wanted.channels = setting->channels; + wanted.samples = setting->samples; + wanted.userdata = setting->userdata; + wanted.callback = setting->callback; + + if (SDL_OpenAudio(&wanted, NULL) < 0) + { + return false; + } + // start audio + SDL_PauseAudio(0); + return true; + } + + onlyonce void SDLAudio::_quit() + { + SDL_CloseAudio(); + delete audio; + } + + void SDLAudio::defaultCallback(void *udata, Uint8 *stream, int len) + { + + } + + void SDLAudio::play() {} + + void SDLAudio::stop() {} + + bool SDLAudio::pause() + { + return false; + } + + bool SDLAudio::pause(Source* source) + { + return false; + } + + bool SDLAudio::resume() + { + return false; + } + + bool SDLAudio::resume(Source* source) + { + return false; + } + + void SDLAudio::rewind() + { + + } + + void SDLAudio::setVolume(float volume) + { + + } + + float SDLAudio::getVolume() + { + return 0.f; + } + +} +} diff --git a/src/libjin/audio/sdl/audio.h b/src/libjin/audio/sdl/audio.h new file mode 100644 index 0000000..920f56a --- /dev/null +++ b/src/libjin/audio/sdl/audio.h @@ -0,0 +1,59 @@ +#ifndef __JIN_AUDIO_SDL_H +#define __JIN_AUDIO_SDL_H + +#include "../audio.h" + +namespace jin +{ +namespace audio +{ + + class SDLAudio : public Audio + { + + public: + + struct Setting : SettingBase + { + int rate; // + int resolution; // ֱ + char channels; // + int samples; // ȡ + SDL_AudioCallback callback; // Ƶص + void* userdata; // Զ + }; + + static void defaultCallback(void *udata, Uint8 *stream, int len); + + static inline Audio* get() + { + return audio != NULL ? audio : (audio = new SDLAudio()); + } + + /* IAudio interface */ + void play() override; + void stop() override; + bool pause() override; + bool pause(Source* source) override; + bool resume() override; + bool resume(Source* source) override; + void rewind() override; + void setVolume(float volume) override; + float getVolume() override; + + private: + + SDLAudio() {} + ~SDLAudio() {} + + onlyonce bool _init(const SettingBase* setting) override; + onlyonce void _quit() override; + + }; + + typedef SDLAudio::Setting SDLAudioSetting; + +} +} + +#endif
\ No newline at end of file diff --git a/src/libjin/audio/sdl/source.cpp b/src/libjin/audio/sdl/source.cpp new file mode 100644 index 0000000..cca4d3e --- /dev/null +++ b/src/libjin/audio/sdl/source.cpp @@ -0,0 +1,2 @@ +#include "source.h" + diff --git a/src/libjin/audio/sdl/source.h b/src/libjin/audio/sdl/source.h new file mode 100644 index 0000000..052a49e --- /dev/null +++ b/src/libjin/audio/sdl/source.h @@ -0,0 +1,19 @@ +#ifndef __JIN_SOURCE_SDL_H +#define __JIN_SOURCE_SDL_H + +#include "../source.h" + +namespace jin +{ +namespace audio +{ + + class SDLSource : public Source + { + + }; + +} +} + +#endif
\ No newline at end of file diff --git a/src/libjin/audio/source.h b/src/libjin/audio/source.h index 96da208..79fa8e0 100644 --- a/src/libjin/audio/source.h +++ b/src/libjin/audio/source.h @@ -10,21 +10,32 @@ namespace audio class Source { + public: - void play(); - void stop(); - void pause(); - void resume(); - void rewind(); - void isStopped() const; - void isPaused() const; - void isFinished() const; - void setPitch(float pitch); - void setVolume(float volume); + + virtual void play() = 0; + virtual void stop() = 0; + virtual void pause() = 0; + virtual void resume() = 0; + virtual void rewind() = 0; + virtual void isStopped() const = 0; + virtual void isPaused() const = 0; + virtual void isFinished() 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: + + Source(); + virtual ~Source(); private: + unsigned char * curPos; unsigned int length; + }; } diff --git a/src/libjin/common/subsystem.h b/src/libjin/common/subsystem.h index ad28061..ca4b33d 100644 --- a/src/libjin/common/subsystem.h +++ b/src/libjin/common/subsystem.h @@ -10,6 +10,7 @@ namespace common class Subsystem { + public: struct Setting {}; @@ -20,11 +21,14 @@ namespace common virtual void quit() = 0; - private: + protected: - virtual onlyonce bool _init(const Setting* setting) = 0; + Subsystem() {}; + virtual ~Subsystem() {}; + virtual onlyonce bool _init(const Setting* setting) = 0; virtual onlyonce void _quit() = 0; + }; } diff --git a/src/script/thread/luaopen_Thread.cpp b/src/libjin/core/thread.cpp index e69de29..e69de29 100644 --- a/src/script/thread/luaopen_Thread.cpp +++ b/src/libjin/core/thread.cpp diff --git a/src/libjin/core/thread.h b/src/libjin/core/thread.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/src/libjin/core/thread.h @@ -0,0 +1 @@ +#pragma once diff --git a/src/libjin/core/timer.cpp b/src/libjin/core/timer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/libjin/core/timer.cpp diff --git a/src/libjin/core/timer.h b/src/libjin/core/timer.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/src/libjin/core/timer.h @@ -0,0 +1 @@ +#pragma once diff --git a/src/libjin/jin.h b/src/libjin/jin.h index 95895f7..32c04c7 100644 --- a/src/libjin/jin.h +++ b/src/libjin/jin.h @@ -9,4 +9,9 @@ #include "net/net.h" #include "render/render.h" +#define JIN_VERSION "Jin 0.1" +#define JIN_RELEASE "Jin 0.1.0" +#define JIN_VERSION_NUM 100 // 00.01.00 +#define JIN_AUTHOR "Chai" + #endif
\ No newline at end of file diff --git a/src/libjin/math/constant.h b/src/libjin/math/constant.h index 74acaea..f2f740f 100644 --- a/src/libjin/math/constant.h +++ b/src/libjin/math/constant.h @@ -3,4 +3,8 @@ #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 index fdf1725..f6a299e 100644 --- a/src/libjin/math/math.h +++ b/src/libjin/math/math.h @@ -6,6 +6,11 @@ #include "constant.h" #include "matrix.h" #include "quad.h" -#include "rect.h" + +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define clamp(a, mi,ma) min(max(a,mi),ma) +#define within(a,min,max) (a >= min && a <= max) +#define without(a,min,max) (a < min || a > max) #endif
\ No newline at end of file diff --git a/src/libjin/math/rect.h b/src/libjin/math/rect.h deleted file mode 100644 index 79c1df2..0000000 --- a/src/libjin/math/rect.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __JIN_RECT_H -#define __JIN_RECT_H - -namespace jin -{ -namespace math -{ - class Rect - { - public: - int x, y, w, h; - }; -} -} -#endif
\ No newline at end of file diff --git a/src/libjin/physics/physics.h b/src/libjin/physics/physics.h new file mode 100644 index 0000000..9927301 --- /dev/null +++ b/src/libjin/physics/physics.h @@ -0,0 +1,12 @@ +#ifndef __JIN_PHYSICS_H +#define __JIN_PHYSICS_H + +namespace jin +{ +namespace physics +{ + +} +} + +#endif
\ No newline at end of file diff --git a/src/libjin/render/image.cpp b/src/libjin/render/image.cpp index 583bd8d..7955aa2 100644 --- a/src/libjin/render/image.cpp +++ b/src/libjin/render/image.cpp @@ -1,6 +1,7 @@ #include "image.h" #include "3rdparty/stb/stb_image.h" #include "../utils/utils.h" +#include "../math/math.h" namespace jin { diff --git a/src/libjin/utils/endian.h b/src/libjin/utils/endian.h index df28ddb..d4c441a 100644 --- a/src/libjin/utils/endian.h +++ b/src/libjin/utils/endian.h @@ -1,6 +1,3 @@ -/** -* -*/ #ifndef JIN_LIL_ENDIAN && JIN_BIG_ENDIAN #define JIN_LIL_ENDIAN 2 diff --git a/src/libjin/utils/unittest.cpp b/src/libjin/utils/unittest.cpp index 764a2bd..5b73312 100644 --- a/src/libjin/utils/unittest.cpp +++ b/src/libjin/utils/unittest.cpp @@ -2,32 +2,41 @@ #if UNITTEST #include <stdio.h> -#include "../audio/audio.h" +#include "../audio/sdl/audio.h" using namespace jin::audio; -void fill_audio(void *udata, Uint8 *stream, int len) +int sample_nr = 0; + +void fill_audio(void *user_data, Uint8 *raw_buffer, int bytes) { - printf("%d\n", len); - memset(stream, 0x11, len); + Sint16 *buffer = (Sint16*)raw_buffer; + int length = bytes / 2; // 2 bytes per sample for AUDIO_S16SYS + int &sample_nr(*(int*)user_data); + + for (int i = 0; i < length; i++, sample_nr++) + { + double time = (double)sample_nr / (double)44100; + buffer[i] = (Sint16)(28000 * sin(2.0f * M_PI * 441.0f * time)); // render 441 HZ sine wave + } } int main(int argc, char* argv[]) { - Audio* audio = Audio::get(); - - AudioSetting setting; - setting.freq = 22050; - setting.format = AUDIO_S16; - setting.channels = 2; + Audio* audio = SDLAudio::get(); + SDLAudioSetting setting; + setting.rate = 44100; + setting.resolution = AUDIO_S16SYS; + setting.channels = 1; setting.callback = fill_audio; - setting.samples = 1024; - setting.userdata = NULL; + setting.samples = 44100; + setting.userdata = &sample_nr; audio->init(&setting); while (true) { SDL_Delay(100); } + audio->quit(); return 0; } diff --git a/src/libjin/utils/utils.h b/src/libjin/utils/utils.h index 1a4ef35..d597c83 100644 --- a/src/libjin/utils/utils.h +++ b/src/libjin/utils/utils.h @@ -1,12 +1,6 @@ #ifndef __JIN_UTILS_H #define __JIN_UTILS_H -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define clamp(a, mi,ma) min(max(a,mi),ma) - -#define within(a,min,max) (a >= min && a <= max) -#define without(a,min,max) (a < min || a > max) #include "macros.h" #include "endian.h" diff --git a/src/script/audio/luaopen_Source.cpp b/src/lua/audio/luaopen_Source.cpp index 2ab5d16..8ecaf7e 100644 --- a/src/script/audio/luaopen_Source.cpp +++ b/src/lua/audio/luaopen_Source.cpp @@ -1,4 +1,4 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" namespace jin { diff --git a/src/script/audio/luaopen_audio.cpp b/src/lua/audio/luaopen_audio.cpp index 78d7a69..992c3ec 100644 --- a/src/script/audio/luaopen_audio.cpp +++ b/src/lua/audio/luaopen_audio.cpp @@ -1,6 +1,6 @@ #include <SDL2/SDL.h> -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" namespace jin diff --git a/src/script/core/luaopen_core.cpp b/src/lua/core/luaopen_core.cpp index a222013..c8df1b6 100644 --- a/src/script/core/luaopen_core.cpp +++ b/src/lua/core/luaopen_core.cpp @@ -1,4 +1,4 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" namespace jin diff --git a/src/script/debug/luaopen_debug.cpp b/src/lua/debug/luaopen_debug.cpp index b33c058..b33c058 100644 --- a/src/script/debug/luaopen_debug.cpp +++ b/src/lua/debug/luaopen_debug.cpp diff --git a/src/script/embed/boot.lua b/src/lua/embed/boot.lua index 2f6fa93..2f6fa93 100644 --- a/src/script/embed/boot.lua +++ b/src/lua/embed/boot.lua diff --git a/src/script/embed/boot.lua.h b/src/lua/embed/boot.lua.h index 21c1899..21c1899 100644 --- a/src/script/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h diff --git a/src/script/embed/debug.lua b/src/lua/embed/debug.lua index 76f59ed..76f59ed 100644 --- a/src/script/embed/debug.lua +++ b/src/lua/embed/debug.lua diff --git a/src/script/embed/debug.lua.h b/src/lua/embed/debug.lua.h index 79c95ba..79c95ba 100644 --- a/src/script/embed/debug.lua.h +++ b/src/lua/embed/debug.lua.h diff --git a/src/script/embed/embed.h b/src/lua/embed/embed.h index 2ef8b75..2ef8b75 100644 --- a/src/script/embed/embed.h +++ b/src/lua/embed/embed.h diff --git a/src/script/embed/graphics.lua b/src/lua/embed/graphics.lua index 03a891d..03a891d 100644 --- a/src/script/embed/graphics.lua +++ b/src/lua/embed/graphics.lua diff --git a/src/script/embed/graphics.lua.h b/src/lua/embed/graphics.lua.h index 85cf979..85cf979 100644 --- a/src/script/embed/graphics.lua.h +++ b/src/lua/embed/graphics.lua.h diff --git a/src/script/embed/keyboard.lua b/src/lua/embed/keyboard.lua index 08214f8..08214f8 100644 --- a/src/script/embed/keyboard.lua +++ b/src/lua/embed/keyboard.lua diff --git a/src/script/embed/keyboard.lua.h b/src/lua/embed/keyboard.lua.h index 66e3c2a..66e3c2a 100644 --- a/src/script/embed/keyboard.lua.h +++ b/src/lua/embed/keyboard.lua.h diff --git a/src/script/embed/mouse.lua b/src/lua/embed/mouse.lua index 9dcd472..9dcd472 100644 --- a/src/script/embed/mouse.lua +++ b/src/lua/embed/mouse.lua diff --git a/src/script/embed/mouse.lua.h b/src/lua/embed/mouse.lua.h index f57d08c..f57d08c 100644 --- a/src/script/embed/mouse.lua.h +++ b/src/lua/embed/mouse.lua.h diff --git a/src/script/embed/path.lua b/src/lua/embed/path.lua index 5b99dd2..5b99dd2 100644 --- a/src/script/embed/path.lua +++ b/src/lua/embed/path.lua diff --git a/src/script/embed/path.lua.h b/src/lua/embed/path.lua.h index b398c99..b398c99 100644 --- a/src/script/embed/path.lua.h +++ b/src/lua/embed/path.lua.h diff --git a/src/script/event/luaopen_event.cpp b/src/lua/event/luaopen_event.cpp index 16ecbad..8a84c97 100644 --- a/src/script/event/luaopen_event.cpp +++ b/src/lua/event/luaopen_event.cpp @@ -3,7 +3,7 @@ */ #include <SDl2/SDL.h> -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" using namespace jin::input; diff --git a/src/script/filesystem/luaopen_filesystem.cpp b/src/lua/filesystem/luaopen_filesystem.cpp index 2060d40..db0216b 100644 --- a/src/script/filesystem/luaopen_filesystem.cpp +++ b/src/lua/filesystem/luaopen_filesystem.cpp @@ -1,4 +1,4 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" #include <string> diff --git a/src/script/graphics/luaopen_Canvas.cpp b/src/lua/graphics/luaopen_Canvas.cpp index 1e22772..5dede84 100644 --- a/src/script/graphics/luaopen_Canvas.cpp +++ b/src/lua/graphics/luaopen_Canvas.cpp @@ -1,5 +1,5 @@ -#include "3rdparty/luax/luax.h" -#include "../luaopen_types.h" +#include "lua/luax.h" +#include "lua/luaopen_types.h" #include "libjin/jin.h" namespace jin diff --git a/src/script/graphics/luaopen_Font.cpp b/src/lua/graphics/luaopen_Font.cpp index 82dc078..387b220 100644 --- a/src/script/graphics/luaopen_Font.cpp +++ b/src/lua/graphics/luaopen_Font.cpp @@ -1,5 +1,5 @@ -#include "3rdparty/luax/luax.h" -#include "../luaopen_types.h" +#include "lua/luax.h" +#include "lua/luaopen_types.h" #include "libjin/jin.h" using namespace jin::render; diff --git a/src/script/graphics/luaopen_Image.cpp b/src/lua/graphics/luaopen_Image.cpp index 246ea09..c5648a5 100644 --- a/src/script/graphics/luaopen_Image.cpp +++ b/src/lua/graphics/luaopen_Image.cpp @@ -1,6 +1,6 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" -#include "../luaopen_types.h" +#include "lua/luaopen_types.h" using namespace jin::render; diff --git a/src/script/graphics/luaopen_JSL.cpp b/src/lua/graphics/luaopen_JSL.cpp index d5db363..93ca5d3 100644 --- a/src/script/graphics/luaopen_JSL.cpp +++ b/src/lua/graphics/luaopen_JSL.cpp @@ -1,6 +1,6 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "libjin/jin.h" -#include "../luaopen_types.h" +#include "lua/luaopen_types.h" namespace jin { diff --git a/src/script/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp index 40bdaa1..6fa5a4d 100644 --- a/src/script/graphics/luaopen_graphics.cpp +++ b/src/lua/graphics/luaopen_graphics.cpp @@ -1,9 +1,7 @@ -#include "3rdparty/luax/luax.h" - #include "libjin/jin.h" - -#include "../luaopen_types.h" -#include "../embed/graphics.lua.h" +#include "lua/luax.h" +#include "lua/luaopen_types.h" +#include "lua/embed/graphics.lua.h" namespace jin { diff --git a/src/script/joypad/joypad.h b/src/lua/joypad/joypad.h index e8d309b..e8d309b 100644 --- a/src/script/joypad/joypad.h +++ b/src/lua/joypad/joypad.h diff --git a/src/script/joypad/luaopen_joypad.cpp b/src/lua/joypad/luaopen_joypad.cpp index 0166a57..6c98c3b 100644 --- a/src/script/joypad/luaopen_joypad.cpp +++ b/src/lua/joypad/luaopen_joypad.cpp @@ -1,5 +1,5 @@ #include "libjin/jin.h" -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" namespace jin { diff --git a/src/script/keyboard/luaopen_keyboard.cpp b/src/lua/keyboard/luaopen_keyboard.cpp index 1ec1859..ea1386c 100644 --- a/src/script/keyboard/luaopen_keyboard.cpp +++ b/src/lua/keyboard/luaopen_keyboard.cpp @@ -1,5 +1,5 @@ -#include "3rdparty/luax/luax.h" -#include "script/embed/keyboard.lua.h" +#include "lua/luax.h" +#include "lua/embed/keyboard.lua.h" namespace jin { diff --git a/src/script/luaopen_jin.cpp b/src/lua/luaopen_jin.cpp index dcf8830..93e0422 100644 --- a/src/script/luaopen_jin.cpp +++ b/src/lua/luaopen_jin.cpp @@ -1,5 +1,5 @@ #include "luaopen_jin.h" -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" // embed all lua scripts #include "embed/embed.h" diff --git a/src/script/luaopen_jin.h b/src/lua/luaopen_jin.h index 161b482..3d446a5 100644 --- a/src/script/luaopen_jin.h +++ b/src/lua/luaopen_jin.h @@ -21,7 +21,7 @@ #ifndef __JIN_M_JIN_H #define __JIN_M_JIN_H -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #define MODULE_NAME "jin" #define VERSION "0.1.0" diff --git a/src/script/luaopen_types.h b/src/lua/luaopen_types.h index bb6f5b1..bb6f5b1 100644 --- a/src/script/luaopen_types.h +++ b/src/lua/luaopen_types.h diff --git a/src/lua/luax.h b/src/lua/luax.h new file mode 100644 index 0000000..3b587d3 --- /dev/null +++ b/src/lua/luax.h @@ -0,0 +1,10 @@ +#ifndef __JIN_LUA_LUAX_H +#define __JIN_LUA_LUAX_H + +#include "3rdparty/lua51/lua.h" +#include "3rdparty/lua51/lauxlib.h" +#include "3rdparty/lua51/lualib.h" + +#include "3rdparty/luax/luax.h" + +#endif
\ No newline at end of file diff --git a/src/script/mouse/luaopen_mouse.cpp b/src/lua/mouse/luaopen_mouse.cpp index 29819e1..a013f3d 100644 --- a/src/script/mouse/luaopen_mouse.cpp +++ b/src/lua/mouse/luaopen_mouse.cpp @@ -1,4 +1,4 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "SDL2/SDL.h" namespace jin { diff --git a/src/script/net/luaopen_net.cpp b/src/lua/net/luaopen_net.cpp index 363a131..821f273 100644 --- a/src/script/net/luaopen_net.cpp +++ b/src/lua/net/luaopen_net.cpp @@ -1,7 +1,7 @@ /** * Notice: the net module is not finished yet. */ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include "3rdparty/tekcos/tekcos.h" namespace jin diff --git a/src/lua/thread/luaopen_Thread.cpp b/src/lua/thread/luaopen_Thread.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/lua/thread/luaopen_Thread.cpp diff --git a/src/script/time/luaopen_time.cpp b/src/lua/time/luaopen_time.cpp index a26be17..f7310dc 100644 --- a/src/script/time/luaopen_time.cpp +++ b/src/lua/time/luaopen_time.cpp @@ -1,4 +1,4 @@ -#include "3rdparty/luax/luax.h" +#include "lua/luax.h" #include <SDL2/SDL.h> namespace jin { diff --git a/src/main.cpp b/src/main.cpp index 4617beb..505f48c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,8 +5,8 @@ #include <direct.h> #endif -#include "3rdparty/luax/luax.h" -#include "script/luaopen_jin.h" +#include "lua/luax.h" +#include "lua/luaopen_jin.h" #include "libjin/jin.h" |