aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-28 13:47:51 +0800
committerchai <chaifix@163.com>2018-07-28 13:47:51 +0800
commitd033400614e7e2c0ff49e5100c81e937e5818e74 (patch)
tree82e011222e9d88b3f7dff239aefae4a2c100fef4 /src
parent7b7a510321112978090575e89c3dabeba9ea9f97 (diff)
*update
Diffstat (limited to 'src')
-rw-r--r--src/libjin/3rdparty/smount/smount.c2
-rw-r--r--src/libjin/Audio/Audio.cpp2
-rw-r--r--src/libjin/Audio/Audio.h6
-rw-r--r--src/libjin/Audio/SDL/SDLAudio.h2
-rw-r--r--src/libjin/Audio/SDL/SDLSource.h2
-rw-r--r--src/libjin/Audio/Source.h4
-rw-r--r--src/libjin/Common/Singleton.hpp (renamed from src/libjin/Common/Singleton.h)5
-rw-r--r--src/libjin/Common/Subsystem.hpp (renamed from src/libjin/Common/Subsystem.h)2
-rw-r--r--src/libjin/Core/Game.cpp37
-rw-r--r--src/libjin/Core/Game.h58
-rw-r--r--src/libjin/Core/Thread.h1
-rw-r--r--src/libjin/Core/Timer.h1
-rw-r--r--src/libjin/Graphics/Window.cpp11
-rw-r--r--src/libjin/Graphics/Window.h6
-rw-r--r--src/libjin/Input/Keyboard.h4
-rw-r--r--src/libjin/Input/Mouse.h2
-rw-r--r--src/libjin/Tilemap/Tilemap.cpp (renamed from src/libjin/Core/Thread.cpp)0
-rw-r--r--src/libjin/Tilemap/Tilemap.h5
-rw-r--r--src/libjin/Time/Timer.cpp (renamed from src/libjin/Core/Timer.cpp)0
-rw-r--r--src/libjin/Time/Timer.h17
-rw-r--r--src/libjin/Utils/unittest.cpp2
-rw-r--r--src/libjin/audio/audio.cpp2
-rw-r--r--src/libjin/audio/audio.h6
-rw-r--r--src/libjin/audio/source.h4
-rw-r--r--src/libjin/common/singleton.h38
-rw-r--r--src/libjin/common/subsystem.h43
-rw-r--r--src/libjin/core/game.cpp37
-rw-r--r--src/libjin/core/game.h58
-rw-r--r--src/libjin/core/thread.cpp0
-rw-r--r--src/libjin/core/thread.h1
-rw-r--r--src/libjin/core/timer.cpp0
-rw-r--r--src/libjin/core/timer.h1
-rw-r--r--src/libjin/input/keyboard.h4
-rw-r--r--src/libjin/input/mouse.h2
-rw-r--r--src/libjin/modules.h2
-rw-r--r--src/libjin/tilemap/tilemap.h5
-rw-r--r--src/libjin/utils/unittest.cpp2
-rw-r--r--src/lua/audio/luaopen_audio.cpp2
-rw-r--r--src/lua/core/luaopen_core.cpp14
-rw-r--r--src/lua/embed/boot.lua.h4
-rw-r--r--src/lua/graphics/luaopen_graphics.cpp2
41 files changed, 191 insertions, 205 deletions
diff --git a/src/libjin/3rdparty/smount/smount.c b/src/libjin/3rdparty/smount/smount.c
index c4e2ef0..3006fa3 100644
--- a/src/libjin/3rdparty/smount/smount.c
+++ b/src/libjin/3rdparty/smount/smount.c
@@ -109,7 +109,7 @@ int smtexists(smtShared* S, const char *path)
static struct stat smtgetstat(smtShared* S, const char*path)
{
char* r = concat(S->mount->path, "/", path, 0);
- struct stat s = {};
+ struct stat s = {0};
if (!r) return s;
int res = stat(r, &s);
free(r);
diff --git a/src/libjin/Audio/Audio.cpp b/src/libjin/Audio/Audio.cpp
index 363bf4d..5fb10da 100644
--- a/src/libjin/Audio/Audio.cpp
+++ b/src/libjin/Audio/Audio.cpp
@@ -1,7 +1,7 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include "audio.h"
namespace jin
diff --git a/src/libjin/Audio/Audio.h b/src/libjin/Audio/Audio.h
index faec4db..60de66d 100644
--- a/src/libjin/Audio/Audio.h
+++ b/src/libjin/Audio/Audio.h
@@ -3,10 +3,10 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include "../utils/macros.h"
-#include "../common/subsystem.h"
+#include "../common/Subsystem.hpp"
namespace jin
{
@@ -43,4 +43,4 @@ namespace audio
}
#endif // JIN_MODULES_AUDIO
-#endif \ No newline at end of file
+#endif // __JIN_AUDIO_H \ No newline at end of file
diff --git a/src/libjin/Audio/SDL/SDLAudio.h b/src/libjin/Audio/SDL/SDLAudio.h
index 4c9ab34..bac4544 100644
--- a/src/libjin/Audio/SDL/SDLAudio.h
+++ b/src/libjin/Audio/SDL/SDLAudio.h
@@ -59,8 +59,6 @@ namespace audio
};
- typedef SDLAudio::Setting SDLAudioSetting;
-
}
}
diff --git a/src/libjin/Audio/SDL/SDLSource.h b/src/libjin/Audio/SDL/SDLSource.h
index 38f7ec4..5c6aefc 100644
--- a/src/libjin/Audio/SDL/SDLSource.h
+++ b/src/libjin/Audio/SDL/SDLSource.h
@@ -113,4 +113,4 @@ namespace audio
}
#endif // JIN_MODULES_AUDIO && JIN_AUDIO_SDLAUDIO
-#endif \ No newline at end of file
+#endif // __JIN_SOURCE_SDL_H \ No newline at end of file
diff --git a/src/libjin/Audio/Source.h b/src/libjin/Audio/Source.h
index 5b9c12b..3abe7de 100644
--- a/src/libjin/Audio/Source.h
+++ b/src/libjin/Audio/Source.h
@@ -3,7 +3,7 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
namespace jin
{
@@ -48,4 +48,4 @@ namespace audio
}
#endif // JIN_MODULES_AUDIO
-#endif \ No newline at end of file
+#endif // __JIN_AUDIO_SOURCE_H \ No newline at end of file
diff --git a/src/libjin/Common/Singleton.h b/src/libjin/Common/Singleton.hpp
index ff8a9ce..c3ce467 100644
--- a/src/libjin/Common/Singleton.h
+++ b/src/libjin/Common/Singleton.hpp
@@ -21,11 +21,10 @@ namespace jin
protected:
Singleton() {};
virtual ~Singleton() {};
+ static T* _instance;
private:
Singleton(const Singleton&);
Singleton& operator = (const Singleton&);
-
- static T* _instance;
};
template<class T> T* Singleton<T>::_instance = nullptr;
@@ -35,4 +34,4 @@ namespace jin
} // jin
-#endif \ No newline at end of file
+#endif // __JIN_SINGLETON_H \ No newline at end of file
diff --git a/src/libjin/Common/Subsystem.h b/src/libjin/Common/Subsystem.hpp
index 8a4ecf6..f4e270b 100644
--- a/src/libjin/Common/Subsystem.h
+++ b/src/libjin/Common/Subsystem.hpp
@@ -1,7 +1,7 @@
#ifndef __JIN_COMMON_SUBSYSTEM_H
#define __JIN_COMMON_SUBSYSTEM_H
-#include "singleton.h"
+#include "singleton.hpp"
#include "../utils/macros.h"
namespace jin
diff --git a/src/libjin/Core/Game.cpp b/src/libjin/Core/Game.cpp
index 2090d64..f2223b2 100644
--- a/src/libjin/Core/Game.cpp
+++ b/src/libjin/Core/Game.cpp
@@ -1,17 +1,46 @@
#include "game.h"
+#include "../Time/Timer.h"
+#include "../input/Event.h"
namespace jin
{
namespace core
{
- Game::Game() :_run(true) {};
+ using namespace jin::input;
+
+ Game::Game() :_running(true) {};
void Game::run()
{
+ _running = true;
+ Event e;
+ while (_running)
+ {
+ while (jin::input::pollEvent(&e))
+ {
+ if (_instance != nullptr && _onEvent)
+ _onEvent(&e);
+ }
+ if (!_running)
+ break;
+ }
+ }
+
+ bool Game::initSystem(const SettingBase* setting)
+ {
+ if (setting == nullptr)
+ return false;
+ Game::Setting* s = (Game::Setting*) setting;
+ _onEvent = s->eventHandler;
+ _onUpdate = s->updater;
+ _onDraw = s->drawer;
+ return true;
+ }
+ void Game::quitSystem()
+ {
}
-
-}
-}
+} // core
+} // jin \ No newline at end of file
diff --git a/src/libjin/Core/Game.h b/src/libjin/Core/Game.h
index becb780..e9d0340 100644
--- a/src/libjin/Core/Game.h
+++ b/src/libjin/Core/Game.h
@@ -1,40 +1,35 @@
#ifndef __JIN_CORE_GAME_H
#define __JIN_CORE_GAME_H
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
-#include "../common/singleton.h"
+#include "../Common/Subsystem.hpp"
#include "../utils/macros.h"
+#include "../Input/Event.h"
namespace jin
{
namespace core
{
- class Game : public Singleton<Game>
+
+ class Game : public Subsystem<Game>
{
public:
- struct Setting
- {
+ typedef void(*onEvent)(jin::input::Event* e);
+ typedef void(*onUpdate)(float dt);
+ typedef void(*onDraw)();
- };
-
- inline void quit()
+ struct Setting : SettingBase
{
- CALLONCE(_quit());
- }
-
- inline bool running()
- {
- return run;
- }
-
- inline void exit()
- {
- CALLONCE(_exit());
- }
+ onEvent eventHandler;
+ onUpdate updater;
+ onDraw drawer;
+ };
void run();
+ inline void stop() { _running = false; };
+ bool running() { return _running; };
private:
@@ -43,19 +38,18 @@ namespace core
SINGLETON(Game);
- bool _run;
+ onEvent _onEvent;
+ onUpdate _onUpdate;
+ onDraw _onDraw;
- inline void _exit()
- {
- SDL_Quit();
- }
+ bool _running;
+
+ onlyonce bool initSystem(const SettingBase* setting);
+ onlyonce void quitSystem();
- inline void _quit()
- {
- _run = false;
- }
};
-}
-}
-#endif \ No newline at end of file
+} // core
+} // jin
+
+#endif // __JIN_CORE_GAME_H \ No newline at end of file
diff --git a/src/libjin/Core/Thread.h b/src/libjin/Core/Thread.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/Core/Thread.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/Core/Timer.h b/src/libjin/Core/Timer.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/Core/Timer.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/Window.cpp
index 2d0fa82..28e5b84 100644
--- a/src/libjin/Graphics/Window.cpp
+++ b/src/libjin/Graphics/Window.cpp
@@ -14,14 +14,14 @@ namespace jin
namespace graphics
{
- onlyonce bool WindowSystem::initSystem(const SettingBase* s)
+ bool WindowSystem::initSystem(const SettingBase* s)
{
Loghelper::log(Loglevel::LV_INFO, "Init window system");
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return false;
- const WindowSetting* setting = (WindowSetting*)s;
+ const Setting* setting = (Setting*)s;
width = setting->width;
height = setting->height;
@@ -73,9 +73,10 @@ namespace graphics
return true;
}
- onlyonce void WindowSystem::quitSystem()
+ void WindowSystem::quitSystem()
{
SDL_DestroyWindow(wnd);
+ SDL_Quit();
}
inline void WindowSystem::swapBuffers()
@@ -84,7 +85,7 @@ namespace graphics
SDL_GL_SwapWindow(wnd);
}
-}
-}
+} // graphics
+} // jin
#endif // JIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Window.h b/src/libjin/Graphics/Window.h
index 893fdb8..6213cee 100644
--- a/src/libjin/Graphics/Window.h
+++ b/src/libjin/Graphics/Window.h
@@ -3,9 +3,9 @@
#include "../modules.h"
#if JIN_MODULES_RENDER
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include "../utils/utils.h"
-#include "../common/subsystem.h"
+#include "../common/Subsystem.hpp"
namespace jin
{
@@ -51,8 +51,6 @@ namespace graphics
onlyonce void quitSystem() override;
};
- typedef WindowSystem::Setting WindowSetting;
-
} // render
} // jin
diff --git a/src/libjin/Input/Keyboard.h b/src/libjin/Input/Keyboard.h
index bbb6456..3e78ab1 100644
--- a/src/libjin/Input/Keyboard.h
+++ b/src/libjin/Input/Keyboard.h
@@ -1,5 +1,6 @@
#ifndef __JIN_KEYBOARD_H
#define __JIN_KEYBOARD_H
+
namespace jin
{
namespace input
@@ -10,4 +11,5 @@ namespace input
};
}
}
-#endif \ No newline at end of file
+
+#endif // __JIN_KEYBOARD_H \ No newline at end of file
diff --git a/src/libjin/Input/Mouse.h b/src/libjin/Input/Mouse.h
index cb70407..5fc6b47 100644
--- a/src/libjin/Input/Mouse.h
+++ b/src/libjin/Input/Mouse.h
@@ -3,7 +3,7 @@
#include "../modules.h"
#ifdef JIN_MODULES_INPUT
-#include "../Common/Singleton.h"
+#include "../Common/Singleton.hpp"
namespace jin
{
diff --git a/src/libjin/Core/Thread.cpp b/src/libjin/Tilemap/Tilemap.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Core/Thread.cpp
+++ b/src/libjin/Tilemap/Tilemap.cpp
diff --git a/src/libjin/Tilemap/Tilemap.h b/src/libjin/Tilemap/Tilemap.h
index 27cbe51..a2bce62 100644
--- a/src/libjin/Tilemap/Tilemap.h
+++ b/src/libjin/Tilemap/Tilemap.h
@@ -1,5 +1,7 @@
#ifndef __JIN_TILEMAP_H
#define __JIN_TILEMAP_H
+#include "../modules.h"
+#if JIN_MODULES_TILEMAP
namespace jin
{
@@ -11,4 +13,5 @@ namespace tilemap
}// tilemap
}// jin
-#endif \ No newline at end of file
+#endif // JIN_MODULES_TILEMAP
+#endif // __JIN_TILEMAP_H \ No newline at end of file
diff --git a/src/libjin/Core/Timer.cpp b/src/libjin/Time/Timer.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Core/Timer.cpp
+++ b/src/libjin/Time/Timer.cpp
diff --git a/src/libjin/Time/Timer.h b/src/libjin/Time/Timer.h
new file mode 100644
index 0000000..1742306
--- /dev/null
+++ b/src/libjin/Time/Timer.h
@@ -0,0 +1,17 @@
+#ifndef __JIN_TIMER_H
+#define __JIN_TIMER_H
+#include "../modules.h"
+#if JIN_MODULES_TIME
+
+namespace jin
+{
+namespace time
+{
+
+
+
+}
+}
+
+#endif // JIN_MODULES_TIME
+#endif // __JIN_TIMER_H \ No newline at end of file
diff --git a/src/libjin/Utils/unittest.cpp b/src/libjin/Utils/unittest.cpp
index 2952b0b..44f1ae5 100644
--- a/src/libjin/Utils/unittest.cpp
+++ b/src/libjin/Utils/unittest.cpp
@@ -33,7 +33,7 @@ int main(int argc, char* argv[])
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include <3rdparty/cmixer/cmixer.h>
diff --git a/src/libjin/audio/audio.cpp b/src/libjin/audio/audio.cpp
index 363bf4d..5fb10da 100644
--- a/src/libjin/audio/audio.cpp
+++ b/src/libjin/audio/audio.cpp
@@ -1,7 +1,7 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include "audio.h"
namespace jin
diff --git a/src/libjin/audio/audio.h b/src/libjin/audio/audio.h
index faec4db..60de66d 100644
--- a/src/libjin/audio/audio.h
+++ b/src/libjin/audio/audio.h
@@ -3,10 +3,10 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include "../utils/macros.h"
-#include "../common/subsystem.h"
+#include "../common/Subsystem.hpp"
namespace jin
{
@@ -43,4 +43,4 @@ namespace audio
}
#endif // JIN_MODULES_AUDIO
-#endif \ No newline at end of file
+#endif // __JIN_AUDIO_H \ No newline at end of file
diff --git a/src/libjin/audio/source.h b/src/libjin/audio/source.h
index 5b9c12b..3abe7de 100644
--- a/src/libjin/audio/source.h
+++ b/src/libjin/audio/source.h
@@ -3,7 +3,7 @@
#include "../modules.h"
#if JIN_MODULES_AUDIO
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
namespace jin
{
@@ -48,4 +48,4 @@ namespace audio
}
#endif // JIN_MODULES_AUDIO
-#endif \ No newline at end of file
+#endif // __JIN_AUDIO_SOURCE_H \ No newline at end of file
diff --git a/src/libjin/common/singleton.h b/src/libjin/common/singleton.h
deleted file mode 100644
index ff8a9ce..0000000
--- a/src/libjin/common/singleton.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __JIN_SINGLETON_H
-#define __JIN_SINGLETON_H
-
-namespace jin
-{
- template<class T>
- class Singleton
- {
- public:
- static T* get()
- {
- if (_instance == nullptr)
- _instance = new T;
- return _instance;
- }
- static void destroy()
- {
- delete _instance;
- _instance = nullptr;
- }
- protected:
- Singleton() {};
- virtual ~Singleton() {};
- private:
- Singleton(const Singleton&);
- Singleton& operator = (const Singleton&);
-
- static T* _instance;
- };
-
- template<class T> T* Singleton<T>::_instance = nullptr;
-
-#define SINGLETON(T) \
- friend Singleton<T>
-
-} // jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/common/subsystem.h b/src/libjin/common/subsystem.h
deleted file mode 100644
index 8a4ecf6..0000000
--- a/src/libjin/common/subsystem.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __JIN_COMMON_SUBSYSTEM_H
-#define __JIN_COMMON_SUBSYSTEM_H
-
-#include "singleton.h"
-#include "../utils/macros.h"
-
-namespace jin
-{
-
- template<class System>
- class Subsystem : public Singleton<System>
- {
- public:
- struct Setting {};
- typedef Setting SettingBase;
-
- bool init(const SettingBase* setting)
- {
- static bool success = initSystem(setting);
- return success;
- }
-
- void quit()
- {
- CALLONCE(quitSystem());
- destroy();
- }
-
- protected:
-
- Subsystem() {};
- virtual ~Subsystem() {};
-
- SINGLETON(System);
-
- virtual onlyonce bool initSystem(const Setting* setting) = 0;
- virtual onlyonce void quitSystem() = 0;
-
- };
-
-} // jin
-
-#endif \ No newline at end of file
diff --git a/src/libjin/core/game.cpp b/src/libjin/core/game.cpp
index 2090d64..f2223b2 100644
--- a/src/libjin/core/game.cpp
+++ b/src/libjin/core/game.cpp
@@ -1,17 +1,46 @@
#include "game.h"
+#include "../Time/Timer.h"
+#include "../input/Event.h"
namespace jin
{
namespace core
{
- Game::Game() :_run(true) {};
+ using namespace jin::input;
+
+ Game::Game() :_running(true) {};
void Game::run()
{
+ _running = true;
+ Event e;
+ while (_running)
+ {
+ while (jin::input::pollEvent(&e))
+ {
+ if (_instance != nullptr && _onEvent)
+ _onEvent(&e);
+ }
+ if (!_running)
+ break;
+ }
+ }
+
+ bool Game::initSystem(const SettingBase* setting)
+ {
+ if (setting == nullptr)
+ return false;
+ Game::Setting* s = (Game::Setting*) setting;
+ _onEvent = s->eventHandler;
+ _onUpdate = s->updater;
+ _onDraw = s->drawer;
+ return true;
+ }
+ void Game::quitSystem()
+ {
}
-
-}
-}
+} // core
+} // jin \ No newline at end of file
diff --git a/src/libjin/core/game.h b/src/libjin/core/game.h
index becb780..e9d0340 100644
--- a/src/libjin/core/game.h
+++ b/src/libjin/core/game.h
@@ -1,40 +1,35 @@
#ifndef __JIN_CORE_GAME_H
#define __JIN_CORE_GAME_H
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
-#include "../common/singleton.h"
+#include "../Common/Subsystem.hpp"
#include "../utils/macros.h"
+#include "../Input/Event.h"
namespace jin
{
namespace core
{
- class Game : public Singleton<Game>
+
+ class Game : public Subsystem<Game>
{
public:
- struct Setting
- {
+ typedef void(*onEvent)(jin::input::Event* e);
+ typedef void(*onUpdate)(float dt);
+ typedef void(*onDraw)();
- };
-
- inline void quit()
+ struct Setting : SettingBase
{
- CALLONCE(_quit());
- }
-
- inline bool running()
- {
- return run;
- }
-
- inline void exit()
- {
- CALLONCE(_exit());
- }
+ onEvent eventHandler;
+ onUpdate updater;
+ onDraw drawer;
+ };
void run();
+ inline void stop() { _running = false; };
+ bool running() { return _running; };
private:
@@ -43,19 +38,18 @@ namespace core
SINGLETON(Game);
- bool _run;
+ onEvent _onEvent;
+ onUpdate _onUpdate;
+ onDraw _onDraw;
- inline void _exit()
- {
- SDL_Quit();
- }
+ bool _running;
+
+ onlyonce bool initSystem(const SettingBase* setting);
+ onlyonce void quitSystem();
- inline void _quit()
- {
- _run = false;
- }
};
-}
-}
-#endif \ No newline at end of file
+} // core
+} // jin
+
+#endif // __JIN_CORE_GAME_H \ No newline at end of file
diff --git a/src/libjin/core/thread.cpp b/src/libjin/core/thread.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/core/thread.cpp
+++ /dev/null
diff --git a/src/libjin/core/thread.h b/src/libjin/core/thread.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/core/thread.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/core/timer.cpp b/src/libjin/core/timer.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/core/timer.cpp
+++ /dev/null
diff --git a/src/libjin/core/timer.h b/src/libjin/core/timer.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/core/timer.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/input/keyboard.h b/src/libjin/input/keyboard.h
index bbb6456..3e78ab1 100644
--- a/src/libjin/input/keyboard.h
+++ b/src/libjin/input/keyboard.h
@@ -1,5 +1,6 @@
#ifndef __JIN_KEYBOARD_H
#define __JIN_KEYBOARD_H
+
namespace jin
{
namespace input
@@ -10,4 +11,5 @@ namespace input
};
}
}
-#endif \ No newline at end of file
+
+#endif // __JIN_KEYBOARD_H \ No newline at end of file
diff --git a/src/libjin/input/mouse.h b/src/libjin/input/mouse.h
index cb70407..5fc6b47 100644
--- a/src/libjin/input/mouse.h
+++ b/src/libjin/input/mouse.h
@@ -3,7 +3,7 @@
#include "../modules.h"
#ifdef JIN_MODULES_INPUT
-#include "../Common/Singleton.h"
+#include "../Common/Singleton.hpp"
namespace jin
{
diff --git a/src/libjin/modules.h b/src/libjin/modules.h
index 34c1d11..48b71c9 100644
--- a/src/libjin/modules.h
+++ b/src/libjin/modules.h
@@ -33,4 +33,6 @@
#define JIN_MODULES_THREAD 1
+#define JIN_MODULES_TIME 1
+
#endif \ No newline at end of file
diff --git a/src/libjin/tilemap/tilemap.h b/src/libjin/tilemap/tilemap.h
index 27cbe51..a2bce62 100644
--- a/src/libjin/tilemap/tilemap.h
+++ b/src/libjin/tilemap/tilemap.h
@@ -1,5 +1,7 @@
#ifndef __JIN_TILEMAP_H
#define __JIN_TILEMAP_H
+#include "../modules.h"
+#if JIN_MODULES_TILEMAP
namespace jin
{
@@ -11,4 +13,5 @@ namespace tilemap
}// tilemap
}// jin
-#endif \ No newline at end of file
+#endif // JIN_MODULES_TILEMAP
+#endif // __JIN_TILEMAP_H \ No newline at end of file
diff --git a/src/libjin/utils/unittest.cpp b/src/libjin/utils/unittest.cpp
index 2952b0b..44f1ae5 100644
--- a/src/libjin/utils/unittest.cpp
+++ b/src/libjin/utils/unittest.cpp
@@ -33,7 +33,7 @@ int main(int argc, char* argv[])
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <SDL2/SDL.h>
+#include "SDL2/SDL.h"
#include <3rdparty/cmixer/cmixer.h>
diff --git a/src/lua/audio/luaopen_audio.cpp b/src/lua/audio/luaopen_audio.cpp
index 73c5bea..9a6bade 100644
--- a/src/lua/audio/luaopen_audio.cpp
+++ b/src/lua/audio/luaopen_audio.cpp
@@ -9,7 +9,7 @@ namespace lua
static int l_init(lua_State* L)
{
- SDLAudioSetting setting;
+ SDLAudio::Setting setting;
if (! SDLAudio::get()->init(&setting))
{
luax_error(L, "could not init audio");
diff --git a/src/lua/core/luaopen_core.cpp b/src/lua/core/luaopen_core.cpp
index 0e79ff5..d20a3bc 100644
--- a/src/lua/core/luaopen_core.cpp
+++ b/src/lua/core/luaopen_core.cpp
@@ -15,22 +15,22 @@ namespace lua
return 1;
}
- static int l_quit(lua_State* L)
+ static int l_stop(lua_State* L)
{
- Game::get()->quit();
+ Game::get()->stop();
return 0;
}
- static int l_exit(lua_State* L)
+ static int l_quit(lua_State* L)
{
- Game::get()->exit();
+ Game::get()->quit();
return 0;
}
-
+
static const luaL_Reg f[] = {
{"running", l_running},
- {"quit", l_quit}, // for end game loop
- {"exit", l_exit}, // for exit whole game
+ {"stop", l_stop}, // for end game loop
+ {"quit", l_quit}, // for exit whole game
{0, 0}
};
diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h
index 2a9cfc5..c1d22a3 100644
--- a/src/lua/embed/boot.lua.h
+++ b/src/lua/embed/boot.lua.h
@@ -117,7 +117,7 @@ local function onError(msg)
print("Error:\n" .. msg)
function jin.core.onEvent(e)
if e.type == 'quit' then
- jin.core.quit()
+ jin.core.stop()
end
end
local ww, wh = jin.graphics.size()
@@ -150,7 +150,7 @@ local function main()
-- quit subsystems
jin.graphics.destroy()
-- exit whole game
- jin.core.exit()
+ jin.core.quit()
end
main()
diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp
index 42586a5..2d1ff57 100644
--- a/src/lua/graphics/luaopen_graphics.cpp
+++ b/src/lua/graphics/luaopen_graphics.cpp
@@ -28,7 +28,7 @@ namespace lua
static int l_init(lua_State* L)
{
WindowSystem* wnd = WindowSystem::get();
- WindowSetting setting;
+ WindowSystem::Setting setting;
setting.width = luax_getfield_integer(L, 1, "width");
setting.height = luax_getfield_integer(L, 1, "height");
setting.title = luax_getfield_string(L, 1, "title");