Kaynağa Gözat

marmalade fixes

dmuratshin 9 yıl önce
ebeveyn
işleme
b02fa91bd9
3 değiştirilmiş dosya ile 45 ekleme ve 10 silme
  1. 0 3
      oxygine/marmalade/oxygine-framework.mkf
  2. 29 5
      oxygine/src/key.cpp
  3. 16 2
      oxygine/src/key.h

+ 0 - 3
oxygine/marmalade/oxygine-framework.mkf

@@ -9,9 +9,6 @@ subproject iwutil
 subproject iwgl
 subproject iwhttp
 
-debug_define MARMALADE
-define MARMALADE
-
 define OX_HAVE_LIBJPEG
 define OX_HAVE_LIBPNG
 

+ 29 - 5
oxygine/src/key.cpp

@@ -1,5 +1,10 @@
 #include "key.h"
-#include "SDL.h"
+#ifdef __S3E__
+#   include "s3eKeyboard.h"
+#else
+#   include "SDL_keyboard.h"
+#endif
+
 #include <algorithm>
 
 namespace oxygine
@@ -27,6 +32,9 @@ namespace oxygine
 
         void update()
         {
+#ifdef __S3E__
+#else
+
             if (!_counter)
                 return;
 
@@ -34,27 +42,43 @@ namespace oxygine
             const Uint8* data = SDL_GetKeyboardState(&num);
             num = std::min(num, KEYS);
             memcpy(_keys, data, num);
+#endif
         }
 
 
-        bool wasPressed(keycode k)
+        bool wasPressed(keycode key)
         {
+
+#ifdef __S3E__
+            return s3eKeyboardGetState((s3eKey)key) & S3E_KEY_STATE_PRESSED;
+#else
             OX_ASSERT(_counter);
             const Uint8* data = SDL_GetKeyboardState(0);
-            return data[k] && !_keys[k];
+            return data[key] && !_keys[key];
+#endif
         }
 
         bool wasReleased(keycode key)
         {
+
+#ifdef __S3E__
+            return s3eKeyboardGetState((s3eKey)key) & S3E_KEY_STATE_RELEASED;
+#else
             OX_ASSERT(_counter);
             const Uint8* data = SDL_GetKeyboardState(0);
             return !data[key] && _keys[key];
+#endif
         }
 
-        bool isPressed(keycode k)
+        bool isPressed(keycode key)
         {
+
+#ifdef __S3E__
+            return s3eKeyboardGetState((s3eKey)key) & S3E_KEY_STATE_DOWN;
+#else
             const Uint8* data = SDL_GetKeyboardState(0);
-            return data[k] != 0;
+            return data[key] != 0;
+#endif
         }
     }
 }

+ 16 - 2
oxygine/src/key.h

@@ -1,6 +1,9 @@
 #pragma once
 #include "oxygine_include.h"
-#include "SDL_keyboard.h"
+#ifdef __S3E__
+#else
+#   include "SDL_keyboard.h"
+#endif
 namespace oxygine
 {
     namespace key
@@ -10,10 +13,21 @@ namespace oxygine
         void init();
         void release();
 
+        /**
+        * Indicates a key's state has changed from up to down in the last update.
+        */
         bool wasPressed(keycode);
+
+        /**
+        * Indicates a key's state has changed from down to up in the last update.
+        */
         bool wasReleased(keycode);
 
-        /*could be used without key::init()**/
+
+        /**
+        * Indicates a key is currently pressed down.
+        * could be used without key::init()
+        */
         bool isPressed(keycode);
     }
 }