aboutsummaryrefslogtreecommitdiff
path: root/src/sdl/system.c
diff options
context:
space:
mode:
authorptitSeb2017-11-30 22:49:38 +0100
committerptitSeb2017-11-30 22:49:38 +0100
commitde29b11a88dbdd3af0824e59b51528b91ee73c54 (patch)
treee1aabf8752043998663279fae4359a18c4b4af07 /src/sdl/system.c
parentd87f450f51372ddf013e6bac09f1ef588e6f8bea (diff)
downloadhydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.gz
hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.bz2
hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.zip
First commit. Version works on Linux (keyboard only, not configurable)
Diffstat (limited to 'src/sdl/system.c')
-rw-r--r--src/sdl/system.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/sdl/system.c b/src/sdl/system.c
new file mode 100644
index 0000000..7e27d05
--- /dev/null
+++ b/src/sdl/system.c
@@ -0,0 +1,43 @@
+#include <SDL/SDL.h>
+#include "system.h"
+
+
+char quitGame = 0;
+
+void Input_KeyEvent(SDL_Event* evt);
+
+int PHL_MainLoop()
+{
+ SDL_Event evt;
+ while(SDL_PollEvent(&evt))
+ {
+ switch(evt.type)
+ {
+ case SDL_QUIT:
+ return 0;
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+ Input_KeyEvent(&evt);
+ break;
+ //TODO: joystick...
+ }
+ }
+ if (quitGame == 1)
+ {
+ return 0;
+ }
+ return 1;
+}
+void PHL_ConsoleInit()
+{
+
+}
+void PHL_GameQuit()
+{
+ quitGame = 1;
+}
+
+void PHL_ErrorScreen(char* message)
+{
+ fprintf(stderr, "%s\n", message);
+}