aboutsummaryrefslogtreecommitdiff
path: root/src/lua/audio/luaopen_audio.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-17 18:04:41 +0800
committerchai <chaifix@163.com>2018-05-17 18:04:41 +0800
commit34947d066b994c2ef9121a83497da344982d28e2 (patch)
tree41a65f6973a9082dafcc081a8a46de99b556370b /src/lua/audio/luaopen_audio.cpp
parentd45064be602c3becb046d86913ea8013774b0079 (diff)
v0.1.0
Diffstat (limited to 'src/lua/audio/luaopen_audio.cpp')
-rw-r--r--src/lua/audio/luaopen_audio.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lua/audio/luaopen_audio.cpp b/src/lua/audio/luaopen_audio.cpp
index 1378f89..4c9b5a7 100644
--- a/src/lua/audio/luaopen_audio.cpp
+++ b/src/lua/audio/luaopen_audio.cpp
@@ -1,3 +1,5 @@
+#include <SDL2/SDL.h>
+
#include "libs/luax/luax.h"
#include "audio/audio.h"
@@ -7,8 +9,12 @@ namespace lua
{
static int l_init(lua_State* L)
{
-
- return 0;
+ if (SDL_Init(SDL_INIT_AUDIO) < 0)
+ {
+ luax_error(L, "could not init audio");
+ luax_pushboolean(L, false);
+ return 1;
+ }
}
static int l_newSound(lua_State* L)
@@ -25,7 +31,7 @@ namespace lua
int luaopen_audio(lua_State* L)
{
-
+
return 1;
}
}