소스 검색

Updated to new SDL 2.0.

Lasse Öörni 12 년 전
부모
커밋
17d990098c
100개의 변경된 파일8323개의 추가작업 그리고 3784개의 파일을 삭제
  1. 2 0
      Android/jni/Android.mk
  2. 478 354
      Android/src/org/libsdl/app/SDLActivity.java
  3. 10 7
      Engine/Graphics/CMakeLists.txt
  4. 77 139
      Engine/Input/Input.cpp
  5. 1 1
      Engine/Input/Input.h
  6. 16 18
      ThirdParty/SDL/BUGS.txt
  7. 13 11
      ThirdParty/SDL/CMakeLists.txt
  8. 20 19
      ThirdParty/SDL/COPYING.txt
  9. 70 73
      ThirdParty/SDL/CREDITS.txt
  10. 0 27
      ThirdParty/SDL/INSTALL
  11. 40 0
      ThirdParty/SDL/INSTALL.txt
  12. 13 13
      ThirdParty/SDL/README-SDL.txt
  13. 39 45
      ThirdParty/SDL/README.txt
  14. 15 16
      ThirdParty/SDL/TODO.txt
  15. 0 1
      ThirdParty/SDL/UNDER_CONSTRUCTION.txt
  16. 28 30
      ThirdParty/SDL/include/SDL.h
  17. 6 10
      ThirdParty/SDL/include/SDL_assert.h
  18. 22 28
      ThirdParty/SDL/include/SDL_atomic.h
  19. 60 68
      ThirdParty/SDL/include/SDL_audio.h
  20. 90 0
      ThirdParty/SDL/include/SDL_bits.h
  21. 2 6
      ThirdParty/SDL/include/SDL_blendmode.h
  22. 1 5
      ThirdParty/SDL/include/SDL_clipboard.h
  23. 1 5
      ThirdParty/SDL/include/SDL_config.h
  24. 83 82
      ThirdParty/SDL/include/SDL_config_android.h
  25. 80 82
      ThirdParty/SDL/include/SDL_config_iphoneos.h
  26. 116 9
      ThirdParty/SDL/include/SDL_config_linux.h
  27. 112 78
      ThirdParty/SDL/include/SDL_config_macosx.h
  28. 17 13
      ThirdParty/SDL/include/SDL_config_minimal.h
  29. 2 3
      ThirdParty/SDL/include/SDL_config_pandora.h
  30. 136 0
      ThirdParty/SDL/include/SDL_config_psp.h
  31. 30 31
      ThirdParty/SDL/include/SDL_config_windows.h
  32. 2 2
      ThirdParty/SDL/include/SDL_config_wiz.h
  33. 1 1
      ThirdParty/SDL/include/SDL_copying.h
  34. 3 7
      ThirdParty/SDL/include/SDL_cpuinfo.h
  35. 36 45
      ThirdParty/SDL/include/SDL_endian.h
  36. 11 12
      ThirdParty/SDL/include/SDL_error.h
  37. 720 669
      ThirdParty/SDL/include/SDL_events.h
  38. 294 0
      ThirdParty/SDL/include/SDL_gamecontroller.h
  39. 2 6
      ThirdParty/SDL/include/SDL_gesture.h
  40. 175 180
      ThirdParty/SDL/include/SDL_haptic.h
  41. 108 14
      ThirdParty/SDL/include/SDL_hints.h
  42. 75 34
      ThirdParty/SDL/include/SDL_joystick.h
  43. 59 27
      ThirdParty/SDL/include/SDL_keyboard.h
  44. 9 9
      ThirdParty/SDL/include/SDL_keycode.h
  45. 2 6
      ThirdParty/SDL/include/SDL_loadso.h
  46. 7 7
      ThirdParty/SDL/include/SDL_log.h
  47. 37 13
      ThirdParty/SDL/include/SDL_main.h
  48. 144 0
      ThirdParty/SDL/include/SDL_messagebox.h
  49. 63 52
      ThirdParty/SDL/include/SDL_mouse.h
  50. 33 30
      ThirdParty/SDL/include/SDL_mutex.h
  51. 1 1
      ThirdParty/SDL/include/SDL_name.h
  52. 10 16
      ThirdParty/SDL/include/SDL_opengl.h
  53. 2 2
      ThirdParty/SDL/include/SDL_opengles.h
  54. 2 2
      ThirdParty/SDL/include/SDL_opengles2.h
  55. 28 30
      ThirdParty/SDL/include/SDL_pixels.h
  56. 23 29
      ThirdParty/SDL/include/SDL_platform.h
  57. 5 9
      ThirdParty/SDL/include/SDL_power.h
  58. 5 5
      ThirdParty/SDL/include/SDL_quit.h
  59. 15 14
      ThirdParty/SDL/include/SDL_rect.h
  60. 300 112
      ThirdParty/SDL/include/SDL_render.h
  61. 48 32
      ThirdParty/SDL/include/SDL_rwops.h
  62. 60 57
      ThirdParty/SDL/include/SDL_scancode.h
  63. 24 28
      ThirdParty/SDL/include/SDL_shape.h
  64. 423 350
      ThirdParty/SDL/include/SDL_stdinc.h
  65. 87 84
      ThirdParty/SDL/include/SDL_surface.h
  66. 105 0
      ThirdParty/SDL/include/SDL_system.h
  67. 9 13
      ThirdParty/SDL/include/SDL_syswm.h
  68. 68 0
      ThirdParty/SDL/include/SDL_test.h
  69. 105 0
      ThirdParty/SDL/include/SDL_test_assert.h
  70. 186 0
      ThirdParty/SDL/include/SDL_test_common.h
  71. 69 0
      ThirdParty/SDL/include/SDL_test_compare.h
  72. 124 0
      ThirdParty/SDL/include/SDL_test_crc32.h
  73. 62 0
      ThirdParty/SDL/include/SDL_test_font.h
  74. 384 0
      ThirdParty/SDL/include/SDL_test_fuzzer.h
  75. 123 0
      ThirdParty/SDL/include/SDL_test_harness.h
  76. 78 0
      ThirdParty/SDL/include/SDL_test_images.h
  77. 67 0
      ThirdParty/SDL/include/SDL_test_log.h
  78. 129 0
      ThirdParty/SDL/include/SDL_test_md5.h
  79. 115 0
      ThirdParty/SDL/include/SDL_test_random.h
  80. 10 26
      ThirdParty/SDL/include/SDL_thread.h
  81. 4 8
      ThirdParty/SDL/include/SDL_timer.h
  82. 24 62
      ThirdParty/SDL/include/SDL_touch.h
  83. 2 2
      ThirdParty/SDL/include/SDL_types.h
  84. 24 28
      ThirdParty/SDL/include/SDL_version.h
  85. 232 128
      ThirdParty/SDL/include/SDL_video.h
  86. 17 15
      ThirdParty/SDL/include/begin_code.h
  87. 2 2
      ThirdParty/SDL/include/close_code.h
  88. 1555 0
      ThirdParty/SDL/include/doxyfile
  89. 201 88
      ThirdParty/SDL/src/SDL.c
  90. 83 191
      ThirdParty/SDL/src/SDL_assert.c
  91. 1 1
      ThirdParty/SDL/src/SDL_assert_c.h
  92. 15 19
      ThirdParty/SDL/src/SDL_error.c
  93. 3 3
      ThirdParty/SDL/src/SDL_error_c.h
  94. 1 104
      ThirdParty/SDL/src/SDL_fatal.c
  95. 1 1
      ThirdParty/SDL/src/SDL_fatal.h
  96. 5 6
      ThirdParty/SDL/src/SDL_hints.c
  97. 4 4
      ThirdParty/SDL/src/SDL_hints_c.h
  98. 102 7
      ThirdParty/SDL/src/SDL_log.c
  99. 10 8
      ThirdParty/SDL/src/atomic/SDL_atomic.c
  100. 9 9
      ThirdParty/SDL/src/atomic/SDL_spinlock.c

+ 2 - 0
Android/jni/Android.mk

@@ -187,6 +187,8 @@ LOCAL_SRC_FILES := \
     $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
     $(wildcard $(LOCAL_PATH)/src/events/*.c) \
     $(wildcard $(LOCAL_PATH)/src/file/*.c) \
+    $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
+    $(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
     $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
     $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
     $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \

+ 478 - 354
Android/src/org/libsdl/app/SDLActivity.java

@@ -5,159 +5,200 @@ package org.libsdl.app;
 import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.egl.EGLContext;
-import javax.microedition.khronos.opengles.GL10;
-import javax.microedition.khronos.egl.*;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
 
 import android.app.*;
 import android.content.*;
 import android.view.*;
+import android.view.inputmethod.BaseInputConnection;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputConnection;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.AbsoluteLayout;
 import android.os.*;
 import android.util.Log;
 import android.graphics.*;
-import android.text.method.*;
-import android.text.*;
 import android.media.*;
 import android.hardware.*;
-import android.content.*;
-import android.content.res.*;
 
-import java.lang.*;
 
 /**
     SDL Activity
 */
-public class SDLActivity extends Activity 
-{
+public class SDLActivity extends Activity {
+    private static final String TAG = "SDL";
+
+    // Keep track of the paused state
+    public static boolean mIsPaused = false;
+
     // Main components
-    private static SDLActivity mSingleton;
-    private static SDLSurface mSurface;
+    protected static SDLActivity mSingleton;
+    protected static SDLSurface mSurface;
+    protected static View mTextEdit;
+    protected static ViewGroup mLayout;
 
     // This is what SDL runs in. It invokes SDL_main(), eventually
-    private static Thread mSDLThread;
+    protected static Thread mSDLThread;
 
     // Audio
-    private static Thread mAudioThread;
-    private static AudioTrack mAudioTrack;
-
-    // EGL private objects
-    private EGLContext  mEGLContext;
-    private EGLSurface  mEGLSurface;
-    private EGLDisplay  mEGLDisplay;
-    private EGLConfig   mEGLConfig;
-    private int mGLMajor, mGLMinor;
+    protected static Thread mAudioThread;
+    protected static AudioTrack mAudioTrack;
 
-    private boolean mFinished = false;
+    // EGL objects
+    protected static EGLContext  mEGLContext;
+    protected static EGLSurface  mEGLSurface;
+    protected static EGLDisplay  mEGLDisplay;
+    protected static EGLConfig   mEGLConfig;
+    protected static int mGLMajor, mGLMinor;
 
     // Load the .so
-    static 
-    {
+    static {
+		// Urho3D: everything resides in urho3d.so
         System.loadLibrary("Urho3D");
     }
 
     // Setup
-    protected void onCreate(Bundle savedInstanceState)
-    {
-        Log.v("SDL", "onCreate()");
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        //Log.v("SDL", "onCreate()");
         super.onCreate(savedInstanceState);
-
+        
         // So we can call stuff from static callbacks
         mSingleton = this;
+        
+        // Urho3D: reset paused status
+        mIsPaused = false;
 
         // Set up the surface
         mSurface = new SDLSurface(getApplication());
-        setContentView(mSurface);
-        SurfaceHolder holder = mSurface.getHolder();
+
+        mLayout = new AbsoluteLayout(this);
+        mLayout.addView(mSurface);
+
+        setContentView(mLayout);
     }
 
     // Events
-    protected void onPause() 
-    {
+    @Override
+    protected void onPause() {
         Log.v("SDL", "onPause()");
         super.onPause();
-        SDLActivity.nativePause();
+        // Don't call SDLActivity.nativePause(); here, it will be called by SDLSurface::surfaceDestroyed
     }
 
-    protected void onResume() 
-    {
+    @Override
+    protected void onResume() {
         Log.v("SDL", "onResume()");
         super.onResume();
-        SDLActivity.nativeResume();
+        // Don't call SDLActivity.nativeResume(); here, it will be called via SDLSurface::surfaceChanged->SDLActivity::startApp
     }
 
-    protected void onDestroy()
-    {
-        Log.v("SDL", "onDestroy()");
-        super.onDestroy();
-
-        mFinished = true;
+    @Override
+    public void onLowMemory() {
+        Log.v("SDL", "onLowMemory()");
+        super.onLowMemory();
+        SDLActivity.nativeLowMemory();
+    }
 
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        Log.v("SDL", "onDestroy()");
         // Send a quit message to the application
         SDLActivity.nativeQuit();
 
         // Now wait for the SDL thread to quit
-        if (mSDLThread != null) 
-        {
-            try 
-            {
+        if (mSDLThread != null) {
+            try {
                 mSDLThread.join();
-            } 
-            catch(Exception e)
-            {
+            } catch(Exception e) {
                 Log.v("SDL", "Problem stopping thread: " + e);
             }
             mSDLThread = null;
 
             //Log.v("SDL", "Finished waiting for SDL thread");
         }
-
-        mSingleton = null;
-    }
-
-    public void onConfigurationChanged(Configuration newConfig) 
-    {
-        super.onConfigurationChanged(newConfig);
-    }
-
-    public static SDLActivity getSingleton() 
-    {
-        return mSingleton;
     }
 
     // Messages from the SDLMain thread
-    static int COMMAND_CHANGE_TITLE = 1;
-    static int COMMAND_FINISH = 2;
+    static final int COMMAND_CHANGE_TITLE = 1;
+    static final int COMMAND_UNUSED = 2;
+    static final int COMMAND_TEXTEDIT_HIDE = 3;
+    // Urho3D: added
+    static final int COMMAND_FINISH = 4;
+
+    protected static final int COMMAND_USER = 0x8000;
+
+    /**
+     * This method is called by SDL if SDL did not handle a message itself.
+     * This happens if a received message contains an unsupported command.
+     * Method can be overwritten to handle Messages in a different class.
+     * @param command the command of the message.
+     * @param param the parameter of the message. May be null.
+     * @return if the message was handled in overridden method.
+     */
+    protected boolean onUnhandledMessage(int command, Object param) {
+        return false;
+    }
 
-    // Handler for the messages
-    Handler commandHandler = new Handler() 
-    {
-        public void handleMessage(Message msg) 
-        {
-            if (msg.arg1 == COMMAND_CHANGE_TITLE) 
-            {
-                setTitle((String)msg.obj);
+    /**
+     * A Handler class for Messages from native SDL applications.
+     * It uses current Activities as target (e.g. for the title).
+     * static to prevent implicit references to enclosing object.
+     */
+    protected static class SDLCommandHandler extends Handler {
+        @Override
+        public void handleMessage(Message msg) {
+            Context context = getContext();
+            if (context == null) {
+                Log.e(TAG, "error handling message, getContext() returned null");
+                return;
             }
-            if (msg.arg1 == COMMAND_FINISH) 
-            {
-                if (mFinished == false) 
-                {
-                    mFinished = true;
-                    finish();
+            switch (msg.arg1) {
+            case COMMAND_CHANGE_TITLE:
+                if (context instanceof Activity) {
+                    ((Activity) context).setTitle((String)msg.obj);
+                } else {
+                    Log.e(TAG, "error handling message, getContext() returned no Activity");
+                }
+                break;
+            case COMMAND_TEXTEDIT_HIDE:
+                if (mTextEdit != null) {
+                    mTextEdit.setVisibility(View.GONE);
+
+                    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
+                    imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
+                }
+                break;
+            // Urho3D: added
+            case COMMAND_FINISH:
+                if (context instanceof Activity)
+                    ((Activity) context).finish();
+                break;
+
+            default:
+                if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
+                    Log.e(TAG, "error handling message, command is " + msg.arg1);
                 }
             }
         }
-    };
+    }
+
+    // Handler for the messages
+    Handler commandHandler = new SDLCommandHandler();
 
     // Send a message from the SDLMain thread
-    void sendCommand(int command, Object data) 
-    {
+    boolean sendCommand(int command, Object data) {
         Message msg = commandHandler.obtainMessage();
         msg.arg1 = command;
         msg.obj = data;
-        commandHandler.sendMessage(msg);
+        return commandHandler.sendMessage(msg);
     }
 
     // C functions we call
     public static native void nativeInit(String filesDir);
+    public static native void nativeLowMemory();
     public static native void nativeQuit();
     public static native void nativePause();
     public static native void nativeResume();
@@ -165,302 +206,280 @@ public class SDLActivity extends Activity
     public static native void onNativeKeyDown(int keycode);
     public static native void onNativeKeyUp(int keycode);
     public static native void onNativeTouch(int touchDevId, int pointerFingerId,
-                                            int action, float x,
+                                            int action, float x, 
                                             float y, float p);
     public static native void onNativeAccel(float x, float y, float z);
-    public static native void onNativeSurfaceDestroyed();
-    public static native void onNativeSurfaceCreated();
     public static native void nativeRunAudioThread();
 
+
     // Java functions called from C
 
-    public static boolean createGLContext(int majorVersion, int minorVersion) 
-    {
-        return SDLActivity.mSingleton.initEGL(majorVersion, minorVersion);
+    public static boolean createGLContext(int majorVersion, int minorVersion, int[] attribs) {
+        return initEGL(majorVersion, minorVersion, attribs);
     }
 
-    public static void flipBuffers()
-    {
+    public static void flipBuffers() {
         flipEGL();
     }
 
-    public static void setActivityTitle(String title)
-    {
+    public static boolean setActivityTitle(String title) {
         // Called from SDLMain() thread and can't directly affect the view
-        mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
+        return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
     }
 
-    public static void finishActivity() 
+    public static void finishActivity()
     {
         mSingleton.sendCommand(COMMAND_FINISH, null);
     }
 
-    public static Context getContext()
-    {
+    public static boolean sendMessage(int command, int param) {
+        return mSingleton.sendCommand(command, Integer.valueOf(param));
+    }
+
+    public static Context getContext() {
         return mSingleton;
     }
 
-    public static void startApp() 
-    {
+    public static void startApp() {
         // Start up the C app thread
         if (mSDLThread == null) {
             mSDLThread = new Thread(new SDLMain(), "SDLThread");
             mSDLThread.start();
         }
         else {
-            SDLActivity.nativeResume();
+            /*
+             * Some Android variants may send multiple surfaceChanged events, so we don't need to resume every time
+             * every time we get one of those events, only if it comes after surfaceDestroyed
+             */
+            if (mIsPaused) {
+                SDLActivity.nativeResume();
+                SDLActivity.mIsPaused = false;
+            }
+        }
+    }
+    
+    static class ShowTextInputTask implements Runnable {
+        /*
+         * This is used to regulate the pan&scan method to have some offset from
+         * the bottom edge of the input region and the top edge of an input
+         * method (soft keyboard)
+         */
+        static final int HEIGHT_PADDING = 15;
+
+        public int x, y, w, h;
+
+        public ShowTextInputTask(int x, int y, int w, int h) {
+            this.x = x;
+            this.y = y;
+            this.w = w;
+            this.h = h;
+        }
 
-            // startApp() is called whenever the window is ready to be rendered to. If the SDL main thread is already running,
-            // notify it that any OpenGL resources can be recreated
-            SDLActivity.onNativeSurfaceCreated();
+        @Override
+        public void run() {
+            AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(
+                    w, h + HEIGHT_PADDING, x, y);
+
+            if (mTextEdit == null) {
+                mTextEdit = new DummyEdit(getContext());
+
+                mLayout.addView(mTextEdit, params);
+            } else {
+                mTextEdit.setLayoutParams(params);
+            }
+
+            mTextEdit.setVisibility(View.VISIBLE);
+            mTextEdit.requestFocus();
+
+            InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+            imm.showSoftInput(mTextEdit, 0);
         }
     }
 
+    public static boolean showTextInput(int x, int y, int w, int h) {
+        // Transfer the task to the main thread as a Runnable
+        return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h));
+    }
+
+
     // EGL functions
-    public boolean initEGL(int majorVersion, int minorVersion) 
-    {
-        EGL10 egl = (EGL10)EGLContext.getEGL();
+    public static boolean initEGL(int majorVersion, int minorVersion, int[] attribs) {
+        try {
+            if (SDLActivity.mEGLDisplay == null) {
+                Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
+
+                EGL10 egl = (EGL10)EGLContext.getEGL();
 
-        try
-        {
-            if (mEGLDisplay == null)
-            {
                 EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
-    
+
                 int[] version = new int[2];
                 egl.eglInitialize(dpy, version);
-    
-                int EGL_OPENGL_ES_BIT = 1;
-                int EGL_OPENGL_ES2_BIT = 4;
-                int renderableType = 0;
-                if (majorVersion == 2) 
-                {
-                    renderableType = EGL_OPENGL_ES2_BIT;
-                } 
-                else if (majorVersion == 1)
-                {
-                    renderableType = EGL_OPENGL_ES_BIT;
-                }
 
-                EGLConfig config = null;
                 EGLConfig[] configs = new EGLConfig[1];
                 int[] num_config = new int[1];
-                int depth = 24;
-
-                while (depth >= 16)
-                {
-                    int[] configSpec =
-                    {
-                        EGL10.EGL_DEPTH_SIZE, depth,
-                        EGL10.EGL_RENDERABLE_TYPE, renderableType,
-                        EGL10.EGL_NONE
-                    };
-
-                    if (egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) && num_config[0] > 0)
-                    {
-                        config = configs[0];
-                        break;
-                    }
-                    depth -= 8;
-                }
-                
-                if (config == null)
-                {
+                if (!egl.eglChooseConfig(dpy, attribs, configs, 1, num_config) || num_config[0] == 0) {
                     Log.e("SDL", "No EGL config available");
                     return false;
                 }
-    
-                mEGLDisplay = dpy;
-                mEGLConfig = config;
-                mGLMajor = majorVersion;
-                mGLMinor = minorVersion;
-            }
-            else
-            {
-                egl.eglMakeCurrent(mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
-                if (mEGLSurface != null)
-                {
-                    egl.eglDestroySurface(mEGLDisplay, mEGLSurface);
-                    mEGLSurface = null;
-                }
-                if (mEGLContext != null)
-                {
-                    egl.eglDestroyContext(mEGLDisplay, mEGLContext);
-                    mEGLContext = null;
-                }
+                EGLConfig config = configs[0];
+
+                SDLActivity.mEGLDisplay = dpy;
+                SDLActivity.mEGLConfig = config;
+                SDLActivity.mGLMajor = majorVersion;
+                SDLActivity.mGLMinor = minorVersion;
             }
+            return SDLActivity.createEGLSurface();
 
-            int EGL_CONTEXT_CLIENT_VERSION=0x3098;
-            int contextAttrs[] = new int[] { EGL_CONTEXT_CLIENT_VERSION, mGLMajor, EGL10.EGL_NONE };
-            EGLContext context = egl.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, contextAttrs);
-            if (context == EGL10.EGL_NO_CONTEXT)
-            {
-                Log.e("SDL", "Couldn't create context");
-                return false;
+        } catch(Exception e) {
+            Log.v("SDL", e + "");
+            for (StackTraceElement s : e.getStackTrace()) {
+                Log.v("SDL", s.toString());
             }
-            mEGLContext = context;
+            return false;
+        }
+    }
+
+    public static boolean createEGLContext() {
+        EGL10 egl = (EGL10)EGLContext.getEGL();
+        int EGL_CONTEXT_CLIENT_VERSION=0x3098;
+        int contextAttrs[] = new int[] { EGL_CONTEXT_CLIENT_VERSION, SDLActivity.mGLMajor, EGL10.EGL_NONE };
+        SDLActivity.mEGLContext = egl.eglCreateContext(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, EGL10.EGL_NO_CONTEXT, contextAttrs);
+        if (SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) {
+            Log.e("SDL", "Couldn't create context");
+            return false;
+        }
+        return true;
+    }
+
+    public static boolean createEGLSurface() {
+        if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLConfig != null) {
+            EGL10 egl = (EGL10)EGLContext.getEGL();
+            if (SDLActivity.mEGLContext == null) createEGLContext();
 
             Log.v("SDL", "Creating new EGL Surface");
-            EGLSurface surface = egl.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, mSurface, null);
-            if (surface == EGL10.EGL_NO_SURFACE)
-            {
+            EGLSurface surface = egl.eglCreateWindowSurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, SDLActivity.mSurface, null);
+            if (surface == EGL10.EGL_NO_SURFACE) {
                 Log.e("SDL", "Couldn't create surface");
                 return false;
             }
-            mEGLSurface = surface;
-            
-            if (!egl.eglMakeCurrent(mEGLDisplay, surface, surface, mEGLContext))
-            {
-                Log.e("SDL", "Failed making EGL Context current");
-                return false;
+
+            if (egl.eglGetCurrentContext() != SDLActivity.mEGLContext) {
+                if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
+                    Log.e("SDL", "Old EGL Context doesnt work, trying with a new one");
+                    // TODO: Notify the user via a message that the old context could not be restored, and that textures need to be manually restored.
+                    createEGLContext();
+                    if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
+                        Log.e("SDL", "Failed making EGL Context current");
+                        return false;
+                    }
+                }
             }
-            
+            SDLActivity.mEGLSurface = surface;
             return true;
-        }
-        catch(Exception e) 
-        {
-            Log.v("SDL", e + "");
-            for (StackTraceElement s : e.getStackTrace()) 
-            {
-                Log.v("SDL", s.toString());
-            }
-            
+        } else {
+            Log.e("SDL", "Surface creation failed, display = " + SDLActivity.mEGLDisplay + ", config = " + SDLActivity.mEGLConfig);
             return false;
         }
     }
 
     // EGL buffer flip
-    public static void flipEGL()
-    {
-        try
-        {
+    public static void flipEGL() {
+        try {
             EGL10 egl = (EGL10)EGLContext.getEGL();
 
-            egl.eglSwapBuffers(SDLActivity.mSingleton.mEGLDisplay, SDLActivity.mSingleton.mEGLSurface);
-        }
-        catch(Exception e) 
-        {
+            egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
+
+            // drawing here
+
+            egl.eglWaitGL();
+
+            egl.eglSwapBuffers(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface);
+
+
+        } catch(Exception e) {
             Log.v("SDL", "flipEGL(): " + e);
-            for (StackTraceElement s : e.getStackTrace()) 
-            {
+            for (StackTraceElement s : e.getStackTrace()) {
                 Log.v("SDL", s.toString());
             }
         }
     }
 
     // Audio
-    private static Object buf;
-
-    public static Object audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) 
-    {
+    public static void audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) {
         int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO;
         int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT;
         int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
-
-        Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
-
+        
+        Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
+        
         // Let the user pick a larger buffer if they really want -- but ye
         // gods they probably shouldn't, the minimums are horrifyingly high
         // latency already
         desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize);
-
+        
         mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate,
                 channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM);
-
+        
         audioStartThread();
-
-        Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer");
-
-        if (is16Bit) 
-        {
-            buf = new short[desiredFrames * (isStereo ? 2 : 1)];
-        } 
-        else
-        {
-            buf = new byte[desiredFrames * (isStereo ? 2 : 1)];
-        }
-        return buf;
+        
+        Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer");
     }
-
-    public static void audioStartThread() 
-    {
-        mAudioThread = new Thread(new Runnable() 
-        {
-            public void run() 
-            {
+    
+    public static void audioStartThread() {
+        mAudioThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
                 mAudioTrack.play();
                 nativeRunAudioThread();
             }
         });
-
+        
         // I'd take REALTIME if I could get it!
         mAudioThread.setPriority(Thread.MAX_PRIORITY);
         mAudioThread.start();
     }
-
-    public static void audioWriteShortBuffer(short[] buffer)
-     {
-        for (int i = 0; i < buffer.length; ) 
-        {
+    
+    public static void audioWriteShortBuffer(short[] buffer) {
+        for (int i = 0; i < buffer.length; ) {
             int result = mAudioTrack.write(buffer, i, buffer.length - i);
             if (result > 0) {
                 i += result;
-            } else if (result == 0) 
-            {
-                try 
-                {
+            } else if (result == 0) {
+                try {
                     Thread.sleep(1);
-                } 
-                catch(InterruptedException e)
-                {
+                } catch(InterruptedException e) {
                     // Nom nom
                 }
-            } 
-            else
-            {
+            } else {
                 Log.w("SDL", "SDL audio: error return from write(short)");
                 return;
             }
         }
     }
-
-    public static void audioWriteByteBuffer(byte[] buffer)
-    {
-        for (int i = 0; i < buffer.length; )
-        {
+    
+    public static void audioWriteByteBuffer(byte[] buffer) {
+        for (int i = 0; i < buffer.length; ) {
             int result = mAudioTrack.write(buffer, i, buffer.length - i);
-            if (result > 0) 
-            {
+            if (result > 0) {
                 i += result;
-            } 
-            else if (result == 0) 
-            {
-                try 
-                {
+            } else if (result == 0) {
+                try {
                     Thread.sleep(1);
-                } catch(InterruptedException e) 
-                {
+                } catch(InterruptedException e) {
                     // Nom nom
                 }
-            }
-            else 
-            {
-                Log.w("SDL", "SDL audio: error return from write(short)");
+            } else {
+                Log.w("SDL", "SDL audio: error return from write(byte)");
                 return;
             }
         }
     }
 
-    public static void audioQuit()
-    {
-        if (mAudioThread != null)
-        {
-            try
-            {
+    public static void audioQuit() {
+        if (mAudioThread != null) {
+            try {
                 mAudioThread.join();
-            }
-            catch(Exception e)
-            {
+            } catch(Exception e) {
                 Log.v("SDL", "Problem stopping audio thread: " + e);
             }
             mAudioThread = null;
@@ -468,8 +487,7 @@ public class SDLActivity extends Activity
             //Log.v("SDL", "Finished waiting for audio thread");
         }
 
-        if (mAudioTrack != null) 
-        {
+        if (mAudioTrack != null) {
             mAudioTrack.stop();
             mAudioTrack = null;
         }
@@ -479,14 +497,14 @@ public class SDLActivity extends Activity
 /**
     Simple nativeInit() runnable
 */
-class SDLMain implements Runnable 
-{
-    public void run() 
-    {
+class SDLMain implements Runnable {
+    @Override
+    public void run() {
         // Runs SDL_main()
-        SDLActivity.nativeInit(SDLActivity.getSingleton().getFilesDir().getAbsolutePath());
+        SDLActivity.nativeInit(((Activity)SDLActivity.getContext()).getFilesDir().getAbsolutePath());
 
         //Log.v("SDL", "SDL thread terminated");
+        // Urho3D: finish activity when SDL_main returns
         SDLActivity.finishActivity();
     }
 }
@@ -494,54 +512,63 @@ class SDLMain implements Runnable
 
 /**
     SDLSurface. This is what we draw on, so we need to know when it's created
-    in order to do anything useful.
+    in order to do anything useful. 
 
     Because of this, that's where we set up the SDL thread
 */
-class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener
-{
+class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, 
+    View.OnKeyListener, View.OnTouchListener, SensorEventListener  {
 
     // Sensors
-    private static SensorManager mSensorManager;
+    protected static SensorManager mSensorManager;
 
-    // Startup
-    public SDLSurface(Context context) 
-    {
-        super(context);
-        getHolder().addCallback(this);
+    // Keep track of the surface size to normalize touch events
+    protected static float mWidth, mHeight;
 
+    // Startup    
+    public SDLSurface(Context context) {
+        super(context);
+        getHolder().addCallback(this); 
+    
         setFocusable(true);
         setFocusableInTouchMode(true);
         requestFocus();
-        setOnKeyListener(this);
-        setOnTouchListener(this);
+        setOnKeyListener(this); 
+        setOnTouchListener(this);   
 
-        mSensorManager = (SensorManager)context.getSystemService("sensor");
+        mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
+
+        // Some arbitrary defaults to avoid a potential division by zero
+        mWidth = 1.0f;
+        mHeight = 1.0f;
     }
 
     // Called when we have a valid drawing surface
-    public void surfaceCreated(SurfaceHolder holder)
-    {
+    @Override
+    public void surfaceCreated(SurfaceHolder holder) {
         Log.v("SDL", "surfaceCreated()");
         holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
         enableSensor(Sensor.TYPE_ACCELEROMETER, true);
     }
 
     // Called when we lose the surface
-    public void surfaceDestroyed(SurfaceHolder holder)
-    {
+    @Override
+    public void surfaceDestroyed(SurfaceHolder holder) {
         Log.v("SDL", "surfaceDestroyed()");
-        SDLActivity.nativePause();
+        if (!SDLActivity.mIsPaused) {
+            SDLActivity.mIsPaused = true;
+            SDLActivity.nativePause();
+        }
         enableSensor(Sensor.TYPE_ACCELEROMETER, false);
-        SDLActivity.onNativeSurfaceDestroyed();
     }
 
     // Called when the surface is resized
-    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
-    {
+    @Override
+    public void surfaceChanged(SurfaceHolder holder,
+                               int format, int width, int height) {
         Log.v("SDL", "surfaceChanged()");
 
-        int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default
+        int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default
         switch (format) {
         case PixelFormat.A_8:
             Log.v("SDL", "pixel format A_8");
@@ -554,37 +581,40 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
             break;
         case PixelFormat.RGBA_4444:
             Log.v("SDL", "pixel format RGBA_4444");
-            sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444
+            sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444
             break;
         case PixelFormat.RGBA_5551:
             Log.v("SDL", "pixel format RGBA_5551");
-            sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551
+            sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551
             break;
         case PixelFormat.RGBA_8888:
             Log.v("SDL", "pixel format RGBA_8888");
-            sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888
+            sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888
             break;
         case PixelFormat.RGBX_8888:
             Log.v("SDL", "pixel format RGBX_8888");
-            sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888
+            sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888
             break;
         case PixelFormat.RGB_332:
             Log.v("SDL", "pixel format RGB_332");
-            sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332
+            sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332
             break;
         case PixelFormat.RGB_565:
             Log.v("SDL", "pixel format RGB_565");
-            sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565
+            sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565
             break;
         case PixelFormat.RGB_888:
             Log.v("SDL", "pixel format RGB_888");
             // Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
-            sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888
+            sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888
             break;
         default:
             Log.v("SDL", "pixel format unknown " + format);
             break;
         }
+
+        mWidth = width;
+        mHeight = height;
         SDLActivity.onNativeResize(width, height, sdlFormat);
         Log.v("SDL", "Window size:" + width + "x"+height);
 
@@ -592,95 +622,189 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
     }
 
     // unused
+    @Override
     public void onDraw(Canvas canvas) {}
 
+
     // Key events
-    public boolean onKey(View  v, int keyCode, KeyEvent event)
-    {
-        // Let the home & volume keys be handled by the system
+    @Override
+    public boolean onKey(View  v, int keyCode, KeyEvent event) {
+
+        // Urho3D: let the home & volume keys be handled by the system
         if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_HOME)
             return false;
 
-        if (event.getAction() == KeyEvent.ACTION_DOWN) 
-        {
+        if (event.getAction() == KeyEvent.ACTION_DOWN) {
             //Log.v("SDL", "key down: " + keyCode);
             SDLActivity.onNativeKeyDown(keyCode);
             return true;
         }
-        else if (event.getAction() == KeyEvent.ACTION_UP) 
-        {
+        else if (event.getAction() == KeyEvent.ACTION_UP) {
             //Log.v("SDL", "key up: " + keyCode);
             SDLActivity.onNativeKeyUp(keyCode);
             return true;
         }
-
+        
         return false;
     }
 
     // Touch events
-    public boolean onTouch(View v, MotionEvent event) 
-    {
-        {
-            final int touchDevId = event.getDeviceId();
-            final int pointerCount = event.getPointerCount();
-            // touchId, pointerId, action, x, y, pressure
-            int actionPointerIndex = event.getActionIndex();
-            int pointerFingerId = event.getPointerId(actionPointerIndex);
-            int action = event.getActionMasked();
-
-            float x = event.getX(actionPointerIndex);
-            float y = event.getY(actionPointerIndex);
-            float p = event.getPressure(actionPointerIndex);
-
-            if (action == MotionEvent.ACTION_MOVE && pointerCount > 1)
-            {
+    @Override
+    public boolean onTouch(View v, MotionEvent event) {
+             final int touchDevId = event.getDeviceId();
+             final int pointerCount = event.getPointerCount();
+             // touchId, pointerId, action, x, y, pressure
+             int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */
+             int pointerFingerId = event.getPointerId(actionPointerIndex);
+             int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */
+
+             float x = event.getX(actionPointerIndex) / mWidth;
+             float y = event.getY(actionPointerIndex) / mHeight;
+             float p = event.getPressure(actionPointerIndex);
+
+             if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
                 // TODO send motion to every pointer if its position has
                 // changed since prev event.
                 for (int i = 0; i < pointerCount; i++) {
                     pointerFingerId = event.getPointerId(i);
-                    x = event.getX(i);
-                    y = event.getY(i);
+                    x = event.getX(i) / mWidth;
+                    y = event.getY(i) / mHeight;
                     p = event.getPressure(i);
                     SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
                 }
-            }
-            else
-            {
+             } else {
                 SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
-            }
-        }
+             }
       return true;
-   }
+   } 
 
     // Sensor events
-    public void enableSensor(int sensortype, boolean enabled)
-    {
+    public void enableSensor(int sensortype, boolean enabled) {
         // TODO: This uses getDefaultSensor - what if we have >1 accels?
-        if (enabled) 
-        {
-            mSensorManager.registerListener(this,
-                            mSensorManager.getDefaultSensor(sensortype),
+        if (enabled) {
+            mSensorManager.registerListener(this, 
+                            mSensorManager.getDefaultSensor(sensortype), 
                             SensorManager.SENSOR_DELAY_GAME, null);
-        } 
-        else 
-        {
-            mSensorManager.unregisterListener(this,
+        } else {
+            mSensorManager.unregisterListener(this, 
                             mSensorManager.getDefaultSensor(sensortype));
         }
     }
-
-    public void onAccuracyChanged(Sensor sensor, int accuracy) 
-    {
+    
+    @Override
+    public void onAccuracyChanged(Sensor sensor, int accuracy) {
         // TODO
     }
 
-    public void onSensorChanged(SensorEvent event) 
-    {
-        if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
-        {
+    @Override
+    public void onSensorChanged(SensorEvent event) {
+        if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
             SDLActivity.onNativeAccel(event.values[0] / SensorManager.GRAVITY_EARTH,
                                       event.values[1] / SensorManager.GRAVITY_EARTH,
                                       event.values[2] / SensorManager.GRAVITY_EARTH);
         }
     }
+    
+}
+
+/* This is a fake invisible editor view that receives the input and defines the
+ * pan&scan region
+ */
+class DummyEdit extends View implements View.OnKeyListener {
+    InputConnection ic;
+
+    public DummyEdit(Context context) {
+        super(context);
+        setFocusableInTouchMode(true);
+        setFocusable(true);
+        setOnKeyListener(this);
+    }
+
+    @Override
+    public boolean onCheckIsTextEditor() {
+        return true;
+    }
+
+    @Override
+    public boolean onKey(View v, int keyCode, KeyEvent event) {
+
+        // This handles the hardware keyboard input
+        if (event.isPrintingKey()) {
+            if (event.getAction() == KeyEvent.ACTION_DOWN) {
+                ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
+            }
+            return true;
+        }
+
+        if (event.getAction() == KeyEvent.ACTION_DOWN) {
+            SDLActivity.onNativeKeyDown(keyCode);
+            return true;
+        } else if (event.getAction() == KeyEvent.ACTION_UP) {
+            SDLActivity.onNativeKeyUp(keyCode);
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
+        ic = new SDLInputConnection(this, true);
+
+        outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
+                | 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;
+
+        return ic;
+    }
+}
+
+class SDLInputConnection extends BaseInputConnection {
+
+    public SDLInputConnection(View targetView, boolean fullEditor) {
+        super(targetView, fullEditor);
+
+    }
+
+    @Override
+    public boolean sendKeyEvent(KeyEvent event) {
+
+        /*
+         * This handles the keycodes from soft keyboard (and IME-translated
+         * input from hardkeyboard)
+         */
+        int keyCode = event.getKeyCode();
+        if (event.getAction() == KeyEvent.ACTION_DOWN) {
+            if (event.isPrintingKey()) {
+                commitText(String.valueOf((char) event.getUnicodeChar()), 1);
+            }
+            SDLActivity.onNativeKeyDown(keyCode);
+            return true;
+        } else if (event.getAction() == KeyEvent.ACTION_UP) {
+
+            SDLActivity.onNativeKeyUp(keyCode);
+            return true;
+        }
+        return super.sendKeyEvent(event);
+    }
+
+    @Override
+    public boolean commitText(CharSequence text, int newCursorPosition) {
+
+        nativeCommitText(text.toString(), newCursorPosition);
+
+        return super.commitText(text, newCursorPosition);
+    }
+
+    @Override
+    public boolean setComposingText(CharSequence text, int newCursorPosition) {
+
+        nativeSetComposingText(text.toString(), newCursorPosition);
+
+        return super.setComposingText(text, newCursorPosition);
+    }
+
+    public native void nativeCommitText(String text, int newCursorPosition);
+
+    public native void nativeSetComposingText(String text, int newCursorPosition);
+
 }

+ 10 - 7
Engine/Graphics/CMakeLists.txt

@@ -19,13 +19,16 @@ set (SOURCE_FILES ${CPP_FILES} ${H_FILES} ${SYS_CPP_FILES} ${SYS_H_FILES})
 set (LIBS ../Container ../Core ../IO ../Math ../Resource ../Scene)
 set (INCLUDE_DIRS_ONLY .)
 set (LINK_LIBS_ONLY SDL)
-
-if (USE_OPENGL)
-    if (NOT IOS)
-        set (LIBS ${LIBS} ../../ThirdParty/GLEW)
-    endif()
-else ()
-    set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} d3d9.lib)
+
+if (USE_OPENGL)
+    if (NOT IOS)
+        set (LIBS ${LIBS} ../../ThirdParty/GLEW)
+    endif ()
+    if (WIN32)
+        set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} opengl32.lib)
+    endif ()
+else ()
+    set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} d3d9.lib)
 endif ()
 
 # Setup target

+ 77 - 139
Engine/Input/Input.cpp

@@ -39,21 +39,12 @@
 
 #include "DebugNew.h"
 
-namespace Urho3D
-{
+#if defined(__APPLE__) && !defined(IOS)
+    #define REQUIRE_CLICK_TO_FOCUS
+#endif
 
-static HashMap<unsigned, Input*> inputInstances;
-
-/// Return the Input subsystem instance corresponding to an SDL window ID.
-Input* GetInputInstance(unsigned windowID)
+namespace Urho3D
 {
-    #if !defined(ANDROID) && !defined(IOS)
-    return windowID ? inputInstances[windowID] : 0;
-    #else
-    // On mobile devices only a single Urho3D instance within a process is supported, and the window ID can not be relied on.
-    return inputInstances.Size() ? inputInstances.Begin()->second_ : 0;
-    #endif
-}
 
 /// Convert SDL keycode if necessary
 int ConvertSDLKeyCode(int keySym, int scanCode)
@@ -88,13 +79,6 @@ Input::Input(Context* context) :
 
 Input::~Input()
 {
-    // Remove input instance mapping
-    if (initialized_)
-    {
-        MutexLock lock(GetStaticMutex());
-        
-        inputInstances.Erase(windowID_);
-    }
 }
 
 void Input::Update()
@@ -126,18 +110,12 @@ void Input::Update()
         MutexLock lock(GetStaticMutex());
         
         // Pump SDL events
+        /// \todo This does not handle multiple input instances properly. Each instance will need its own event queue,
+        /// where SDL events are copied and which it handles in its own main thread
         SDL_Event evt;
         SDL_PumpEvents();
         while (SDL_PollEvent(&evt))
-        {
-            // Dispatch event to the appropriate Input instance. However SDL_QUIT can not at the moment be handled for multiple
-            // instances properly (other threads' graphics devices can not be closed from this thread), so we handle it only
-            // for own instance
-            if (evt.type != SDL_QUIT)
-                HandleSDLEvent(&evt);
-            else
-                GetSubsystem<Engine>()->Exit();
-        }
+            HandleSDLEvent(&evt);
     }
     
     // Check for activation and inactivation from SDL window flags. Must nullcheck the window pointer because it may have
@@ -146,8 +124,12 @@ void Input::Update()
     if (window)
     {
         unsigned flags = SDL_GetWindowFlags(window) & (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
+#ifdef REQUIRE_CLICK_TO_FOCUS
         if (!inputFocus_ && (graphics_->GetFullscreen() || mouseVisible_) && flags == (SDL_WINDOW_INPUT_FOCUS |
             SDL_WINDOW_MOUSE_FOCUS))
+#else
+        if (!inputFocus_ && (flags & SDL_WINDOW_INPUT_FOCUS))
+#endif
             focusedThisFrame_ = true;
         else if (inputFocus_ && (flags & SDL_WINDOW_INPUT_FOCUS) == 0)
             LoseFocus();
@@ -159,6 +141,7 @@ void Input::Update()
     else
         return;
     
+#if !defined(ANDROID) && !defined(IOS)
     // Check for mouse move
     if (inputFocus_)
     {
@@ -201,6 +184,7 @@ void Input::Update()
             }
         }
     }
+#endif
 }
 
 void Input::SetMouseVisible(bool enable)
@@ -233,13 +217,9 @@ void Input::SetToggleFullscreen(bool enable)
 
 bool Input::DetectJoysticks()
 {
-    if (inputInstances.Size() > 1)
-    {
-        LOGERROR("Can not redetect joysticks with multiple application instances");
-        return false;
-    }
-    else
     {
+        MutexLock lock(GetStaticMutex());
+        
         SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
         SDL_InitSubSystem(SDL_INIT_JOYSTICK);
         ResetJoysticks();
@@ -426,14 +406,6 @@ void Input::Initialize()
     focusedThisFrame_ = true;
     initialized_ = true;
     
-    {
-        MutexLock lock(GetStaticMutex());
-        
-        // Store window ID to direct SDL events to the correct instance
-        windowID_ = SDL_GetWindowID(graphics_->GetImpl()->GetWindow());
-        inputInstances[windowID_] = this;
-    }
-    
     ResetJoysticks();
     ResetState();
     
@@ -447,7 +419,7 @@ void Input::ResetJoysticks()
     joysticks_.Clear();
     joysticks_.Resize(SDL_NumJoysticks());
     for (unsigned i = 0; i < joysticks_.Size(); ++i)
-        joysticks_[i].name_ = SDL_JoystickName(i);
+        joysticks_[i].name_ = SDL_JoystickNameForIndex(i);
 }
 
 void Input::GainFocus()
@@ -533,13 +505,15 @@ void Input::SendInputFocusEvent()
 
 void Input::SetMouseButton(int button, bool newState)
 {
-    // After losing focus in windowed hidden mouse mode, regain only after a left-click inside the window
-    // This allows glitchfree window dragging on all operating systems
+#ifdef REQUIRE_CLICK_TO_FOCUS
+    // OSX only: after losing focus in windowed hidden mouse mode, regain focus only after a left-click inside the window.
+    // This allows glitchfree window dragging
     if (!mouseVisible_ && !graphics_->GetFullscreen())
     {
         if (!inputFocus_ && newState && button == MOUSEB_LEFT)
             focusedThisFrame_ = true;
     }
+#endif
     
     // If we do not have focus yet, do not react to the mouse button down
     if (newState && !inputFocus_)
@@ -638,26 +612,19 @@ void Input::SetMousePosition(const IntVector2& position)
 void Input::HandleSDLEvent(void* sdlEvent)
 {
     SDL_Event& evt = *static_cast<SDL_Event*>(sdlEvent);
-    Input* input = 0;
     
     switch (evt.type)
     {
     case SDL_KEYDOWN:
         // Convert to uppercase to match Win32 virtual key codes
-        input = GetInputInstance(evt.key.windowID);
-        if (input)
-            input->SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), true);
+        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), true);
         break;
         
     case SDL_KEYUP:
-        input = GetInputInstance(evt.key.windowID);
-        if (input)
-            input->SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), false);
+        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), false);
         break;
         
     case SDL_TEXTINPUT:
-        input = GetInputInstance(evt.text.windowID);
-        if (input && evt.text.text[0])
         {
             String text(&evt.text.text[0]);
             unsigned unicode = text.AtUTF8(0);
@@ -668,42 +635,36 @@ void Input::HandleSDLEvent(void* sdlEvent)
                 VariantMap keyEventData;
                 
                 keyEventData[P_CHAR] = unicode;
-                keyEventData[P_BUTTONS] = input->mouseButtonDown_;
-                keyEventData[P_QUALIFIERS] = input->GetQualifiers();
-                input->SendEvent(E_CHAR, keyEventData);
+                keyEventData[P_BUTTONS] = mouseButtonDown_;
+                keyEventData[P_QUALIFIERS] = GetQualifiers();
+                SendEvent(E_CHAR, keyEventData);
             }
         }
         break;
         
+#if !defined(ANDROID) && !defined(IOS)
     case SDL_MOUSEBUTTONDOWN:
-        input = GetInputInstance(evt.button.windowID);
-        if (input)
-            input->SetMouseButton(1 << (evt.button.button - 1), true);
+        SetMouseButton(1 << (evt.button.button - 1), true);
         break;
         
     case SDL_MOUSEBUTTONUP:
-        input = GetInputInstance(evt.button.windowID);
-        if (input)
-            input->SetMouseButton(1 << (evt.button.button - 1), false);
+        SetMouseButton(1 << (evt.button.button - 1), false);
         break;
         
     case SDL_MOUSEWHEEL:
-        input = GetInputInstance(evt.wheel.windowID);
-        if (input)
-            input->SetMouseWheel(evt.wheel.y);
+        SetMouseWheel(evt.wheel.y);
         break;
+#endif
         
     case SDL_FINGERDOWN:
-        input = GetInputInstance(evt.tfinger.windowID);
-        if (input)
         {
             int touchID = evt.tfinger.fingerId & 0x7ffffff;
-            TouchState& state = input->touches_[touchID];
+            TouchState& state = touches_[touchID];
             state.touchID_ = touchID;
-            state.lastPosition_ = state.position_ = IntVector2(evt.tfinger.x * input->graphics_->GetWidth() / 32768,
-                evt.tfinger.y * input->graphics_->GetHeight() / 32768);
+            state.lastPosition_ = state.position_ = IntVector2((int)(evt.tfinger.x * graphics_->GetWidth()),
+                (int)(evt.tfinger.y * graphics_->GetHeight()));
             state.delta_ = IntVector2::ZERO;
-            state.pressure_ = (float)evt.tfinger.pressure / 32767.0f;
+            state.pressure_ = evt.tfinger.pressure;
             
             using namespace TouchBegin;
             
@@ -713,39 +674,35 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_X] = state.position_.x_;
             eventData[P_Y] = state.position_.y_;
             eventData[P_PRESSURE] = state.pressure_;
-            input->SendEvent(E_TOUCHBEGIN, eventData);
+            SendEvent(E_TOUCHBEGIN, eventData);
         }
         break;
         
     case SDL_FINGERUP:
-        input = GetInputInstance(evt.tfinger.windowID);
-        if (input)
         {
             int touchID = evt.tfinger.fingerId & 0x7ffffff;
-            input->touches_.Erase(touchID);
+            touches_.Erase(touchID);
             
             using namespace TouchEnd;
             
             VariantMap eventData;
             
             eventData[P_TOUCHID] = touchID;
-            eventData[P_X] = evt.tfinger.x * input->graphics_->GetWidth() / 32768;
-            eventData[P_Y] = evt.tfinger.y * input->graphics_->GetHeight() / 32768;
-            input->SendEvent(E_TOUCHEND, eventData);
+            eventData[P_X] = evt.tfinger.x * graphics_->GetWidth();
+            eventData[P_Y] = evt.tfinger.y * graphics_->GetHeight();
+            SendEvent(E_TOUCHEND, eventData);
         }
         break;
         
     case SDL_FINGERMOTION:
-        input = GetInputInstance(evt.tfinger.windowID);
-        if (input)
         {
             int touchID = evt.tfinger.fingerId & 0x7ffffff;
-            TouchState& state = input->touches_[touchID];
+            TouchState& state = touches_[touchID];
             state.touchID_ = touchID;
-            state.position_ = IntVector2(evt.tfinger.x * input->graphics_->GetWidth() / 32768,
-                evt.tfinger.y * input->graphics_->GetHeight() / 32768);
+            state.position_ = IntVector2((int)(evt.tfinger.x * graphics_->GetWidth()),
+                (int)(evt.tfinger.y * graphics_->GetHeight()));
             state.delta_ = state.position_ - state.lastPosition_;
-            state.pressure_ = (float)evt.tfinger.pressure / 32767.0f;
+            state.pressure_ = evt.tfinger.pressure;
             
             using namespace TouchMove;
             
@@ -754,16 +711,14 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_TOUCHID] = touchID;
             eventData[P_X] = state.position_.x_;
             eventData[P_Y] = state.position_.y_;
-            eventData[P_DX] = evt.tfinger.dx * input->graphics_->GetWidth() / 32768;
-            eventData[P_DY] = evt.tfinger.dy * input->graphics_->GetHeight() / 32768;
+            eventData[P_DX] = (int)(evt.tfinger.dx * graphics_->GetWidth());
+            eventData[P_DY] = (int)(evt.tfinger.dy * graphics_->GetHeight());
             eventData[P_PRESSURE] = state.pressure_;
-            input->SendEvent(E_TOUCHMOVE, eventData);
+            SendEvent(E_TOUCHMOVE, eventData);
         }
         break;
         
     case SDL_JOYBUTTONDOWN:
-        // Joystick events are not targeted at a window. Check all input instances which have opened the joystick
-        for (HashMap<unsigned, Input*>::Iterator i = inputInstances.Begin(); i != inputInstances.End(); ++i)
         {
             using namespace JoystickButtonDown;
             
@@ -771,19 +726,17 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_JOYSTICK] = evt.jbutton.which;
             eventData[P_BUTTON] = evt.jbutton.button;
             
-            input = i->second_;
-            if (evt.jbutton.which < input->joysticks_.Size() && evt.jbutton.button <
-                input->joysticks_[evt.jbutton.which].buttons_.Size())
+            if (evt.jbutton.which < joysticks_.Size() && evt.jbutton.button <
+                joysticks_[evt.jbutton.which].buttons_.Size())
             {
-                input->joysticks_[evt.jbutton.which].buttons_[evt.jbutton.button] = true;
-                input->joysticks_[evt.jbutton.which].buttonPress_[evt.jbutton.button] = true;
-                input->SendEvent(E_JOYSTICKBUTTONDOWN, eventData);
+                joysticks_[evt.jbutton.which].buttons_[evt.jbutton.button] = true;
+                joysticks_[evt.jbutton.which].buttonPress_[evt.jbutton.button] = true;
+                SendEvent(E_JOYSTICKBUTTONDOWN, eventData);
             }
         }
         break;
         
     case SDL_JOYBUTTONUP:
-        for (HashMap<unsigned, Input*>::Iterator i = inputInstances.Begin(); i != inputInstances.End(); ++i)
         {
             using namespace JoystickButtonUp;
             
@@ -791,18 +744,16 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_JOYSTICK] = evt.jbutton.which;
             eventData[P_BUTTON] = evt.jbutton.button;
             
-            input = i->second_;
-            if (evt.jbutton.which < input->joysticks_.Size() && evt.jbutton.button <
-                input->joysticks_[evt.jbutton.which].buttons_.Size())
+            if (evt.jbutton.which < joysticks_.Size() && evt.jbutton.button <
+                joysticks_[evt.jbutton.which].buttons_.Size())
             {
-                input->joysticks_[evt.jbutton.which].buttons_[evt.jbutton.button] = false;
-                input->SendEvent(E_JOYSTICKBUTTONUP, eventData);
+                joysticks_[evt.jbutton.which].buttons_[evt.jbutton.button] = false;
+                SendEvent(E_JOYSTICKBUTTONUP, eventData);
             }
         }
         break;
         
     case SDL_JOYAXISMOTION:
-        for (HashMap<unsigned, Input*>::Iterator i = inputInstances.Begin(); i != inputInstances.End(); ++i)
         {
             using namespace JoystickAxisMove;
             
@@ -811,18 +762,16 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_AXIS] = evt.jaxis.axis;
             eventData[P_POSITION] = Clamp((float)evt.jaxis.value / 32767.0f, -1.0f, 1.0f);
             
-            input = i->second_;
-            if (evt.jaxis.which < input->joysticks_.Size() && evt.jaxis.axis <
-                input->joysticks_[evt.jaxis.which].axes_.Size())
+            if (evt.jaxis.which < joysticks_.Size() && evt.jaxis.axis <
+                joysticks_[evt.jaxis.which].axes_.Size())
             {
-                input->joysticks_[evt.jaxis.which].axes_[evt.jaxis.axis] = eventData[P_POSITION].GetFloat();
-                input->SendEvent(E_JOYSTICKAXISMOVE, eventData);
+                joysticks_[evt.jaxis.which].axes_[evt.jaxis.axis] = eventData[P_POSITION].GetFloat();
+                SendEvent(E_JOYSTICKAXISMOVE, eventData);
             }
         }
         break;
         
     case SDL_JOYHATMOTION:
-        for (HashMap<unsigned, Input*>::Iterator i = inputInstances.Begin(); i != inputInstances.End(); ++i)
         {
             using namespace JoystickHatMove;
             
@@ -831,57 +780,54 @@ void Input::HandleSDLEvent(void* sdlEvent)
             eventData[P_HAT] = evt.jhat.hat;
             eventData[P_POSITION] = evt.jhat.value;
             
-            input = i->second_;
-            if (evt.jhat.which < input->joysticks_.Size() && evt.jhat.hat <
-                input->joysticks_[evt.jhat.which].hats_.Size())
+            if (evt.jhat.which < joysticks_.Size() && evt.jhat.hat <
+                joysticks_[evt.jhat.which].hats_.Size())
             {
-                input->joysticks_[evt.jhat.which].hats_[evt.jhat.hat] = evt.jhat.value;
-                input->SendEvent(E_JOYSTICKHATMOVE, eventData);
+                joysticks_[evt.jhat.which].hats_[evt.jhat.hat] = evt.jhat.value;
+                SendEvent(E_JOYSTICKHATMOVE, eventData);
             }
         }
         break;
         
     case SDL_WINDOWEVENT:
-        input = GetInputInstance(evt.window.windowID);
-        if (input)
         {
             switch (evt.window.event)
             {
             case SDL_WINDOWEVENT_CLOSE:
-                input->GetSubsystem<Graphics>()->Close();
+                GetSubsystem<Graphics>()->Close();
                 break;
                 
             case SDL_WINDOWEVENT_MINIMIZED:
-                input->minimized_ = true;
-                input->SendInputFocusEvent();
+                minimized_ = true;
+                SendInputFocusEvent();
                 break;
                 
             case SDL_WINDOWEVENT_MAXIMIZED:
             case SDL_WINDOWEVENT_RESTORED:
-                input->minimized_ = false;
-                input->SendInputFocusEvent();
+                minimized_ = false;
+                SendInputFocusEvent();
             #ifdef IOS
                 // On iOS we never lose the GL context, but may have done GPU object changes that could not be applied yet.
                 // Apply them now
-                input->graphics_->Restore();
+                graphics_->Restore();
             #endif
                 break;
                 
             #ifdef ANDROID
-            case SDL_WINDOWEVENT_SURFACE_LOST:
+            case SDL_WINDOWEVENT_FOCUS_LOST:
                 // Mark GPU objects lost
-                input->graphics_->Release(false, false);
+                graphics_->Release(false, false);
                 break;
-                
-            case SDL_WINDOWEVENT_SURFACE_CREATED:
+
+            case SDL_WINDOWEVENT_FOCUS_GAINED:
                 // Restore GPU objects
-                input->graphics_->Restore();
+                graphics_->Restore();
                 break;
             #endif
 
             #if !defined(IOS) && !defined(ANDROID)
             case SDL_WINDOWEVENT_RESIZED:
-                input->graphics_->WindowResized(evt.window.data1, evt.window.data2);
+                graphics_->WindowResized(evt.window.data1, evt.window.data2);
                 break;
             #endif
             }
@@ -899,17 +845,9 @@ void Input::HandleScreenMode(StringHash eventType, VariantMap& eventData)
         ResetState();
     
     // Re-enable cursor clipping, and re-center the cursor (if needed) to the new screen size, so that there is no erroneous
-    // mouse move event. Also get the new window ID in case it changed
+    // mouse move event. Also get new window ID if it changed
     SDL_Window* window = graphics_->GetImpl()->GetWindow();
-    unsigned newWindowID = SDL_GetWindowID(window);
-    if (newWindowID != windowID_)
-    {
-        MutexLock lock(GetStaticMutex());
-        
-        inputInstances.Erase(windowID_);
-        inputInstances[newWindowID] = this;
-        windowID_ = newWindowID;
-    }
+    windowID_ = SDL_GetWindowID(window);
     
     if (!mouseVisible_)
     {

+ 1 - 1
Engine/Input/Input.h

@@ -205,7 +205,7 @@ private:
     /// Handle frame start event.
     void HandleBeginFrame(StringHash eventType, VariantMap& eventData);
     /// Handle SDL event.
-    static void HandleSDLEvent(void* sdlEvent);
+    void HandleSDLEvent(void* sdlEvent);
     
     /// Graphics subsystem.
     WeakPtr<Graphics> graphics_;

+ 16 - 18
ThirdParty/SDL/BUGS → ThirdParty/SDL/BUGS.txt

@@ -1,18 +1,16 @@
-
-Bugs are now managed in the SDL bug tracker, here:
-
-    http://bugzilla.libsdl.org/
-
-You may report bugs there, and search to see if a given issue has already
- been reported, discussed, and maybe even fixed.
-
-
-
-You may also find help at the SDL mailing list. Subscription information:
-
-    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
-
-Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
- bugs discussed on the mailing list may be forgotten or missed.
-
-
+
+Bugs are now managed in the SDL bug tracker, here:
+
+    http://bugzilla.libsdl.org/
+
+You may report bugs there, and search to see if a given issue has already
+ been reported, discussed, and maybe even fixed.
+
+
+You may also find help on the SDL mailing list. Subscription information:
+
+    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
+
+Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
+ bugs discussed on the mailing list may be forgotten or missed.
+

+ 13 - 11
ThirdParty/SDL/CMakeLists.txt

@@ -3,20 +3,25 @@ set (TARGET_NAME SDL)
 
 # Define source files
 file (GLOB C_FILES
-    src/*.c src/atomic/*.c src/audio/*.c src/audio/dummy/*.c src/cpuinfo/*.c src/events/*.c src/file/*.c src/joystick/*.c src/libm/*.c src/stdlib/*.c src/thread/*.c src/timer/*.c src/video/*.c src/video/dummy/*.c
+    src/*.c src/atomic/*.c src/audio/*.c src/audio/disk/*.c src/audio/dummy/*.c src/cpuinfo/*.c src/events/*.c src/file/*.c 
+    src/haptic/*.c src/joystick/*.c src/libm/*.c src/power/*.c src/stdlib/*.c src/thread/*.c src/timer/*.c src/video/*.c 
+    src/video/dummy/*.c
 )
 
 if (WIN32)
     file (GLOB SYS_C_FILES
-        src/audio/directsound/*.c src/joystick/windows/*.c src/core/windows/*.c src/loadso/windows/*.c src/thread/windows/*.c src/timer/windows/*.c src/video/windows/*.c
+        src/audio/directsound/*.c src/haptic/windows/*.c src/joystick/windows/*.c src/core/windows/*.c src/loadso/windows/*.c 
+        src/power/windows/*.c src/thread/windows/*.c src/thread/generic/SDL_syscond.c src/timer/windows/*.c src/video/windows/*.c
     )
 elseif (IOS)
     file (GLOB SYS_C_FILES
-        src/audio/coreaudio/*.c src/file/cocoa/*.m src/joystick/iphoneos/*.m src/loadso/dlopen/*.c src/thread/pthread/*.c src/timer/unix/*.c src/video/uikit/*.m src/video/uikit/*.c
+        src/audio/coreaudio/*.c src/file/cocoa/*.m src/joystick/iphoneos/*.m src/loadso/dlopen/*.c src/power/uikit/*.m 
+        src/thread/pthread/*.c src/timer/unix/*.c src/video/uikit/*.m src/video/uikit/*.c
     )
 elseif (APPLE)
     file (GLOB SYS_C_FILES
-        src/audio/coreaudio/*.c src/joystick/darwin/*.c src/loadso/dlopen/*.c src/thread/pthread/*.c src/timer/unix/*.c src/video/cocoa/*.m
+        src/audio/coreaudio/*.c src/file/cocoa/*.m src/haptic/darwin/*.c src/joystick/darwin/*.c src/loadso/dlopen/*.c 
+        src/power/macosx/*.c src/thread/pthread/*.c src/timer/unix/*.c src/video/cocoa/*.m
     )
 else ()
     include(CheckCSourceCompiles)
@@ -59,7 +64,8 @@ else ()
     set(CMAKE_REQUIRED_LIBRARIES)
 
     file (GLOB SYS_C_FILES
-        src/audio/alsa/*.c src/audio/dma/*.c src/audio/dsp/*.c src/joystick/linux/*.c src/loadso/dlopen/*.c src/thread/pthread/*.c src/timer/unix/*.c src/video/x11/*.c
+        src/audio/alsa/*.c src/audio/dma/*.c src/audio/dsp/*.c src/haptic/linux/*.c src/joystick/linux/*.c src/loadso/dlopen/*.c
+        src/power/linux/*.c src/thread/pthread/*.c src/timer/unix/*.c src/video/x11/*.c
     )
 endif ()
 
@@ -73,13 +79,9 @@ set (SOURCE_FILES ${C_FILES} ${SYS_C_FILES} ${H_FILES})
 add_library (${TARGET_NAME} STATIC ${SOURCE_FILES})
 
 if (WIN32)
-    if (USE_OPENGL)
-        target_link_libraries (${TARGET_NAME} winmm.lib opengl32.lib)
-    else ()
-        target_link_libraries (${TARGET_NAME} winmm.lib)
-    endif ()
+    target_link_libraries (${TARGET_NAME} user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
 elseif (APPLE)
     target_link_libraries (${TARGET_NAME} dl pthread)
 else ()
-    target_link_libraries (${TARGET_NAME} dl pthread GL)
+    target_link_libraries (${TARGET_NAME} dl pthread rt GL)
 endif ()

+ 20 - 19
ThirdParty/SDL/COPYING → ThirdParty/SDL/COPYING.txt

@@ -1,19 +1,20 @@
-
-Simple DirectMedia Layer
-Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
-  
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-  
-1. The origin of this software must not be misrepresented; you must not
-   claim that you wrote the original software. If you use this software
-   in a product, an acknowledgment in the product documentation would be
-   appreciated but is not required. 
-2. Altered source versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
+
+Simple DirectMedia Layer
+Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+  
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+  
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software. If you use this software
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required. 
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+

+ 70 - 73
ThirdParty/SDL/CREDITS → ThirdParty/SDL/CREDITS.txt

@@ -1,73 +1,70 @@
-
-Simple DirectMedia Layer CREDITS
-Thanks to everyone who made this possible, including:
-
-* Cliff Matthews, for giving me a reason to start this project. :)
- -- Executor rocks!  *grin*
-
-* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
-  Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
-  Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
-  and Phoenix Kokido for financial contributions
-
-* Edgar "bobbens" Simo for his force feedback API development during the
-  Google Summer of Code 2008
-
-* Aaron Wishnick for his work on audio resampling and pitch shifting during
-  the Google Summer of Code 2008
-
-* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
-  Google Summer of Code 2008
-
-* Darren Alton for port of SDL to the Nintendo DS during the Google Summer
-  of Code 2008
-
-* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
-  during the Google Summer of Code 2008
-
-* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
-  Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great
-  SDL Bug Hunt of January 2009!
-
-* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
-  January 2009!
-
-* Luke Benstead for OpenGL 3.0 support
-
-* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
-
-* Tim Jones for the new look of the SDL website
-
-* Ryan Gordon for helping everybody out and keeping the dream alive. :)
-
-* Mattias Engdegård, for help with the Solaris port and lots of other help
-
-* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
-
-* David Carré, for the Pandora port
-
-* Couriersud for the DirectFB driver
-
-* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
-
-* Arne Claus, for the 2004 winning SDL logo,
-  and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
-  Daniel Liljeberg,  Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
-  Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson,
-  S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand,
-  Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller,
-  Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja
-  for other logo entries.
-
-* Bob Pendleton and David Olofson for being long time contributors to
-  the SDL mailing list.
-
-* Everybody at Loki Software, Inc. for their great contributions!
-
- And a big hand to everyone else who gave me appreciation, advice,
- and suggestions, especially the good folks on the SDL mailing list.
-
-THANKS! :)
-
-  -- Sam Lantinga			<[email protected]>
-
+
+Simple DirectMedia Layer CREDITS
+Thanks to everyone who made this possible, including:
+
+* Cliff Matthews, for giving me a reason to start this project. :)
+ -- Executor rocks!  *grin*
+
+* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
+  Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
+  Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
+  and Phoenix Kokido for financial contributions
+
+* Edgar "bobbens" Simo for his force feedback API development during the
+  Google Summer of Code 2008
+
+* Aaron Wishnick for his work on audio resampling and pitch shifting during
+  the Google Summer of Code 2008
+
+* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
+  Google Summer of Code 2008
+
+* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
+  during the Google Summer of Code 2008
+
+* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
+  Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great
+  SDL Bug Hunt of January 2009!
+
+* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
+  January 2009!
+
+* Luke Benstead for OpenGL 3.0 support
+
+* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
+
+* Tim Jones for the new look of the SDL website
+
+* Ryan Gordon for helping everybody out and keeping the dream alive. :)
+
+* Mattias Engdegård, for help with the Solaris port and lots of other help
+
+* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
+
+* David Carré, for the Pandora port
+
+* Couriersud for the DirectFB driver
+
+* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
+
+* Arne Claus, for the 2004 winning SDL logo,
+  and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
+  Daniel Liljeberg,  Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
+  Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson,
+  S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand,
+  Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller,
+  Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja
+  for other logo entries.
+
+* Bob Pendleton and David Olofson for being long time contributors to
+  the SDL mailing list.
+
+* Everybody at Loki Software, Inc. for their great contributions!
+
+ And a big hand to everyone else who gave me appreciation, advice,
+ and suggestions, especially the good folks on the SDL mailing list.
+
+THANKS! :)
+
+  -- Sam Lantinga			<[email protected]>
+

+ 0 - 27
ThirdParty/SDL/INSTALL

@@ -1,27 +0,0 @@
-
-To compile and install SDL:
-
-    0.  If you have downloaded this from the website, skip to the next step.
-        If you have checked this out from subversion, you'll need to run
-        ./autogen.sh to build the configure script. 
-
-    1.  Run './configure; make; make install'
-
-        If you are compiling for Windows using gcc, read the FAQ at:
-        http://www.libsdl.org/faq.php?action=listentries&category=4#42
-
-        If you are compiling using Visual C++ on Win32, you should read
-        the file VisualC.html
-
-    2.  Look at the example programs in ./test, and check out the HTML
-        documentation in ./docs to see how to use the SDL library.
-
-    3.  Join the SDL developer mailing list by sending E-mail to
-    	[email protected]
-        and put "subscribe" in the subject of the message.
-
-        Or alternatively you can use the web interface:
-            http://www.libsdl.org/mailing-list.php
-
-That's it!
-Sam Lantinga <[email protected]>

+ 40 - 0
ThirdParty/SDL/INSTALL.txt

@@ -0,0 +1,40 @@
+
+To compile and install SDL:
+
+    1.  Windows with Visual Studio:
+        * Read VisualC.html
+
+        Windows with gcc, either native or cross-compiling:
+        * Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows
+        * Run './configure; make; make install'
+
+        Mac OS X with Xcode:
+        * Read README-macosx.txt
+
+        Mac OS X from the command line:
+        * Run './configure; make; make install'
+
+        Linux and other UNIX systems:
+        * Run './configure; make; make install'
+
+        Android:
+        * Read README-android.txt
+
+        iOS:
+        * Read README-ios.txt
+
+        Using Cmake:
+        * Read README-cmake.txt
+
+    2.  Look at the example programs in ./test, and check out the online
+        documentation at http://wiki.libsdl.org/
+
+    3.  Join the SDL developer mailing list by sending E-mail to
+    	[email protected]
+        and put "subscribe" in the subject of the message.
+
+        Or alternatively you can use the web interface:
+            http://www.libsdl.org/mailing-list.php
+
+That's it!
+Sam Lantinga <[email protected]>

+ 13 - 13
ThirdParty/SDL/README-SDL.txt

@@ -1,13 +1,13 @@
-
-Please distribute this file with the SDL runtime environment:
-
-The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
-designed to make it easy to write multi-media software, such as games and
-emulators.
-
-The Simple DirectMedia Layer library source code is available from:
-http://www.libsdl.org/
-
-This library is distributed under the terms of the zlib license:
-http://www.zlib.net/zlib_license.html
-
+
+Please distribute this file with the SDL runtime environment:
+
+The Simple DirectMedia Layer (SDL for short) is a cross-platform library
+designed to make it easy to write multi-media software, such as games and
+emulators.
+
+The Simple DirectMedia Layer library source code is available from:
+http://www.libsdl.org/
+
+This library is distributed under the terms of the zlib license:
+http://www.zlib.net/zlib_license.html
+

+ 39 - 45
ThirdParty/SDL/README → ThirdParty/SDL/README.txt

@@ -1,45 +1,39 @@
-
-                         Simple DirectMedia Layer
-
-                                  (SDL)
-
-                                Version 2.0
-
----
-http://www.libsdl.org/
-
-This is the Simple DirectMedia Layer, a general API that provides low
-level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
-and 2D framebuffer across multiple platforms.
-
-The current version supports Windows, Windows CE, Mac OS X, Linux, FreeBSD,
-NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
-support for other operating systems but those are not officially supported.
-
-SDL is written in C, but works with C++ natively, and has bindings to
-several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
-Go, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
-Pike, Pliant, Python, Ruby, and Smalltalk.
-
-This library is distributed under the zlib license, which can be found
-in the file "COPYING".
-
-The best way to learn how to use SDL is to check out the header files in
-the "include" subdirectory and the programs in the "test" subdirectory.
-The header files and test programs are well commented and always up to date.
-More documentation is available in HTML format in "docs/index.html", and
-a documentation wiki is available online at:
-	http://www.libsdl.org/cgi/docwiki.cgi
-
-The test programs in the "test" subdirectory are in the public domain.
-
-Frequently asked questions are answered online:
-	http://www.libsdl.org/faq.php
-
-If you need help with the library, or just want to discuss SDL related
-issues, you can join the developers mailing list:
-	http://www.libsdl.org/mailing-list.php
-
-Enjoy!
-	Sam Lantinga				([email protected])
-
+
+                         Simple DirectMedia Layer
+
+                                  (SDL)
+
+                                Version 2.0
+
+---
+http://www.libsdl.org/
+
+This is the Simple DirectMedia Layer, a general API that provides low
+level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
+and 2D framebuffer across multiple platforms.
+
+The current version supports Windows, Mac OS X, Linux, FreeBSD,
+NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
+support for other operating systems but those are not officially supported.
+
+SDL is written in C, but works with C++ natively, and has bindings to
+several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
+Go, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
+Pike, Pliant, Python, Ruby, and Smalltalk.
+
+This library is distributed under the zlib license, which can be found
+in the file "COPYING.txt".
+
+The best way to learn how to use SDL is to check out the header files in
+the "include" subdirectory and the programs in the "test" subdirectory.
+The header files and test programs are well commented and always up to date.
+More documentation and FAQs are available online at:
+	http://wiki.libsdl.org/
+
+If you need help with the library, or just want to discuss SDL related
+issues, you can join the developers mailing list:
+	http://www.libsdl.org/mailing-list.php
+
+Enjoy!
+	Sam Lantinga				([email protected])
+

+ 15 - 16
ThirdParty/SDL/TODO → ThirdParty/SDL/TODO.txt

@@ -1,16 +1,15 @@
-2.0 release checklist:
- * http://wiki.libsdl.org/moin.cgi/Roadmap
-
- * See why windows are being rearranged.  Is the shield window not up?
- * Make sure you can create and show a fullscreen window in one step
- * Write automated test case for multi-draw APIs
- * Implement assertion code on iPhone
- * Add __WINDOWS__ in addition to __WIN32__
-
- * Check 1.2 revisions:
-	3554 - Need to resolve semantics for locking keys on different platforms
-	4874 - Do we want screen rotation?  At what level?
-	4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
-	4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
-	4865 - See if this is still needed (mouse coordinate clamping)
-	4866 - See if this is still needed (blocking window repositioning)
+Future work roadmap:
+ * http://wiki.libsdl.org/moin.cgi/Roadmap
+
+ * See why windows are being rearranged.  Is the shield window not up?
+ * Add __WINDOWS__ in addition to __WIN32__
+ * Write test for fullscreen gamma to check X11 colormap handling
+
+ * Check 1.2 revisions:
+	3554 - Need to resolve semantics for locking keys on different platforms
+	4874 - Do we want screen rotation?  At what level?
+	4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
+	4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
+	4865 - See if this is still needed (mouse coordinate clamping)
+	4866 - See if this is still needed (blocking window repositioning)
+

+ 0 - 1
ThirdParty/SDL/UNDER_CONSTRUCTION.txt

@@ -1 +0,0 @@
-WARNING: This code is under construction, may not build, and is unstable!

+ 28 - 30
ThirdParty/SDL/include/SDL.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,49 +21,42 @@
 
 /**
  *  \file SDL.h
- *  
+ *
  *  Main include header for the SDL library
  */
 
 /**
  *  \mainpage Simple DirectMedia Layer (SDL)
- *  
+ *
  *  http://www.libsdl.org/
- *  
+ *
  *  \section intro_sec Introduction
- *  
+ *
  *  This is the Simple DirectMedia Layer, a general API that provides low
  *  level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
  *  and 2D framebuffer across multiple platforms.
- *  
+ *
  *  SDL is written in C, but works with C++ natively, and has bindings to
  *  several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
  *  Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
  *  Pike, Pliant, Python, Ruby, and Smalltalk.
- *  
- *  This library is distributed under GNU LGPL version 2, which can be
+ *
+ *  This library is distributed under the zlib license, which can be
  *  found in the file  "COPYING".  This license allows you to use SDL
- *  freely in commercial programs as long as you link with the dynamic
- *  library.
- *  
+ *  freely for any purpose as long as you retain the copyright notice.
+ *
  *  The best way to learn how to use SDL is to check out the header files in
  *  the "include" subdirectory and the programs in the "test" subdirectory.
  *  The header files and test programs are well commented and always up to date.
- *  More documentation is available in HTML format in "docs/index.html", and
- *  a documentation wiki is available online at:
- *  	http://www.libsdl.org/cgi/docwiki.cgi
- *  
- *  The test programs in the "test" subdirectory are in the public domain.
- *  
- *  Frequently asked questions are answered online:
- *  	http://www.libsdl.org/faq.php
- *  
+ *  More documentation and FAQs are available online at:
+ *      http://wiki.libsdl.org/
+ *
  *  If you need help with the library, or just want to discuss SDL related
  *  issues, you can join the developers mailing list:
- *  	http://www.libsdl.org/mailing-list.php
- *  
+ *      http://www.libsdl.org/mailing-list.php
+ *
  *  Enjoy!
- *  	Sam Lantinga				([email protected])
+ *      Sam Lantinga                ([email protected])
  */
 
 #ifndef _SDL_H
@@ -79,13 +72,18 @@
 #include "SDL_endian.h"
 #include "SDL_error.h"
 #include "SDL_events.h"
+#include "SDL_joystick.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_haptic.h"
 #include "SDL_hints.h"
 #include "SDL_loadso.h"
 #include "SDL_log.h"
+#include "SDL_messagebox.h"
 #include "SDL_mutex.h"
 #include "SDL_power.h"
 #include "SDL_render.h"
 #include "SDL_rwops.h"
+#include "SDL_system.h"
 #include "SDL_thread.h"
 #include "SDL_timer.h"
 #include "SDL_version.h"
@@ -94,16 +92,14 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /* As of version 0.5, SDL is loaded dynamically into the application */
 
 /**
  *  \name SDL_INIT_*
- *  
+ *
  *  These are the flags which may be passed to SDL_Init().  You should
  *  specify the subsystems which you will be using in your application.
  */
@@ -113,8 +109,12 @@ extern "C" {
 #define SDL_INIT_VIDEO          0x00000020
 #define SDL_INIT_JOYSTICK       0x00000200
 #define SDL_INIT_HAPTIC         0x00001000
+#define SDL_INIT_GAMECONTROLLER 0x00002000      /**< turn on game controller also implicitly does JOYSTICK */
 #define SDL_INIT_NOPARACHUTE    0x00100000      /**< Don't catch fatal signals */
-#define SDL_INIT_EVERYTHING     0x0000FFFF
+#define SDL_INIT_EVERYTHING ( \
+                SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \
+                SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
+            )
 /*@}*/
 
 /**
@@ -137,7 +137,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
 /**
  *  This function returns a mask of the specified subsystems which have
  *  previously been initialized.
- *  
+ *
  *  If \c flags is 0, it returns a mask of all initialized subsystems.
  */
 extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
@@ -150,9 +150,7 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 6 - 10
ThirdParty/SDL/include/SDL_assert.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -27,9 +27,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 #ifndef SDL_ASSERT_LEVEL
@@ -49,9 +47,9 @@ on the assertion line and not in some random guts of SDL, and so each
 assert can have unique static variables associated with it.
 */
 
-#if defined(_MSC_VER) && !defined(_WIN32_WCE)
+#if defined(_MSC_VER)
 /* Don't include intrin.h here because it contains C++ code */
-extern void __cdecl __debugbreak(void);
+    extern void __cdecl __debugbreak(void);
     #define SDL_TriggerBreakpoint() __debugbreak()
 #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
     #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
@@ -91,8 +89,6 @@ disable assertions.
 #define SDL_disabled_assert(condition) \
     do { (void) sizeof ((condition)); } while (0)
 
-#if (SDL_ASSERT_LEVEL > 0)
-
 typedef enum
 {
     SDL_ASSERTION_RETRY,  /**< Retry the assert immediately. */
@@ -113,6 +109,8 @@ typedef struct SDL_assert_data
     const struct SDL_assert_data *next;
 } SDL_assert_data;
 
+#if (SDL_ASSERT_LEVEL > 0)
+
 /* Never call this directly. Use the SDL_assert* macros. */
 extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
                                                              const char *,
@@ -187,7 +185,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
  *  This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
  *
  *  \return SDL_assert_state value of how to handle the assertion failure.
- *  
+ *
  *  \param handler Callback function, called when an assertion fails.
  *  \param userdata A pointer passed to the callback as-is.
  */
@@ -230,9 +228,7 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 22 - 28
ThirdParty/SDL/include/SDL_atomic.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,25 +21,25 @@
 
 /**
  * \file SDL_atomic.h
- * 
+ *
  * Atomic operations.
- * 
+ *
  * IMPORTANT:
  * If you are not an expert in concurrent lockless programming, you should
  * only be using the atomic lock and reference counting functions in this
  * file.  In all other cases you should be protecting your data structures
  * with full mutexes.
- * 
+ *
  * The list of "safe" functions to use are:
  *  SDL_AtomicLock()
  *  SDL_AtomicUnlock()
  *  SDL_AtomicIncRef()
  *  SDL_AtomicDecRef()
- * 
+ *
  * Seriously, here be dragons!
  * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  *
- * You can find out a little more about lockless programming and the 
+ * You can find out a little more about lockless programming and the
  * subtle issues that can arise here:
  * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
  *
@@ -65,21 +65,19 @@
 
 /* Need to do this here because intrin.h has C++ code in it */
 /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(_WIN32_WCE)
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
 #include <intrin.h>
 #define HAVE_MSC_ATOMICS 1
 #endif
 
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  * \name SDL AtomicLock
- * 
+ *
  * The atomic locks are efficient spinlocks using CPU instructions,
  * but are vulnerable to starvation and can spin forever if a thread
  * holding a lock has been terminated.  For this reason you should
@@ -98,7 +96,7 @@ typedef int SDL_SpinLock;
 
 /**
  * \brief Try to lock a spin lock by setting it to a non-zero value.
- * 
+ *
  * \param lock Points to the lock.
  *
  * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
@@ -107,7 +105,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
 
 /**
  * \brief Lock a spin lock by setting it to a non-zero value.
- * 
+ *
  * \param lock Points to the lock.
  */
 extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
@@ -126,7 +124,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
  * The compiler barrier prevents the compiler from reordering
  * reads and writes to globally visible variables across the call.
  */
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && (_MSC_VER > 1200)
 void _ReadWriteBarrier(void);
 #pragma intrinsic(_ReadWriteBarrier)
 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
@@ -134,7 +132,7 @@ void _ReadWriteBarrier(void);
 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
 #else
 #define SDL_CompilerBarrier()   \
-({ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); })
+{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
 #endif
 
 /* Platform specific optimized versions of the atomic functions,
@@ -161,10 +159,10 @@ void _ReadWriteBarrier(void);
 #include <libkern/OSAtomic.h>
 
 #define SDL_AtomicCAS(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((oldval), (newval), &(a)->value)
-#if SIZEOF_VOIDP == 4
-#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a))
-#elif SIZEOF_VOIDP == 8
+#ifdef __LP64__
 #define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier((int64_t)(oldval), (int64_t)(newval), (int64_t*)(a))
+#else
+#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a))
 #endif
 
 #elif defined(HAVE_GCC_ATOMICS)
@@ -196,9 +194,8 @@ typedef struct { int value; } SDL_atomic_t;
  * \note If you don't know what this function is for, you shouldn't use it!
 */
 #ifndef SDL_AtomicCAS
-#define SDL_AtomicCAS SDL_AtomicCAS_
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
 #endif
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);
 
 /**
  * \brief Set an atomic variable to a value.
@@ -206,7 +203,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int
  * \return The previous value of the atomic variable.
  */
 #ifndef SDL_AtomicSet
-static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
+SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
 {
     int value;
     do {
@@ -220,7 +217,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
  * \brief Get the value of an atomic variable
  */
 #ifndef SDL_AtomicGet
-static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
+SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
 {
     int value = a->value;
     SDL_CompilerBarrier();
@@ -236,7 +233,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
  * \note This same style can be used for any number operation
  */
 #ifndef SDL_AtomicAdd
-static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
+SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
 {
     int value;
     do {
@@ -271,9 +268,8 @@ static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
  * \note If you don't know what this function is for, you shouldn't use it!
 */
 #ifndef SDL_AtomicCASPtr
-#define SDL_AtomicCASPtr SDL_AtomicCASPtr_
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
 #endif
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);
 
 /**
  * \brief Set a pointer to a value atomically.
@@ -281,7 +277,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void
  * \return The previous value of the pointer.
  */
 #ifndef SDL_AtomicSetPtr
-static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
+SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
 {
     void* value;
     do {
@@ -295,7 +291,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
  * \brief Get the value of a pointer atomically.
  */
 #ifndef SDL_AtomicGetPtr
-static __inline__ void* SDL_AtomicGetPtr(void* *a)
+SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
 {
     void* value = *a;
     SDL_CompilerBarrier();
@@ -306,9 +302,7 @@ static __inline__ void* SDL_AtomicGetPtr(void* *a)
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 
 #include "close_code.h"

+ 60 - 68
ThirdParty/SDL/include/SDL_audio.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_audio.h
- *  
+ *
  *  Access to the raw audio mixing buffer for the SDL library.
  */
 
@@ -38,17 +38,15 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \brief Audio format flags.
- *  
+ *
  *  These are what the 16 bits in SDL_AudioFormat currently mean...
  *  (Unspecified bits are always zero).
- *  
+ *
  *  \verbatim
     ++-----------------------sample is signed if set
     ||
@@ -60,7 +58,7 @@ extern "C" {
     ||       ||          || |                     |
     15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
     \endverbatim
- *  
+ *
  *  There are macros in SDL 2.0 and later to query these bits.
  */
 typedef Uint16 SDL_AudioFormat;
@@ -82,42 +80,38 @@ typedef Uint16 SDL_AudioFormat;
 #define SDL_AUDIO_ISLITTLEENDIAN(x)  (!SDL_AUDIO_ISBIGENDIAN(x))
 #define SDL_AUDIO_ISUNSIGNED(x)      (!SDL_AUDIO_ISSIGNED(x))
 
-/** 
+/**
  *  \name Audio format flags
  *
  *  Defaults to LSB byte order.
  */
 /*@{*/
-#define AUDIO_U8	0x0008  /**< Unsigned 8-bit samples */
-#define AUDIO_S8	0x8008  /**< Signed 8-bit samples */
-#define AUDIO_U16LSB	0x0010  /**< Unsigned 16-bit samples */
-#define AUDIO_S16LSB	0x8010  /**< Signed 16-bit samples */
-#define AUDIO_U16MSB	0x1010  /**< As above, but big-endian byte order */
-#define AUDIO_S16MSB	0x9010  /**< As above, but big-endian byte order */
-#define AUDIO_U16	AUDIO_U16LSB
-#define AUDIO_S16	AUDIO_S16LSB
+#define AUDIO_U8        0x0008  /**< Unsigned 8-bit samples */
+#define AUDIO_S8        0x8008  /**< Signed 8-bit samples */
+#define AUDIO_U16LSB    0x0010  /**< Unsigned 16-bit samples */
+#define AUDIO_S16LSB    0x8010  /**< Signed 16-bit samples */
+#define AUDIO_U16MSB    0x1010  /**< As above, but big-endian byte order */
+#define AUDIO_S16MSB    0x9010  /**< As above, but big-endian byte order */
+#define AUDIO_U16       AUDIO_U16LSB
+#define AUDIO_S16       AUDIO_S16LSB
 /*@}*/
 
 /**
  *  \name int32 support
- *  
- *  New to SDL 1.3.
  */
 /*@{*/
-#define AUDIO_S32LSB	0x8020  /**< 32-bit integer samples */
-#define AUDIO_S32MSB	0x9020  /**< As above, but big-endian byte order */
-#define AUDIO_S32	AUDIO_S32LSB
+#define AUDIO_S32LSB    0x8020  /**< 32-bit integer samples */
+#define AUDIO_S32MSB    0x9020  /**< As above, but big-endian byte order */
+#define AUDIO_S32       AUDIO_S32LSB
 /*@}*/
 
 /**
  *  \name float32 support
- *  
- *  New to SDL 1.3.
  */
 /*@{*/
-#define AUDIO_F32LSB	0x8120  /**< 32-bit floating point samples */
-#define AUDIO_F32MSB	0x9120  /**< As above, but big-endian byte order */
-#define AUDIO_F32	AUDIO_F32LSB
+#define AUDIO_F32LSB    0x8120  /**< 32-bit floating point samples */
+#define AUDIO_F32MSB    0x9120  /**< As above, but big-endian byte order */
+#define AUDIO_F32       AUDIO_F32LSB
 /*@}*/
 
 /**
@@ -125,21 +119,21 @@ typedef Uint16 SDL_AudioFormat;
  */
 /*@{*/
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define AUDIO_U16SYS	AUDIO_U16LSB
-#define AUDIO_S16SYS	AUDIO_S16LSB
-#define AUDIO_S32SYS	AUDIO_S32LSB
-#define AUDIO_F32SYS	AUDIO_F32LSB
+#define AUDIO_U16SYS    AUDIO_U16LSB
+#define AUDIO_S16SYS    AUDIO_S16LSB
+#define AUDIO_S32SYS    AUDIO_S32LSB
+#define AUDIO_F32SYS    AUDIO_F32LSB
 #else
-#define AUDIO_U16SYS	AUDIO_U16MSB
-#define AUDIO_S16SYS	AUDIO_S16MSB
-#define AUDIO_S32SYS	AUDIO_S32MSB
-#define AUDIO_F32SYS	AUDIO_F32MSB
+#define AUDIO_U16SYS    AUDIO_U16MSB
+#define AUDIO_S16SYS    AUDIO_S16MSB
+#define AUDIO_S32SYS    AUDIO_S32MSB
+#define AUDIO_F32SYS    AUDIO_F32MSB
 #endif
 /*@}*/
 
-/** 
+/**
  *  \name Allow change flags
- *  
+ *
  *  Which audio format changes are allowed when opening a device.
  */
 /*@{*/
@@ -209,7 +203,7 @@ typedef struct SDL_AudioCVT
 
 /**
  *  \name Driver discovery functions
- *  
+ *
  *  These functions return the list of built in audio drivers, in the
  *  order that they are normally initialized by default.
  */
@@ -220,9 +214,9 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
 
 /**
  *  \name Initialization and cleanup
- *  
+ *
  *  \internal These functions are used internally, and should not be used unless
- *            you have a specific need to specify the audio driver you want to 
+ *            you have a specific need to specify the audio driver you want to
  *            use.  You should normally use SDL_Init() or SDL_InitSubSystem().
  */
 /*@{*/
@@ -242,20 +236,20 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
  *  structure pointed to by \c obtained.  If \c obtained is NULL, the audio
  *  data passed to the callback function will be guaranteed to be in the
  *  requested format, and will be automatically converted to the hardware
- *  audio format if necessary.  This function returns -1 if it failed 
+ *  audio format if necessary.  This function returns -1 if it failed
  *  to open the audio device, or couldn't set up the audio thread.
- *  
+ *
  *  When filling in the desired audio spec structure,
  *    - \c desired->freq should be the desired audio frequency in samples-per-
  *      second.
  *    - \c desired->format should be the desired audio format.
- *    - \c desired->samples is the desired size of the audio buffer, in 
- *      samples.  This number should be a power of two, and may be adjusted by 
+ *    - \c desired->samples is the desired size of the audio buffer, in
+ *      samples.  This number should be a power of two, and may be adjusted by
  *      the audio driver to a value more suitable for the hardware.  Good values
- *      seem to range between 512 and 8096 inclusive, depending on the 
- *      application and CPU speed.  Smaller values yield faster response time, 
- *      but can lead to underflow if the application is doing heavy processing 
- *      and cannot fill the audio buffer in time.  A stereo sample consists of 
+ *      seem to range between 512 and 8096 inclusive, depending on the
+ *      application and CPU speed.  Smaller values yield faster response time,
+ *      but can lead to underflow if the application is doing heavy processing
+ *      and cannot fill the audio buffer in time.  A stereo sample consists of
  *      both right and left channels in LR ordering.
  *      Note that the number of samples is directly related to time by the
  *      following formula:  \code ms = (samples*1000)/freq \endcode
@@ -271,7 +265,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
  *      and SDL_UnlockAudio() in your code.
  *    - \c desired->userdata is passed as the first parameter to your callback
  *      function.
- *  
+ *
  *  The audio device starts out playing silence when it's opened, and should
  *  be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
  *  for your audio callback function to be called.  Since the audio driver
@@ -283,7 +277,7 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
 
 /**
  *  SDL Audio Device IDs.
- *  
+ *
  *  A successful call to SDL_OpenAudio() is always device id 1, and legacy
  *  SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
  *  always returns devices >= 2 on success. The legacy calls are good both
@@ -299,7 +293,7 @@ typedef Uint32 SDL_AudioDeviceID;
  *  not an error. For example, if SDL is set up to talk to a remote audio
  *  server, it can't list every one available on the Internet, but it will
  *  still allow a specific host to be specified to SDL_OpenAudioDevice().
- *  
+ *
  *  In many common cases, when this function returns a value <= 0, it can still
  *  successfully open the default device (NULL for first argument of
  *  SDL_OpenAudioDevice()).
@@ -313,7 +307,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
  *  The values returned by this function reflect the latest call to
  *  SDL_GetNumAudioDevices(); recall that function to redetect available
  *  hardware.
- *  
+ *
  *  The string returned by this function is UTF-8 encoded, read-only, and
  *  managed internally. You are not to free it. If you need to keep the
  *  string for any length of time, you should make your own copy of it, as it
@@ -326,14 +320,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
 /**
  *  Open a specific audio device. Passing in a device name of NULL requests
  *  the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
- *  
+ *
  *  The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
  *  some drivers allow arbitrary and driver-specific strings, such as a
  *  hostname/IP address for a remote audio server, or a filename in the
  *  diskaudio driver.
- *  
+ *
  *  \return 0 on error, a valid device ID that is >= 2 on success.
- *  
+ *
  *  SDL_OpenAudio(), unlike this function, always acts on device ID 1.
  */
 extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
@@ -351,7 +345,7 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
 
 /**
  *  \name Audio state
- *  
+ *
  *  Get the current audio state.
  */
 /*@{*/
@@ -369,7 +363,7 @@ SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
 
 /**
  *  \name Pause audio functions
- *  
+ *
  *  These functions pause and unpause the audio callback processing.
  *  They should be called with a parameter of 0 after opening the audio
  *  device to start playing sound.  This is so you can safely initialize
@@ -387,18 +381,18 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
  *  that source if \c freesrc is non-zero.  For example, to load a WAVE file,
  *  you could do:
  *  \code
- *  	SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
+ *      SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
  *  \endcode
  *
  *  If this function succeeds, it returns the given SDL_AudioSpec,
  *  filled with the audio data format of the wave data, and sets
  *  \c *audio_buf to a malloc()'d buffer containing the audio data,
  *  and sets \c *audio_len to the length of that audio buffer, in bytes.
- *  You need to free the audio buffer with SDL_FreeWAV() when you are 
+ *  You need to free the audio buffer with SDL_FreeWAV() when you are
  *  done with it.
  *
- *  This function returns NULL and sets the SDL error message if the 
- *  wave file cannot be opened, uses an unknown data format, or is 
+ *  This function returns NULL and sets the SDL error message if the
+ *  wave file cannot be opened, uses an unknown data format, or is
  *  corrupt.  Currently raw and MS-ADPCM WAVE files are supported.
  */
 extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
@@ -407,12 +401,12 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
                                                       Uint8 ** audio_buf,
                                                       Uint32 * audio_len);
 
-/** 
+/**
  *  Loads a WAV from a file.
  *  Compatibility convenience function.
  */
 #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
-	SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
+    SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
 
 /**
  *  This function frees data previously allocated with SDL_LoadWAV_RW()
@@ -424,7 +418,7 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
  *  and rate, and initializes the \c cvt structure with information needed
  *  by SDL_ConvertAudio() to convert a buffer of audio data from one format
  *  to the other.
- *  
+ *
  *  \return -1 if the format conversion is not supported, 0 if there's
  *  no conversion needed, or 1 if the audio filter is set up.
  */
@@ -441,7 +435,7 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
  *  created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
  *  audio data in the source format, this function will convert it in-place
  *  to the desired format.
- *  
+ *
  *  The data conversion may expand the size of the audio data, so the buffer
  *  \c cvt->buf should be allocated after the \c cvt structure is initialized by
  *  SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
@@ -471,9 +465,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
 
 /**
  *  \name Audio lock functions
- *  
+ *
  *  The lock manipulated by these functions protects the callback function.
- *  During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that 
+ *  During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
  *  the callback function is not running.  Do not call these from the callback
  *  function or you will cause deadlock.
  */
@@ -498,9 +492,7 @@ extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 90 - 0
ThirdParty/SDL/include/SDL_bits.h

@@ -0,0 +1,90 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_bits.h
+ *
+ *  Functions for fiddling with bits and bitmasks.
+ */
+
+#ifndef _SDL_bits_h
+#define _SDL_bits_h
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *  \file SDL_bits.h
+ */
+
+/**
+ *  Get the index of the most significant bit. Result is undefined when called
+ *  with 0. This operation can also be stated as "count leading zeroes" and
+ *  "log base 2".
+ *
+ *  \return Index of the most significant bit.
+ */
+SDL_FORCE_INLINE Sint8
+SDL_MostSignificantBitIndex32(Uint32 x)
+{
+#if defined(__GNUC__) && __GNUC__ >= 4
+    /* Count Leading Zeroes builtin in GCC.
+     * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
+     */
+    return 31 - __builtin_clz(x);
+#else
+    /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
+     * <[email protected]>, released in the public domain.
+     * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
+     */
+    const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
+    const Uint8  S[] = {1, 2, 4, 8, 16};
+
+    Uint8 msbIndex = 0;
+    int i;
+
+    for (i = 4; i >= 0; i--)
+    {
+        if (x & b[i])
+        {
+            x >>= S[i];
+            msbIndex |= S[i];
+        }
+    }
+
+    return msbIndex;
+#endif
+}
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_bits_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 6
ThirdParty/SDL/include/SDL_blendmode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_blendmode.h
- *  
+ *
  *  Header file declaring the SDL_BlendMode enumeration
  */
 
@@ -31,9 +31,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -49,9 +47,7 @@ typedef enum
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 1 - 5
ThirdParty/SDL/include/SDL_clipboard.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,9 +33,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /* Function prototypes */
@@ -64,9 +62,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 1 - 5
ThirdParty/SDL/include/SDL_config.h

@@ -30,11 +30,7 @@
  *  \file SDL_config.h
  */
 
-#define SDL_POWER_DISABLED 1
-#define SDL_RENDER_DISABLED 1
-#define SDL_HAPTIC_DISABLED 1
-
-/* Add any platform that doesn't build using the configure system. */
+// Urho3D: choose from prebuilt config files on all OSes
 #if defined(__WIN32__)
 #include "SDL_config_windows.h"
 #elif defined(__MACOSX__)

+ 83 - 82
ThirdParty/SDL/include/SDL_config_android.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #ifndef _SDL_config_android_h
 #define _SDL_config_android_h
 
@@ -28,108 +26,111 @@
 
 /**
  *  \file SDL_config_android.h
- *  
+ *
  *  This is a configuration that can be used to build SDL for Android
  */
 
 #include <stdarg.h>
 
-#define HAVE_ALLOCA_H		1
-#define HAVE_SYS_TYPES_H	1
-#define HAVE_STDIO_H	1
-#define STDC_HEADERS	1
-#define HAVE_STRING_H	1
-#define HAVE_INTTYPES_H	1
-#define HAVE_STDINT_H	1
-#define HAVE_CTYPE_H	1
-#define HAVE_MATH_H	1
-#define HAVE_SIGNAL_H	1
+#define HAVE_ALLOCA_H       1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_STDIO_H    1
+#define STDC_HEADERS    1
+#define HAVE_STRING_H   1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_CTYPE_H    1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H   1
 
 /* C library functions */
-#define HAVE_MALLOC	1
-#define HAVE_CALLOC	1
-#define HAVE_REALLOC	1
-#define HAVE_FREE	1
-#define HAVE_ALLOCA	1
-#define HAVE_GETENV	1
-#define HAVE_SETENV	1
-#define HAVE_PUTENV	1
-#define HAVE_SETENV	1
-#define HAVE_UNSETENV	1
-#define HAVE_QSORT	1
-#define HAVE_ABS	1
-#define HAVE_BCOPY	1
-#define HAVE_MEMSET	1
-#define HAVE_MEMCPY	1
-#define HAVE_MEMMOVE	1
-#define HAVE_MEMCMP	1
-#define HAVE_STRLEN	1
-#define HAVE_STRLCPY	1
-#define HAVE_STRLCAT	1
-#define HAVE_STRDUP	1
-#define HAVE_STRCHR	1
-#define HAVE_STRRCHR	1
-#define HAVE_STRSTR	1
-#define HAVE_STRTOL	1
-#define HAVE_STRTOUL	1
-#define HAVE_STRTOLL	1
-#define HAVE_STRTOULL	1
-#define HAVE_STRTOD	1
-#define HAVE_ATOI	1
-#define HAVE_ATOF	1
-#define HAVE_STRCMP	1
-#define HAVE_STRNCMP	1
-#define HAVE_STRCASECMP	1
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC    1
+#define HAVE_FREE   1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV   1
+#define HAVE_QSORT  1
+#define HAVE_ABS    1
+#define HAVE_BCOPY  1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE    1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY    1
+#define HAVE_STRLCAT    1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR    1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL    1
+#define HAVE_STRTOLL    1
+#define HAVE_STRTOULL   1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI   1
+#define HAVE_ATOF   1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP    1
+#define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF	1
-#define HAVE_SNPRINTF	1
-#define HAVE_VSNPRINTF	1
-#define HAVE_M_PI	1
-#define HAVE_ATAN	1
-#define HAVE_ATAN2	1
-#define HAVE_CEIL	1
-#define HAVE_COPYSIGN	1
-#define HAVE_COS	1
-#define HAVE_COSF	1
-#define HAVE_FABS	1
-#define HAVE_FLOOR	1
-#define HAVE_LOG	1
-#define HAVE_POW	1
-#define HAVE_SCALBN	1
-#define HAVE_SIN	1
-#define HAVE_SINF	1
-#define HAVE_SQRT	1
-#define HAVE_SIGACTION	1
-#define HAVE_SETJMP	1
-#define HAVE_NANOSLEEP	1
-#define HAVE_SYSCONF	1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF   1
+#define HAVE_VSNPRINTF  1
+#define HAVE_M_PI   1
+#define HAVE_ATAN   1
+#define HAVE_ATAN2  1
+#define HAVE_CEIL   1
+#define HAVE_COPYSIGN   1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FLOOR  1
+#define HAVE_LOG    1
+#define HAVE_POW    1
+#define HAVE_SCALBN 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SIGACTION  1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP  1
+#define HAVE_SYSCONF    1
 
 #define SIZEOF_VOIDP 4
 
 /* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_ANDROID	1
-#define SDL_AUDIO_DRIVER_DUMMY	1
+#define SDL_AUDIO_DRIVER_ANDROID    1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable various input drivers */
-#define SDL_JOYSTICK_ANDROID	1
-#define SDL_HAPTIC_DUMMY	1
+#define SDL_JOYSTICK_ANDROID    1
+#define SDL_HAPTIC_DUMMY    1
 
 /* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN	1
+#define SDL_LOADSO_DLOPEN   1
 
 /* Enable various threading systems */
-#define SDL_THREAD_PTHREAD	1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX	1
+#define SDL_THREAD_PTHREAD  1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX  1
 
 /* Enable various timer systems */
-#define SDL_TIMER_UNIX	1
+#define SDL_TIMER_UNIX  1
 
 /* Enable various video drivers */
 #define SDL_VIDEO_DRIVER_ANDROID 1
 
 /* Enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES	1
-#define SDL_VIDEO_RENDER_OGL_ES	1
-#define SDL_VIDEO_RENDER_OGL_ES2	1
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2    1
+
+/* Enable system power support */
+#define SDL_POWER_ANDROID 1
 
-#endif /* _SDL_config_minimal_h */
+#endif /* _SDL_config_android_h */

+ 80 - 82
ThirdParty/SDL/include/SDL_config_iphoneos.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #ifndef _SDL_config_iphoneos_h
 #define _SDL_config_iphoneos_h
 
@@ -32,112 +30,112 @@
 #define SIZEOF_VOIDP 4
 #endif
 
-#define HAVE_GCC_ATOMICS	1
+#define HAVE_GCC_ATOMICS    1
 
-#define HAVE_ALLOCA_H		1
-#define HAVE_SYS_TYPES_H	1
-#define HAVE_STDIO_H	1
-#define STDC_HEADERS	1
-#define HAVE_STRING_H	1
-#define HAVE_INTTYPES_H	1
-#define HAVE_STDINT_H	1
-#define HAVE_CTYPE_H	1
-#define HAVE_MATH_H	1
-#define HAVE_SIGNAL_H	1
+#define HAVE_ALLOCA_H       1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_STDIO_H    1
+#define STDC_HEADERS    1
+#define HAVE_STRING_H   1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_CTYPE_H    1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H   1
 
 /* C library functions */
-#define HAVE_MALLOC	1
-#define HAVE_CALLOC	1
-#define HAVE_REALLOC	1
-#define HAVE_FREE	1
-#define HAVE_ALLOCA	1
-#define HAVE_GETENV	1
-#define HAVE_SETENV	1
-#define HAVE_PUTENV	1
-#define HAVE_SETENV	1
-#define HAVE_UNSETENV	1
-#define HAVE_QSORT	1
-#define HAVE_ABS	1
-#define HAVE_BCOPY	1
-#define HAVE_MEMSET	1
-#define HAVE_MEMCPY	1
-#define HAVE_MEMMOVE	1
-#define HAVE_MEMCMP	1
-#define HAVE_STRLEN	1
-#define HAVE_STRLCPY	1
-#define HAVE_STRLCAT	1
-#define HAVE_STRDUP	1
-#define HAVE_STRCHR	1
-#define HAVE_STRRCHR	1
-#define HAVE_STRSTR	1
-#define HAVE_STRTOL	1
-#define HAVE_STRTOUL	1
-#define HAVE_STRTOLL	1
-#define HAVE_STRTOULL	1
-#define HAVE_STRTOD	1
-#define HAVE_ATOI	1
-#define HAVE_ATOF	1
-#define HAVE_STRCMP	1
-#define HAVE_STRNCMP	1
-#define HAVE_STRCASECMP	1
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC    1
+#define HAVE_FREE   1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV   1
+#define HAVE_QSORT  1
+#define HAVE_ABS    1
+#define HAVE_BCOPY  1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE    1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY    1
+#define HAVE_STRLCAT    1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR    1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL    1
+#define HAVE_STRTOLL    1
+#define HAVE_STRTOULL   1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI   1
+#define HAVE_ATOF   1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP    1
+#define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF	1
-#define HAVE_SNPRINTF	1
-#define HAVE_VSNPRINTF	1
-#define HAVE_M_PI	1
-#define HAVE_ATAN	1
-#define HAVE_ATAN2	1
-#define HAVE_CEIL	1
-#define HAVE_COPYSIGN	1
-#define HAVE_COS	1
-#define HAVE_COSF	1
-#define HAVE_FABS	1
-#define HAVE_FLOOR	1
-#define HAVE_LOG	1
-#define HAVE_POW	1
-#define HAVE_SCALBN	1
-#define HAVE_SIN	1
-#define HAVE_SINF	1
-#define HAVE_SQRT	1
-#define HAVE_SIGACTION	1
-#define HAVE_SETJMP	1
-#define HAVE_NANOSLEEP	1
-#define HAVE_SYSCONF	1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF   1
+#define HAVE_VSNPRINTF  1
+#define HAVE_M_PI   1
+#define HAVE_ATAN   1
+#define HAVE_ATAN2  1
+#define HAVE_CEIL   1
+#define HAVE_COPYSIGN   1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FLOOR  1
+#define HAVE_LOG    1
+#define HAVE_POW    1
+#define HAVE_SCALBN 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SIGACTION  1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP  1
+#define HAVE_SYSCONF    1
 #define HAVE_SYSCTLBYNAME 1
 
 /* enable iPhone version of Core Audio driver */
 #define SDL_AUDIO_DRIVER_COREAUDIO 1
 /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY	1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED	1
+#define SDL_HAPTIC_DISABLED 1
 
 /* Enable Unix style SO loading */
 /* Technically this works, but it violates the iPhone developer agreement */
 /* #define SDL_LOADSO_DLOPEN 1 */
 
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED	1
+#define SDL_LOADSO_DISABLED 1
 
 /* Enable various threading systems */
-#define SDL_THREAD_PTHREAD	1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX	1
+#define SDL_THREAD_PTHREAD  1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX  1
 
 /* Enable various timer systems */
-#define SDL_TIMER_UNIX	1
+#define SDL_TIMER_UNIX  1
 
 /* Supported video drivers */
-#define SDL_VIDEO_DRIVER_UIKIT	1
-#define SDL_VIDEO_DRIVER_DUMMY	1
+#define SDL_VIDEO_DRIVER_UIKIT  1
+#define SDL_VIDEO_DRIVER_DUMMY  1
 
 /* enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES	1
-#define SDL_VIDEO_RENDER_OGL_ES	1
-#define SDL_VIDEO_RENDER_OGL_ES2	1
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2    1
 
 /* Enable system power support */
-// #define SDL_POWER_UIKIT 1
+#define SDL_POWER_UIKIT 1
 
 /* enable iPhone keyboard support */
 #define SDL_IPHONE_KEYBOARD 1

+ 116 - 9
ThirdParty/SDL/include/SDL_config_linux.h

@@ -1,6 +1,7 @@
+/* include/SDL_config.h.  Generated from SDL_config.h.in by configure.  */
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +20,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #ifndef _SDL_config_linux_h
 #define _SDL_config_linux_h
 
@@ -33,7 +32,6 @@
 /* General platform specific identifiers */
 #include "SDL_platform.h"
 
-
 /* Make sure that this isn't included by Visual C++ */
 #ifdef _MSC_VER
 #error You should run hg revert SDL_config.h 
@@ -48,6 +46,7 @@
 #define SIZEOF_VOIDP 4
 #define HAVE_GCC_ATOMICS 1
 /* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
+#define HAVE_PTHREAD_SPINLOCK 1
 
 /* Comment this if you want to build without any C library requirements */
 #define HAVE_LIBC 1
@@ -71,6 +70,9 @@
 #define HAVE_ICONV_H 1
 #define HAVE_SIGNAL_H 1
 /* #undef HAVE_ALTIVEC_H */
+/* #undef HAVE_PTHREAD_NP_H */
+/* #undef HAVE_LIBUDEV_H */
+/* #undef HAVE_DBUS_DBUS_H */
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -140,58 +142,163 @@
 #define HAVE_SIN 1
 #define HAVE_SINF 1
 #define HAVE_SQRT 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSEEKO64 1
 #define HAVE_SIGACTION 1
+#define HAVE_SA_SIGACTION 1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP 1
 #define HAVE_SYSCONF 1
 /* #undef HAVE_SYSCTLBYNAME */
-/* #undef HAVE_CLOCK_GETTIME */
+#define HAVE_CLOCK_GETTIME 1
 /* #undef HAVE_GETPAGESIZE */
 #define HAVE_MPROTECT 1
 #define HAVE_ICONV 1
+#define HAVE_PTHREAD_SETNAME_NP 1
+/* #undef HAVE_PTHREAD_SET_NAME_NP */
+#define HAVE_SEM_TIMEDWAIT 1
 
 #else
-/* We may need some replacement for stdarg.h here */
-#include <stdarg.h>
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
 #endif /* HAVE_LIBC */
 
 /* SDL internal assertion support */
 /* #undef SDL_DEFAULT_ASSERT_LEVEL */
 
 /* Allow disabling of core subsystems */
+/* #undef SDL_ATOMIC_DISABLED */
+/* #undef SDL_AUDIO_DISABLED */
+/* #undef SDL_CPUINFO_DISABLED */
+/* #undef SDL_EVENTS_DISABLED */
+/* #undef SDL_FILE_DISABLED */
+/* #undef SDL_JOYSTICK_DISABLED */
+/* #undef SDL_HAPTIC_DISABLED */
+/* #undef SDL_LOADSO_DISABLED */
+/* #undef SDL_RENDER_DISABLED */
+/* #undef SDL_THREADS_DISABLED */
+/* #undef SDL_TIMERS_DISABLED */
+/* #undef SDL_VIDEO_DISABLED */
+/* #undef SDL_POWER_DISABLED */
 
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_ALSA 1
 #define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2"
+/* #undef SDL_AUDIO_DRIVER_ARTS */
+/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */
+/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_BEOSAUDIO */
+/* #undef SDL_AUDIO_DRIVER_BSD */
+/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+/* #undef SDL_AUDIO_DRIVER_XAUDIO2 */
+/* #undef SDL_AUDIO_DRIVER_DSOUND */
+/* #undef SDL_AUDIO_DRIVER_ESD */
+/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_NAS */
+/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
 #define SDL_AUDIO_DRIVER_OSS 1
+/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
+/* #undef SDL_AUDIO_DRIVER_PAUDIO */
+/* #undef SDL_AUDIO_DRIVER_QSA */
+/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
+/* #undef SDL_AUDIO_DRIVER_WINMM */
+/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
+/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
 
 /* Enable various input drivers */
 #define SDL_INPUT_LINUXEV 1
+/* #undef SDL_INPUT_TSLIB */
+/* #undef SDL_JOYSTICK_BEOS */
+/* #undef SDL_JOYSTICK_DINPUT */
+/* #undef SDL_JOYSTICK_DUMMY */
+/* #undef SDL_JOYSTICK_IOKIT */
 #define SDL_JOYSTICK_LINUX 1
+/* #undef SDL_JOYSTICK_WINMM */
+/* #undef SDL_JOYSTICK_USBHID */
+/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
+/* #undef SDL_HAPTIC_DUMMY */
+#define SDL_HAPTIC_LINUX 1
+/* #undef SDL_HAPTIC_IOKIT */
+/* #undef SDL_HAPTIC_DINPUT */
 
 /* Enable various shared object loading systems */
+/* #undef SDL_LOADSO_BEOS */
 #define SDL_LOADSO_DLOPEN 1
+/* #undef SDL_LOADSO_DUMMY */
+/* #undef SDL_LOADSO_LDG */
+/* #undef SDL_LOADSO_WINDOWS */
 
 /* Enable various threading systems */
+/* #undef SDL_THREAD_BEOS */
 #define SDL_THREAD_PTHREAD 1
 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
+/* #undef SDL_THREAD_WINDOWS */
 
 /* Enable various timer systems */
+/* #undef SDL_TIMER_BEOS */
+/* #undef SDL_TIMER_DUMMY */
 #define SDL_TIMER_UNIX 1
+/* #undef SDL_TIMER_WINDOWS */
 
 /* Enable various video drivers */
+/* #undef SDL_VIDEO_DRIVER_BWINDOW */
+/* #undef SDL_VIDEO_DRIVER_COCOA */
+/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
+/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+/* #undef SDL_VIDEO_DRIVER_WINDOWS */
 #define SDL_VIDEO_DRIVER_X11 1
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA */
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so.2"
-#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE */
+/* #undef SDL_VIDEO_DRIVER_X11_XCURSOR */
+/* #undef SDL_VIDEO_DRIVER_X11_XINERAMA */
+/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */
+/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
 #define SDL_VIDEO_DRIVER_X11_XRANDR 1
+/* #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+/* #undef SDL_VIDEO_DRIVER_X11_XVIDMODE */
+#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
+#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1
+/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */
+#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
+
+/* #undef SDL_VIDEO_RENDER_D3D */
+#define SDL_VIDEO_RENDER_OGL 1
+/* #undef SDL_VIDEO_RENDER_OGL_ES */
+/* #undef SDL_VIDEO_RENDER_OGL_ES2 */
+/* #undef SDL_VIDEO_RENDER_DIRECTFB */
 
 /* Enable OpenGL support */
 #define SDL_VIDEO_OPENGL 1
+/* #undef SDL_VIDEO_OPENGL_ES */
+/* #undef SDL_VIDEO_OPENGL_BGL */
+/* #undef SDL_VIDEO_OPENGL_CGL */
 #define SDL_VIDEO_OPENGL_GLX 1
+/* #undef SDL_VIDEO_OPENGL_WGL */
+/* #undef SDL_VIDEO_OPENGL_OSMESA */
+/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
+
+/* Enable system power support */
+#define SDL_POWER_LINUX 1
+/* #undef SDL_POWER_WINDOWS */
+/* #undef SDL_POWER_MACOSX */
+/* #undef SDL_POWER_BEOS */
+/* #undef SDL_POWER_HARDWIRED */
 
 /* Enable assembly routines */
 #define SDL_ASSEMBLY_ROUTINES 1
+/* #undef SDL_ALTIVEC_BLITTERS */
 
-#endif /* _SDL_config_linux_h */
+#endif /* _SDL_config_h */

+ 112 - 78
ThirdParty/SDL/include/SDL_config_macosx.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #ifndef _SDL_config_macosx_h
 #define _SDL_config_macosx_h
 
@@ -32,118 +30,154 @@
 /* This is a set of defines to configure the SDL features */
 
 #ifdef __LP64__
-	#define SIZEOF_VOIDP 8
+    #define SIZEOF_VOIDP 8
 #else
-	#define SIZEOF_VOIDP 4
+    #define SIZEOF_VOIDP 4
 #endif
 
 /* Useful headers */
 /* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
 #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
-#define HAVE_ALLOCA_H		1
+#define HAVE_ALLOCA_H       1
 #endif
-#define HAVE_SYS_TYPES_H	1
-#define HAVE_STDIO_H	1
-#define STDC_HEADERS	1
-#define HAVE_STRING_H	1
-#define HAVE_INTTYPES_H	1
-#define HAVE_STDINT_H	1
-#define HAVE_CTYPE_H	1
-#define HAVE_MATH_H	1
-#define HAVE_SIGNAL_H	1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_STDIO_H    1
+#define STDC_HEADERS    1
+#define HAVE_STRING_H   1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_CTYPE_H    1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H   1
 
 /* C library functions */
-#define HAVE_MALLOC	1
-#define HAVE_CALLOC	1
-#define HAVE_REALLOC	1
-#define HAVE_FREE	1
-#define HAVE_ALLOCA	1
-#define HAVE_GETENV	1
-#define HAVE_SETENV	1
-#define HAVE_PUTENV	1
-#define HAVE_UNSETENV	1
-#define HAVE_QSORT	1
-#define HAVE_ABS	1
-#define HAVE_BCOPY	1
-#define HAVE_MEMSET	1
-#define HAVE_MEMCPY	1
-#define HAVE_MEMMOVE	1
-#define HAVE_MEMCMP	1
-#define HAVE_STRLEN	1
-#define HAVE_STRLCPY	1
-#define HAVE_STRLCAT	1
-#define HAVE_STRDUP	1
-#define HAVE_STRCHR	1
-#define HAVE_STRRCHR	1
-#define HAVE_STRSTR	1
-#define HAVE_STRTOL	1
-#define HAVE_STRTOUL	1
-#define HAVE_STRTOLL	1
-#define HAVE_STRTOULL	1
-#define HAVE_STRTOD	1
-#define HAVE_ATOI	1
-#define HAVE_ATOF	1
-#define HAVE_STRCMP	1
-#define HAVE_STRNCMP	1
-#define HAVE_STRCASECMP	1
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC    1
+#define HAVE_FREE   1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV   1
+#define HAVE_QSORT  1
+#define HAVE_ABS    1
+#define HAVE_BCOPY  1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE    1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY    1
+#define HAVE_STRLCAT    1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR    1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL    1
+#define HAVE_STRTOLL    1
+#define HAVE_STRTOULL   1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI   1
+#define HAVE_ATOF   1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP    1
+#define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF	1
-#define HAVE_SNPRINTF	1
-#define HAVE_VSNPRINTF	1
-#define HAVE_CEIL	1
-#define HAVE_COPYSIGN	1
-#define HAVE_COS	1
-#define HAVE_COSF	1
-#define HAVE_FABS	1
-#define HAVE_FLOOR	1
-#define HAVE_LOG	1
-#define HAVE_POW	1
-#define HAVE_SCALBN	1
-#define HAVE_SIN	1
-#define HAVE_SINF	1
-#define HAVE_SQRT	1
-#define HAVE_SIGACTION	1
-#define HAVE_SETJMP	1
-#define HAVE_NANOSLEEP	1
-#define HAVE_SYSCONF	1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF   1
+#define HAVE_VSNPRINTF  1
+#define HAVE_CEIL   1
+#define HAVE_COPYSIGN   1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FLOOR  1
+#define HAVE_LOG    1
+#define HAVE_POW    1
+#define HAVE_SCALBN 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SIGACTION  1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP  1
+#define HAVE_SYSCONF    1
 #define HAVE_SYSCTLBYNAME 1
 #define HAVE_ATAN 1
 #define HAVE_ATAN2 1
 
 /* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO	1
+#define SDL_AUDIO_DRIVER_COREAUDIO  1
+#define SDL_AUDIO_DRIVER_DISK   1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT	1
+#define SDL_JOYSTICK_IOKIT  1
+#define SDL_HAPTIC_IOKIT    1
 
 /* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN	1
+#define SDL_LOADSO_DLOPEN   1
 
 /* Enable various threading systems */
-#define SDL_THREAD_PTHREAD	1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX	1
+#define SDL_THREAD_PTHREAD  1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX  1
 
 /* Enable various timer systems */
-#define SDL_TIMER_UNIX	1
+#define SDL_TIMER_UNIX  1
 
 /* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_COCOA	1
+#define SDL_VIDEO_DRIVER_COCOA  1
+#define SDL_VIDEO_DRIVER_DUMMY  1
+#undef SDL_VIDEO_DRIVER_X11
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XRANDR 1
+#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
+
+#ifdef MAC_OS_X_VERSION_10_8
+/*
+ * No matter the versions targeted, this is the 10.8 or later SDK, so you have
+ *  to use the external Xquartz, which is a more modern Xlib. Previous SDKs
+ *  used an older Xlib.
+ */
+#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
+#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
+#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL    1
+#endif
 
 /* Enable OpenGL support */
 #ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL	1
+#define SDL_VIDEO_OPENGL    1
 #endif
 #ifndef SDL_VIDEO_OPENGL_CGL
-#define SDL_VIDEO_OPENGL_CGL	1
+#define SDL_VIDEO_OPENGL_CGL    1
+#endif
+#ifndef SDL_VIDEO_OPENGL_GLX
+#define SDL_VIDEO_OPENGL_GLX    1
 #endif
 
 /* Enable system power support */
 #define SDL_POWER_MACOSX 1
 
 /* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES	1
+#define SDL_ASSEMBLY_ROUTINES   1
 #ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS	1
+#define SDL_ALTIVEC_BLITTERS    1
 #endif
 
 #endif /* _SDL_config_macosx_h */

+ 17 - 13
ThirdParty/SDL/include/SDL_config_minimal.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -26,14 +26,16 @@
 
 /**
  *  \file SDL_config_minimal.h
- *  
+ *
  *  This is the minimal configuration that can be used to build SDL.
  */
 
-#include <stddef.h>
-#include <stdarg.h>
+#define HAVE_STDARG_H   1
+#define HAVE_STDDEF_H   1
 
-#if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+/* Here are some reasonable defaults */
 typedef unsigned int size_t;
 typedef signed char int8_t;
 typedef unsigned char uint8_t;
@@ -44,31 +46,33 @@ typedef unsigned int uint32_t;
 typedef signed long long int64_t;
 typedef unsigned long long uint64_t;
 typedef unsigned long uintptr_t;
-#endif /* if (stdint.h isn't available) */
+#else
+#define HAVE_STDINT_H 1
+#endif /* Visual Studio 2008 */
 
 #ifdef __GNUC__
 #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
 #endif
 
 /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY	1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED	1
+#define SDL_JOYSTICK_DISABLED   1
 
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED	1
+#define SDL_HAPTIC_DISABLED 1
 
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED	1
+#define SDL_LOADSO_DISABLED 1
 
 /* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED	1
+#define SDL_THREADS_DISABLED    1
 
 /* Enable the stub timer support (src/timer/dummy/\*.c) */
-#define SDL_TIMERS_DISABLED	1
+#define SDL_TIMERS_DISABLED 1
 
 /* Enable the dummy video driver (src/video/dummy/\*.c) */
-#define SDL_VIDEO_DRIVER_DUMMY	1
+#define SDL_VIDEO_DRIVER_DUMMY  1
 
 #endif /* _SDL_config_minimal_h */

+ 2 - 3
ThirdParty/SDL/include/SDL_config_pandora.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -57,7 +57,7 @@
 #define HAVE_FREE 1
 #define HAVE_ALLOCA 1
 #define HAVE_GETENV 1
-#define HAVE_SETENV	1
+#define HAVE_SETENV 1
 #define HAVE_PUTENV 1
 #define HAVE_UNSETENV 1
 #define HAVE_QSORT 1
@@ -117,7 +117,6 @@
 
 #define SDL_VIDEO_DRIVER_DUMMY 1
 #define SDL_VIDEO_DRIVER_X11 1
-#define SDL_VIDEO_DRIVER_X11_XINPUT 1
 #define SDL_VIDEO_DRIVER_PANDORA 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1

+ 136 - 0
ThirdParty/SDL/include/SDL_config_psp.h

@@ -0,0 +1,136 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef _SDL_config_psp_h
+#define _SDL_config_psp_h
+
+#include "SDL_platform.h"
+
+
+
+#ifdef __GNUC__
+#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
+#endif
+
+#define HAVE_GCC_ATOMICS    1
+
+#define HAVE_ALLOCA_H       1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_STDIO_H    1
+#define STDC_HEADERS    1
+#define HAVE_STRING_H   1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_CTYPE_H    1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H   1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC    1
+#define HAVE_FREE   1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV   1
+#define HAVE_QSORT  1
+#define HAVE_ABS    1
+#define HAVE_BCOPY  1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE    1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY    1
+#define HAVE_STRLCAT    1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR    1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL    1
+#define HAVE_STRTOLL    1
+#define HAVE_STRTOULL   1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI   1
+#define HAVE_ATOF   1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP    1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF   1
+#define HAVE_VSNPRINTF  1
+#define HAVE_M_PI   1
+#define HAVE_ATAN   1
+#define HAVE_ATAN2  1
+#define HAVE_CEIL   1
+#define HAVE_COPYSIGN   1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FLOOR  1
+#define HAVE_LOG    1
+#define HAVE_POW    1
+#define HAVE_SCALBN 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP  1
+//#define HAVE_SYSCONF  1
+//#define HAVE_SIGACTION    1
+
+
+/* PSP isn't that sophisticated */
+#define LACKS_SYS_MMAN_H 1
+
+/* Enable the stub thread support (src/thread/psp/\*.c) */
+#define SDL_THREAD_PSP  1
+
+/* Enable the stub timer support (src/timer/psp/\*.c) */
+#define SDL_TIMERS_PSP  1
+
+/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
+#define SDL_JOYSTICK_PSP        1
+
+/* Enable the stub audio driver (src/audio/psp/\*.c) */
+#define SDL_AUDIO_DRIVER_PSP    1
+
+/* PSP video dirver */
+#define SDL_VIDEO_DRIVER_PSP   1
+
+/* PSP render dirver */
+#define SDL_VIDEO_RENDER_PSP   1
+
+#define SDL_POWER_PSP          1
+
+/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED    1
+
+/* PSP can't load shared object (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED    1
+
+
+#endif /* _SDL_config_psp_h */

+ 30 - 31
ThirdParty/SDL/include/SDL_config_windows.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -30,7 +30,7 @@
 
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
 #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H	1
+#define HAVE_STDINT_H   1
 #elif defined(_MSC_VER)
 typedef signed __int8 int8_t;
 typedef unsigned __int8 uint8_t;
@@ -79,6 +79,7 @@ typedef unsigned int uintptr_t;
 #endif
 
 /* Enabled for SDL 1.2 (binary compatibility) */
+// Urho3D: enable libc
 #define HAVE_LIBC     1
 #ifdef HAVE_LIBC
 /* Useful headers */
@@ -87,9 +88,7 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRING_H 1
 #define HAVE_CTYPE_H 1
 #define HAVE_MATH_H 1
-#ifndef _WIN32_WCE
 #define HAVE_SIGNAL_H 1
-#endif
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -140,56 +139,56 @@ typedef unsigned int uintptr_t;
 #define HAVE_SINF 1
 #define HAVE_SQRT 1
 #else
-#define HAVE_STDARG_H	1
-#define HAVE_STDDEF_H	1
+#define HAVE_STDARG_H   1
+#define HAVE_STDDEF_H   1
 #endif
 
 /* Enable various audio drivers */
-#ifndef _WIN32_WCE
-#define SDL_AUDIO_DRIVER_DSOUND	1
-#else
-#define SDL_AUDIO_DRIVER_DUMMY	1
-#endif
+#define SDL_AUDIO_DRIVER_DSOUND 1
+// Urho3D: disable XAudio2 for now, and do not use winmm
+//#define SDL_AUDIO_DRIVER_XAUDIO2    1
+//#define SDL_AUDIO_DRIVER_WINMM  1
+#define SDL_AUDIO_DRIVER_DISK   1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable various input drivers */
-#ifdef _WIN32_WCE
-#define SDL_JOYSTICK_DISABLED	1
-#else
-#define SDL_JOYSTICK_DINPUT	1
-#endif
+#define SDL_JOYSTICK_DINPUT 1
+#define SDL_HAPTIC_DINPUT   1
 
 /* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS	1
+#define SDL_LOADSO_WINDOWS  1
 
 /* Enable various threading systems */
-#define SDL_THREAD_WINDOWS	1
+#define SDL_THREAD_WINDOWS  1
 
 /* Enable various timer systems */
-#ifdef _WIN32_WCE
-#define SDL_TIMER_WINCE	1
-#else
-#define SDL_TIMER_WINDOWS	1
-#endif
+#define SDL_TIMER_WINDOWS   1
 
 /* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_WINDOWS	1
+#define SDL_VIDEO_DRIVER_DUMMY  1
+#define SDL_VIDEO_DRIVER_WINDOWS    1
+
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D    1
+#endif
 
 /* Enable OpenGL support */
-#ifndef _WIN32_WCE
 #ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL	1
+#define SDL_VIDEO_OPENGL    1
 #endif
 #ifndef SDL_VIDEO_OPENGL_WGL
-#define SDL_VIDEO_OPENGL_WGL	1
+#define SDL_VIDEO_OPENGL_WGL    1
 #endif
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL    1
 #endif
 
+/* Enable system power support */
+#define SDL_POWER_WINDOWS 1
+
 /* Enable assembly routines (Win64 doesn't have inline asm) */
 #ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES	1
+#define SDL_ASSEMBLY_ROUTINES   1
 #endif
 
-// Urho3D: disable IME
-#define SDL_DISABLE_WINDOWS_IME 1
-
 #endif /* _SDL_config_windows_h */

+ 2 - 2
ThirdParty/SDL/include/SDL_config_wiz.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -51,7 +51,7 @@
 #define HAVE_FREE 1
 #define HAVE_ALLOCA 1
 #define HAVE_GETENV 1
-#define HAVE_SETENV	1
+#define HAVE_SETENV 1
 #define HAVE_PUTENV 1
 #define HAVE_UNSETENV 1
 #define HAVE_QSORT 1

+ 1 - 1
ThirdParty/SDL/include/SDL_copying.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 3 - 7
ThirdParty/SDL/include/SDL_cpuinfo.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_cpuinfo.h
- *  
+ *
  *  CPU feature detection for SDL.
  */
 
@@ -32,7 +32,7 @@
 
 /* Need to do this here because intrin.h has C++ code in it */
 /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(_WIN32_WCE)
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
 #include <intrin.h>
 #ifndef _WIN64
 #define __MMX__
@@ -66,9 +66,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /* This is a guess for the cacheline size used for padding.
@@ -139,9 +137,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 36 - 45
ThirdParty/SDL/include/SDL_endian.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_endian.h
- *  
+ *
  *  Functions for reading and writing endian-specific values
  */
 
@@ -34,8 +34,8 @@
  *  \name The two types of endianness
  */
 /*@{*/
-#define SDL_LIL_ENDIAN	1234
-#define SDL_BIG_ENDIAN	4321
+#define SDL_LIL_ENDIAN  1234
+#define SDL_BIG_ENDIAN  4321
 /*@}*/
 
 #ifndef SDL_BYTEORDER           /* Not defined in SDL_config.h? */
@@ -48,9 +48,9 @@
     (defined(__MIPS__) && defined(__MISPEB__)) || \
     defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
     defined(__sparc__)
-#define SDL_BYTEORDER	SDL_BIG_ENDIAN
+#define SDL_BYTEORDER   SDL_BIG_ENDIAN
 #else
-#define SDL_BYTEORDER	SDL_LIL_ENDIAN
+#define SDL_BYTEORDER   SDL_LIL_ENDIAN
 #endif
 #endif /* __linux __ */
 #endif /* !SDL_BYTEORDER */
@@ -59,36 +59,29 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \file SDL_endian.h
- *  
- *  Uses inline functions for compilers that support them, and static
- *  functions for those that do not.  Because these functions become
- *  static for compilers that do not support inline functions, this
- *  header should only be included in files that actually use them.
  */
 #if defined(__GNUC__) && defined(__i386__) && \
    !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
-static __inline__ Uint16
+SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
   __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
     return x;
 }
 #elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint16
+SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
   __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
     return x;
 }
 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint16
+SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
     int result;
@@ -97,14 +90,14 @@ SDL_Swap16(Uint16 x)
     return (Uint16)result;
 }
 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-static __inline__ Uint16
+SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
   __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
 }
 #else
-static __inline__ Uint16
+SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 {
     return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
@@ -112,21 +105,21 @@ SDL_Swap16(Uint16 x)
 #endif
 
 #if defined(__GNUC__) && defined(__i386__)
-static __inline__ Uint32
+SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
   __asm__("bswap %0": "=r"(x):"0"(x));
     return x;
 }
 #elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint32
+SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
   __asm__("bswapl %0": "=r"(x):"0"(x));
     return x;
 }
 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint32
+SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
     Uint32 result;
@@ -137,14 +130,14 @@ SDL_Swap32(Uint32 x)
     return result;
 }
 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-static __inline__ Uint32
+SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
   __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
 }
 #else
-static __inline__ Uint32
+SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 {
     return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
@@ -153,7 +146,7 @@ SDL_Swap32(Uint32 x)
 #endif
 
 #if defined(__GNUC__) && defined(__i386__)
-static __inline__ Uint64
+SDL_FORCE_INLINE Uint64
 SDL_Swap64(Uint64 x)
 {
     union
@@ -171,14 +164,14 @@ SDL_Swap64(Uint64 x)
     return v.u;
 }
 #elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint64
+SDL_FORCE_INLINE Uint64
 SDL_Swap64(Uint64 x)
 {
   __asm__("bswapq %0": "=r"(x):"0"(x));
     return x;
 }
 #else
-static __inline__ Uint64
+SDL_FORCE_INLINE Uint64
 SDL_Swap64(Uint64 x)
 {
     Uint32 hi, lo;
@@ -195,7 +188,7 @@ SDL_Swap64(Uint64 x)
 #endif
 
 
-static __inline__ float
+SDL_FORCE_INLINE float
 SDL_SwapFloat(float x)
 {
     union
@@ -215,31 +208,29 @@ SDL_SwapFloat(float x)
  */
 /*@{*/
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_SwapLE16(X)	(X)
-#define SDL_SwapLE32(X)	(X)
-#define SDL_SwapLE64(X)	(X)
-#define SDL_SwapFloatLE(X)	(X)
-#define SDL_SwapBE16(X)	SDL_Swap16(X)
-#define SDL_SwapBE32(X)	SDL_Swap32(X)
-#define SDL_SwapBE64(X)	SDL_Swap64(X)
-#define SDL_SwapFloatBE(X)	SDL_SwapFloat(X)
+#define SDL_SwapLE16(X) (X)
+#define SDL_SwapLE32(X) (X)
+#define SDL_SwapLE64(X) (X)
+#define SDL_SwapFloatLE(X)  (X)
+#define SDL_SwapBE16(X) SDL_Swap16(X)
+#define SDL_SwapBE32(X) SDL_Swap32(X)
+#define SDL_SwapBE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatBE(X)  SDL_SwapFloat(X)
 #else
-#define SDL_SwapLE16(X)	SDL_Swap16(X)
-#define SDL_SwapLE32(X)	SDL_Swap32(X)
-#define SDL_SwapLE64(X)	SDL_Swap64(X)
-#define SDL_SwapFloatLE(X)	SDL_SwapFloat(X)
-#define SDL_SwapBE16(X)	(X)
-#define SDL_SwapBE32(X)	(X)
-#define SDL_SwapBE64(X)	(X)
-#define SDL_SwapFloatBE(X)	(X)
+#define SDL_SwapLE16(X) SDL_Swap16(X)
+#define SDL_SwapLE32(X) SDL_Swap32(X)
+#define SDL_SwapLE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatLE(X)  SDL_SwapFloat(X)
+#define SDL_SwapBE16(X) (X)
+#define SDL_SwapBE32(X) (X)
+#define SDL_SwapBE64(X) (X)
+#define SDL_SwapFloatBE(X)  (X)
 #endif
 /*@}*//*Swap to native*/
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 11 - 12
ThirdParty/SDL/include/SDL_error.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_error.h
- *  
+ *
  *  Simple error message routines for SDL.
  */
 
@@ -33,25 +33,25 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /* Public functions */
-extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
+/* SDL_SetError() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
 extern DECLSPEC const char *SDLCALL SDL_GetError(void);
 extern DECLSPEC void SDLCALL SDL_ClearError(void);
 
 /**
  *  \name Internal error functions
- *  
- *  \internal 
+ *
+ *  \internal
  *  Private error reporting function - used internally.
  */
 /*@{*/
-#define SDL_OutOfMemory()	SDL_Error(SDL_ENOMEM)
-#define SDL_Unsupported()	SDL_Error(SDL_UNSUPPORTED)
+#define SDL_OutOfMemory()   SDL_Error(SDL_ENOMEM)
+#define SDL_Unsupported()   SDL_Error(SDL_UNSUPPORTED)
+#define SDL_InvalidParamError(param)    SDL_SetError("Parameter '%s' is invalid", (param))
 typedef enum
 {
     SDL_ENOMEM,
@@ -61,14 +61,13 @@ typedef enum
     SDL_UNSUPPORTED,
     SDL_LASTERROR
 } SDL_errorcode;
-extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
+/* SDL_Error() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
 /*@}*//*Internal error functions*/
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 720 - 669
ThirdParty/SDL/include/SDL_events.h

@@ -1,669 +1,720 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- *  \file SDL_events.h
- *  
- *  Include file for SDL event handling.
- */
-
-#ifndef _SDL_events_h
-#define _SDL_events_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-#include "SDL_keyboard.h"
-#include "SDL_mouse.h"
-#include "SDL_joystick.h"
-#include "SDL_quit.h"
-#include "SDL_gesture.h"
-#include "SDL_touch.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-extern "C" {
-/* *INDENT-ON* */
-#endif
-
-/* General keyboard/mouse state definitions */
-#define SDL_RELEASED	0
-#define SDL_PRESSED	1
-
-/**
- * \brief The types of events that can be delivered.
- */
-typedef enum
-{
-    SDL_FIRSTEVENT     = 0,     /**< Unused (do not remove) */
-
-    /* Application events */
-    SDL_QUIT           = 0x100, /**< User-requested quit */
-
-    /* Window events */
-    SDL_WINDOWEVENT    = 0x200, /**< Window state change */
-    SDL_SYSWMEVENT,             /**< System specific event */
-
-    /* Keyboard events */
-    SDL_KEYDOWN        = 0x300, /**< Key pressed */
-    SDL_KEYUP,                  /**< Key released */
-    SDL_TEXTEDITING,            /**< Keyboard text editing (composition) */
-    SDL_TEXTINPUT,              /**< Keyboard text input */
-
-    /* Mouse events */
-    SDL_MOUSEMOTION    = 0x400, /**< Mouse moved */
-    SDL_MOUSEBUTTONDOWN,        /**< Mouse button pressed */
-    SDL_MOUSEBUTTONUP,          /**< Mouse button released */
-    SDL_MOUSEWHEEL,             /**< Mouse wheel motion */
-
-    /* Tablet or multiple mice input device events */
-    SDL_INPUTMOTION    = 0x500, /**< Input moved */
-    SDL_INPUTBUTTONDOWN,        /**< Input button pressed */
-    SDL_INPUTBUTTONUP,          /**< Input button released */
-    SDL_INPUTWHEEL,             /**< Input wheel motion */
-    SDL_INPUTPROXIMITYIN,       /**< Input pen entered proximity */
-    SDL_INPUTPROXIMITYOUT,      /**< Input pen left proximity */
-
-    /* Joystick events */
-    SDL_JOYAXISMOTION  = 0x600, /**< Joystick axis motion */
-    SDL_JOYBALLMOTION,          /**< Joystick trackball motion */
-    SDL_JOYHATMOTION,           /**< Joystick hat position change */
-    SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
-    SDL_JOYBUTTONUP,            /**< Joystick button released */
-
-    /* Touch events */
-    SDL_FINGERDOWN      = 0x700,
-    SDL_FINGERUP,
-    SDL_FINGERMOTION,
-    SDL_TOUCHBUTTONDOWN,
-    SDL_TOUCHBUTTONUP,    
-
-    /* Gesture events */
-    SDL_DOLLARGESTURE   = 0x800,
-    SDL_DOLLARRECORD,
-    SDL_MULTIGESTURE,
-
-    /* Clipboard events */
-    SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
-
-    /* System events */
-
-    SDL_SYSEVENT_TERMINATE = 0xa00,
-    SDL_SYSEVENT_WILL_SUSPEND,
-    SDL_SYSEVENT_SUSPEND,
-    SDL_SYSEVENT_WILL_RESUME,
-    SDL_SYSEVENT_RESUME,
-    SDL_SYSEVENT_LOWMEMORY,
-    SDL_SYSEVENT_ORIENTATION_CHANGED,
-
-    /* Drag and drop events */
-    SDL_DROPFILE        = 0x1000, /**< The system requests a file open */
-
-    /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
-     *  and should be allocated with SDL_RegisterEvents()
-     */
-    SDL_USEREVENT    = 0x8000,
-
-    /**
-     *  This last event is only for bounding internal arrays
-     */
-    SDL_LASTEVENT    = 0xFFFF
-} SDL_EventType;
-
-/**
- *  \brief Window state change event data (event.window.*)
- */
-typedef struct SDL_WindowEvent
-{
-    Uint32 type;        /**< ::SDL_WINDOWEVENT */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The associated window */
-    Uint8 event;        /**< ::SDL_WindowEventID */
-    Uint8 padding1;
-    Uint8 padding2;
-    Uint8 padding3;
-    int data1;          /**< event dependent data */
-    int data2;          /**< event dependent data */
-} SDL_WindowEvent;
-
-/**
- *  \brief Keyboard button event structure (event.key.*)
- */
-typedef struct SDL_KeyboardEvent
-{
-    Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with keyboard focus, if any */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
-    Uint8 repeat;       /**< Non-zero if this is a key repeat */
-    Uint8 padding2;
-    Uint8 padding3;
-    SDL_Keysym keysym;  /**< The key that was pressed or released */
-} SDL_KeyboardEvent;
-
-#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
-/**
- *  \brief Keyboard text editing event structure (event.edit.*)
- */
-typedef struct SDL_TextEditingEvent
-{
-    Uint32 type;                                /**< ::SDL_TEXTEDITING */
-    Uint32 timestamp;
-    Uint32 windowID;                            /**< The window with keyboard focus, if any */
-    char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
-    int start;                                  /**< The start cursor of selected editing text */
-    int length;                                 /**< The length of selected editing text */
-} SDL_TextEditingEvent;
-
-
-#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
-/**
- *  \brief Keyboard text input event structure (event.text.*)
- */
-typedef struct SDL_TextInputEvent
-{
-    Uint32 type;                              /**< ::SDL_TEXTINPUT */
-    Uint32 timestamp;
-    Uint32 windowID;                          /**< The window with keyboard focus, if any */
-    char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
-} SDL_TextInputEvent;
-
-/**
- *  \brief Mouse motion event structure (event.motion.*)
- */
-typedef struct SDL_MouseMotionEvent
-{
-    Uint32 type;        /**< ::SDL_MOUSEMOTION */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    Uint8 state;        /**< The current button state */
-    Uint8 padding1;
-    Uint8 padding2;
-    Uint8 padding3;
-    int x;              /**< X coordinate, relative to window */
-    int y;              /**< Y coordinate, relative to window */
-    int xrel;           /**< The relative motion in the X direction */
-    int yrel;           /**< The relative motion in the Y direction */
-} SDL_MouseMotionEvent;
-
-/**
- *  \brief Mouse button event structure (event.button.*)
- */
-typedef struct SDL_MouseButtonEvent
-{
-    Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    Uint8 button;       /**< The mouse button index */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
-    Uint8 padding1;
-    Uint8 padding2;
-    int x;              /**< X coordinate, relative to window */
-    int y;              /**< Y coordinate, relative to window */
-} SDL_MouseButtonEvent;
-
-/**
- *  \brief Mouse wheel event structure (event.wheel.*)
- */
-typedef struct SDL_MouseWheelEvent
-{
-    Uint32 type;        /**< ::SDL_MOUSEWHEEL */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    int x;              /**< The amount scrolled horizontally */
-    int y;              /**< The amount scrolled vertically */
-} SDL_MouseWheelEvent;
-
-/**
- *  \brief Joystick axis motion event structure (event.jaxis.*)
- */
-typedef struct SDL_JoyAxisEvent
-{
-    Uint32 type;        /**< ::SDL_JOYAXISMOTION */
-    Uint32 timestamp;
-    Uint8 which;        /**< The joystick device index */
-    Uint8 axis;         /**< The joystick axis index */
-    Uint8 padding1;
-    Uint8 padding2;
-    int value;          /**< The axis value (range: -32768 to 32767) */
-} SDL_JoyAxisEvent;
-
-/**
- *  \brief Joystick trackball motion event structure (event.jball.*)
- */
-typedef struct SDL_JoyBallEvent
-{
-    Uint32 type;        /**< ::SDL_JOYBALLMOTION */
-    Uint32 timestamp;
-    Uint8 which;        /**< The joystick device index */
-    Uint8 ball;         /**< The joystick trackball index */
-    Uint8 padding1;
-    Uint8 padding2;
-    int xrel;           /**< The relative motion in the X direction */
-    int yrel;           /**< The relative motion in the Y direction */
-} SDL_JoyBallEvent;
-
-/**
- *  \brief Joystick hat position change event structure (event.jhat.*)
- */
-typedef struct SDL_JoyHatEvent
-{
-    Uint32 type;        /**< ::SDL_JOYHATMOTION */
-    Uint32 timestamp;
-    Uint8 which;        /**< The joystick device index */
-    Uint8 hat;          /**< The joystick hat index */
-    Uint8 value;        /**< The hat position value.
-                         *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
-                         *   \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
-                         *   \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
-                         *   
-                         *   Note that zero means the POV is centered.
-                         */
-    Uint8 padding1;
-} SDL_JoyHatEvent;
-
-/**
- *  \brief Joystick button event structure (event.jbutton.*)
- */
-typedef struct SDL_JoyButtonEvent
-{
-    Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
-    Uint32 timestamp;
-    Uint8 which;        /**< The joystick device index */
-    Uint8 button;       /**< The joystick button index */
-    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
-    Uint8 padding1;
-} SDL_JoyButtonEvent;
-
-
-/**
- *  \brief Touch finger motion/finger event structure (event.tfinger.*)
- */
-typedef struct SDL_TouchFingerEvent
-{
-    Uint32 type;        /**< ::SDL_FINGERMOTION OR 
-			   SDL_FINGERDOWN OR SDL_FINGERUP*/
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    SDL_TouchID touchId;        /**< The touch device id */
-    SDL_FingerID fingerId;
-    Uint8 state;        /**< The current button state */
-    Uint8 padding1;
-    Uint8 padding2;
-    Uint8 padding3;
-    Uint16 x;
-    Uint16 y;
-    Sint16 dx;
-    Sint16 dy;
-    Uint16 pressure;
-} SDL_TouchFingerEvent;
-
-
-/**
- *  \brief Touch finger motion/finger event structure (event.tbutton.*)
- */
-typedef struct SDL_TouchButtonEvent
-{
-    Uint32 type;        /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    SDL_TouchID touchId;        /**< The touch device index */
-    Uint8 state;        /**< The current button state */
-    Uint8 button;        /**< The button changing state */
-    Uint8 padding1;
-    Uint8 padding2;
-} SDL_TouchButtonEvent;
-
-
-/**
- *  \brief Multiple Finger Gesture Event (event.mgesture.*)
- */
-typedef struct SDL_MultiGestureEvent
-{
-    Uint32 type;        /**< ::SDL_MULTIGESTURE */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    SDL_TouchID touchId;        /**< The touch device index */
-    float dTheta;
-    float dDist;
-    float x;  //currently 0...1. Change to screen coords?
-    float y;  
-    Uint16 numFingers;
-    Uint16 padding;
-} SDL_MultiGestureEvent;
-
-/* (event.dgesture.*) */
-typedef struct SDL_DollarGestureEvent
-{
-    Uint32 type;        /**< ::SDL_DOLLARGESTURE */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The window with mouse focus, if any */
-    SDL_TouchID touchId;        /**< The touch device index */
-    SDL_GestureID gestureId;
-    Uint32 numFingers;
-    float error;
-  /*
-    //TODO: Enable to give location?
-    float x;  //currently 0...1. Change to screen coords?
-    float y;  
-  */
-} SDL_DollarGestureEvent;
-
-
-/**
- *  \brief An event used to request a file open by the system (event.drop.*)
- *         This event is disabled by default, you can enable it with SDL_EventState()
- *  \note If you enable this event, you must free the filename in the event.
- */
-typedef struct SDL_DropEvent
-{
-    Uint32 type;        /**< ::SDL_DROPFILE */
-    Uint32 timestamp;
-    char *file;         /**< The file name, which should be freed with SDL_free() */
-} SDL_DropEvent;
-
-
-/**
- *  \brief The "quit requested" event
- */
-typedef struct SDL_QuitEvent
-{
-    Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;
-} SDL_QuitEvent;
-
-/**
- *  \brief System event
- */
-
-typedef struct SDL_SystemEvent
-{
-    Uint32 type;
-    Uint32 timestamp;
-    void *data;
-} SDL_SystemEvent;
-
-typedef enum
-{
-    SDL_ORIENTATION_PORTRAIT,
-    SDL_ORIENTATION_LANDSCAPE
-} SDL_DeviceOrientation;
-
-/**
- *  \brief A user-defined event type (event.user.*)
- */
-typedef struct SDL_UserEvent
-{
-    Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
-    Uint32 timestamp;
-    Uint32 windowID;    /**< The associated window if any */
-    int code;           /**< User defined event code */
-    void *data1;        /**< User defined data pointer */
-    void *data2;        /**< User defined data pointer */
-} SDL_UserEvent;
-
-
-struct SDL_SysWMmsg;
-typedef struct SDL_SysWMmsg SDL_SysWMmsg;
-
-/**
- *  \brief A video driver dependent system event (event.syswm.*)
- *         This event is disabled by default, you can enable it with SDL_EventState()
- *
- *  \note If you want to use this event, you should include SDL_syswm.h.
- */
-typedef struct SDL_SysWMEvent
-{
-    Uint32 type;        /**< ::SDL_SYSWMEVENT */
-    Uint32 timestamp;
-    SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
-} SDL_SysWMEvent;
-
-/**
- *  \brief General event structure
- */
-typedef union SDL_Event
-{
-    Uint32 type;                    /**< Event type, shared with all events */
-    SDL_WindowEvent window;         /**< Window event data */
-    SDL_KeyboardEvent key;          /**< Keyboard event data */
-    SDL_TextEditingEvent edit;      /**< Text editing event data */
-    SDL_TextInputEvent text;        /**< Text input event data */
-    SDL_MouseMotionEvent motion;    /**< Mouse motion event data */
-    SDL_MouseButtonEvent button;    /**< Mouse button event data */
-    SDL_MouseWheelEvent wheel;      /**< Mouse wheel event data */
-    SDL_JoyAxisEvent jaxis;         /**< Joystick axis event data */
-    SDL_JoyBallEvent jball;         /**< Joystick ball event data */
-    SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
-    SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
-    SDL_QuitEvent quit;             /**< Quit request event data */
-    SDL_UserEvent user;             /**< Custom event data */
-    SDL_SysWMEvent syswm;           /**< System dependent window event data */
-    SDL_TouchFingerEvent tfinger;   /**< Touch finger event data */
-    SDL_TouchButtonEvent tbutton;   /**< Touch button event data */
-    SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */
-    SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
-    SDL_DropEvent drop;             /**< Drag and drop event data */
-    SDL_SystemEvent sysevent;       /**< System event data */
-} SDL_Event;
-
-
-/* Function prototypes */
-
-/**
- *  Pumps the event loop, gathering events from the input devices.
- *  
- *  This function updates the event queue and internal input device state.
- *  
- *  This should only be run in the thread that sets the video mode.
- */
-extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
-
-/*@{*/
-typedef enum
-{
-    SDL_ADDEVENT,
-    SDL_PEEKEVENT,
-    SDL_GETEVENT
-} SDL_eventaction;
-
-/**
- *  Checks the event queue for messages and optionally returns them.
- *  
- *  If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
- *  the back of the event queue.
- *  
- *  If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
- *  of the event queue, within the specified minimum and maximum type,
- *  will be returned and will not be removed from the queue.
- *  
- *  If \c action is ::SDL_GETEVENT, up to \c numevents events at the front 
- *  of the event queue, within the specified minimum and maximum type,
- *  will be returned and will be removed from the queue.
- *  
- *  \return The number of events actually stored, or -1 if there was an error.
- *  
- *  This function is thread-safe.
- */
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
-                                           SDL_eventaction action,
-                                           Uint32 minType, Uint32 maxType);
-/*@}*/
-
-/**
- *  Checks to see if certain event types are in the event queue.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
-
-/**
- *  This function clears events from the event queue
- */
-extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
-extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
-
-/**
- *  \brief Polls for currently pending events.
- *  
- *  \return 1 if there are any pending events, or 0 if there are none available.
- *  
- *  \param event If not NULL, the next event is removed from the queue and 
- *               stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
-
-/**
- *  \brief Waits indefinitely for the next available event.
- *  
- *  \return 1, or 0 if there was an error while waiting for events.
- *   
- *  \param event If not NULL, the next event is removed from the queue and 
- *               stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
-
-/**
- *  \brief Waits until the specified timeout (in milliseconds) for the next 
- *         available event.
- *  
- *  \return 1, or 0 if there was an error while waiting for events.
- *  
- *  \param event If not NULL, the next event is removed from the queue and 
- *               stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
-                                                 int timeout);
-
-/**
- *  \brief Add an event to the event queue.
- *  
- *  \return 1 on success, 0 if the event was filtered, or -1 if the event queue 
- *          was full or there was some other error.
- */
-extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
-
-typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
-
-/**
- *  Sets up a filter to process all events before they change internal state and
- *  are posted to the internal event queue.
- *  
- *  The filter is protypted as:
- *  \code
- *      int SDL_EventFilter(void *userdata, SDL_Event * event);
- *  \endcode
- *
- *  If the filter returns 1, then the event will be added to the internal queue.
- *  If it returns 0, then the event will be dropped from the queue, but the 
- *  internal state will still be updated.  This allows selective filtering of
- *  dynamically arriving events.
- *  
- *  \warning  Be very careful of what you do in the event filter function, as 
- *            it may run in a different thread!
- *  
- *  There is one caveat when dealing with the ::SDL_QUITEVENT event type.  The
- *  event filter is only called when the window manager desires to close the
- *  application window.  If the event filter returns 1, then the window will
- *  be closed, otherwise the window will remain open if possible.
- *
- *  If the quit event is generated by an interrupt signal, it will bypass the
- *  internal queue and be delivered to the application at the next event poll.
- */
-extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
-                                                void *userdata);
-
-/**
- *  Return the current event filter - can be used to "chain" filters.
- *  If there is no event filter set, this function returns SDL_FALSE.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
-                                                    void **userdata);
-
-/**
- *  Add a function which is called when an event is added to the queue.
- */
-extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
-                                               void *userdata);
-
-/**
- *  Remove an event watch function added with SDL_AddEventWatch()
- */
-extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
-                                               void *userdata);
-
-/**
- *  Run the filter function on the current event queue, removing any
- *  events for which the filter returns 0.
- */
-extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
-                                              void *userdata);
-
-/*@{*/
-#define SDL_QUERY	-1
-#define SDL_IGNORE	 0
-#define SDL_DISABLE	 0
-#define SDL_ENABLE	 1
-
-/**
- *  This function allows you to set the state of processing certain events.
- *   - If \c state is set to ::SDL_IGNORE, that event will be automatically 
- *     dropped from the event queue and will not event be filtered.
- *   - If \c state is set to ::SDL_ENABLE, that event will be processed 
- *     normally.
- *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the 
- *     current processing state of the specified event.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
-/*@}*/
-#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
-
-/**
- *  This function allocates a set of user-defined events, and returns
- *  the beginning event number for that set of events.
- *
- *  If there aren't enough user-defined events left, this function
- *  returns (Uint32)-1
- */
-extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
-
-/**
- * Set system event hook
- * 
- */
-typedef int (SDLCALL * SDL_SystemEventHandler) (SDL_Event* event);
-
-extern DECLSPEC void SDLCALL SDL_SetSystemEventHook(SDL_SystemEventHandler handler);
-
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-}
-/* *INDENT-ON* */
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_events_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_events.h
+ *
+ *  Include file for SDL event handling.
+ */
+
+#ifndef _SDL_events_h
+#define _SDL_events_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_keyboard.h"
+#include "SDL_mouse.h"
+#include "SDL_joystick.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_quit.h"
+#include "SDL_gesture.h"
+#include "SDL_touch.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* General keyboard/mouse state definitions */
+#define SDL_RELEASED    0
+#define SDL_PRESSED 1
+
+/**
+ * \brief The types of events that can be delivered.
+ */
+typedef enum
+{
+    SDL_FIRSTEVENT     = 0,     /**< Unused (do not remove) */
+
+    /* Application events */
+    SDL_QUIT           = 0x100, /**< User-requested quit */
+
+    /* These application events have special meaning on iOS, see README-ios.txt for details */
+    SDL_APP_TERMINATING,        /**< The application is being terminated by the OS
+                                     Called on iOS in applicationWillTerminate()
+                                     Called on Android in onDestroy()
+                                */
+    SDL_APP_LOWMEMORY,          /**< The application is low on memory, free memory if possible.
+                                     Called on iOS in applicationDidReceiveMemoryWarning()
+                                     Called on Android in onLowMemory()
+                                */
+    SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
+                                     Called on iOS in applicationWillResignActive()
+                                     Called on Android in onPause()
+                                */
+    SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
+                                     Called on iOS in applicationDidEnterBackground()
+                                     Called on Android in onPause()
+                                */
+    SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
+                                     Called on iOS in applicationWillEnterForeground()
+                                     Called on Android in onResume()
+                                */
+    SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
+                                     Called on iOS in applicationDidBecomeActive()
+                                     Called on Android in onResume()
+                                */
+
+    /* Window events */
+    SDL_WINDOWEVENT    = 0x200, /**< Window state change */
+    SDL_SYSWMEVENT,             /**< System specific event */
+
+    /* Keyboard events */
+    SDL_KEYDOWN        = 0x300, /**< Key pressed */
+    SDL_KEYUP,                  /**< Key released */
+    SDL_TEXTEDITING,            /**< Keyboard text editing (composition) */
+    SDL_TEXTINPUT,              /**< Keyboard text input */
+
+    /* Mouse events */
+    SDL_MOUSEMOTION    = 0x400, /**< Mouse moved */
+    SDL_MOUSEBUTTONDOWN,        /**< Mouse button pressed */
+    SDL_MOUSEBUTTONUP,          /**< Mouse button released */
+    SDL_MOUSEWHEEL,             /**< Mouse wheel motion */
+
+    /* Joystick events */
+    SDL_JOYAXISMOTION  = 0x600, /**< Joystick axis motion */
+    SDL_JOYBALLMOTION,          /**< Joystick trackball motion */
+    SDL_JOYHATMOTION,           /**< Joystick hat position change */
+    SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
+    SDL_JOYBUTTONUP,            /**< Joystick button released */
+    SDL_JOYDEVICEADDED,         /**< A new joystick has been inserted into the system */
+    SDL_JOYDEVICEREMOVED,       /**< An opened joystick has been removed */
+
+    /* Game controller events */
+    SDL_CONTROLLERAXISMOTION  = 0x650, /**< Game controller axis motion */
+    SDL_CONTROLLERBUTTONDOWN,          /**< Game controller button pressed */
+    SDL_CONTROLLERBUTTONUP,            /**< Game controller button released */
+    SDL_CONTROLLERDEVICEADDED,         /**< A new Game controller has been inserted into the system */
+    SDL_CONTROLLERDEVICEREMOVED,       /**< An opened Game controller has been removed */
+    SDL_CONTROLLERDEVICEREMAPPED,      /**< The controller mapping was updated */
+
+    /* Touch events */
+    SDL_FINGERDOWN      = 0x700,
+    SDL_FINGERUP,
+    SDL_FINGERMOTION,
+
+    /* Gesture events */
+    SDL_DOLLARGESTURE   = 0x800,
+    SDL_DOLLARRECORD,
+    SDL_MULTIGESTURE,
+
+    /* Clipboard events */
+    SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+
+    /* Drag and drop events */
+    SDL_DROPFILE        = 0x1000, /**< The system requests a file open */
+
+    /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+     *  and should be allocated with SDL_RegisterEvents()
+     */
+    SDL_USEREVENT    = 0x8000,
+
+    /**
+     *  This last event is only for bounding internal arrays
+     */
+    SDL_LASTEVENT    = 0xFFFF
+} SDL_EventType;
+
+/**
+ *  \brief Fields shared by every event
+ */
+typedef struct SDL_CommonEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+} SDL_CommonEvent;
+
+/**
+ *  \brief Window state change event data (event.window.*)
+ */
+typedef struct SDL_WindowEvent
+{
+    Uint32 type;        /**< ::SDL_WINDOWEVENT */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The associated window */
+    Uint8 event;        /**< ::SDL_WindowEventID */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint32 data1;       /**< event dependent data */
+    Sint32 data2;       /**< event dependent data */
+} SDL_WindowEvent;
+
+/**
+ *  \brief Keyboard button event structure (event.key.*)
+ */
+typedef struct SDL_KeyboardEvent
+{
+    Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The window with keyboard focus, if any */
+    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 repeat;       /**< Non-zero if this is a key repeat */
+    Uint8 padding2;
+    Uint8 padding3;
+    SDL_Keysym keysym;  /**< The key that was pressed or released */
+} SDL_KeyboardEvent;
+
+#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+/**
+ *  \brief Keyboard text editing event structure (event.edit.*)
+ */
+typedef struct SDL_TextEditingEvent
+{
+    Uint32 type;                                /**< ::SDL_TEXTEDITING */
+    Uint32 timestamp;
+    Uint32 windowID;                            /**< The window with keyboard focus, if any */
+    char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
+    Sint32 start;                               /**< The start cursor of selected editing text */
+    Sint32 length;                              /**< The length of selected editing text */
+} SDL_TextEditingEvent;
+
+
+#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+/**
+ *  \brief Keyboard text input event structure (event.text.*)
+ */
+typedef struct SDL_TextInputEvent
+{
+    Uint32 type;                              /**< ::SDL_TEXTINPUT */
+    Uint32 timestamp;
+    Uint32 windowID;                          /**< The window with keyboard focus, if any */
+    char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
+} SDL_TextInputEvent;
+
+/**
+ *  \brief Mouse motion event structure (event.motion.*)
+ */
+typedef struct SDL_MouseMotionEvent
+{
+    Uint32 type;        /**< ::SDL_MOUSEMOTION */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+    Uint32 state;       /**< The current button state */
+    Sint32 x;           /**< X coordinate, relative to window */
+    Sint32 y;           /**< Y coordinate, relative to window */
+    Sint32 xrel;        /**< The relative motion in the X direction */
+    Sint32 yrel;        /**< The relative motion in the Y direction */
+} SDL_MouseMotionEvent;
+
+/**
+ *  \brief Mouse button event structure (event.button.*)
+ */
+typedef struct SDL_MouseButtonEvent
+{
+    Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+    Uint8 button;       /**< The mouse button index */
+    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 padding1;
+    Uint8 padding2;
+    Sint32 x;           /**< X coordinate, relative to window */
+    Sint32 y;           /**< Y coordinate, relative to window */
+} SDL_MouseButtonEvent;
+
+/**
+ *  \brief Mouse wheel event structure (event.wheel.*)
+ */
+typedef struct SDL_MouseWheelEvent
+{
+    Uint32 type;        /**< ::SDL_MOUSEWHEEL */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+    Sint32 x;           /**< The amount scrolled horizontally */
+    Sint32 y;           /**< The amount scrolled vertically */
+} SDL_MouseWheelEvent;
+
+/**
+ *  \brief Joystick axis motion event structure (event.jaxis.*)
+ */
+typedef struct SDL_JoyAxisEvent
+{
+    Uint32 type;        /**< ::SDL_JOYAXISMOTION */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 axis;         /**< The joystick axis index */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 value;       /**< The axis value (range: -32768 to 32767) */
+    Uint16 padding4;
+} SDL_JoyAxisEvent;
+
+/**
+ *  \brief Joystick trackball motion event structure (event.jball.*)
+ */
+typedef struct SDL_JoyBallEvent
+{
+    Uint32 type;        /**< ::SDL_JOYBALLMOTION */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 ball;         /**< The joystick trackball index */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 xrel;        /**< The relative motion in the X direction */
+    Sint16 yrel;        /**< The relative motion in the Y direction */
+} SDL_JoyBallEvent;
+
+/**
+ *  \brief Joystick hat position change event structure (event.jhat.*)
+ */
+typedef struct SDL_JoyHatEvent
+{
+    Uint32 type;        /**< ::SDL_JOYHATMOTION */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 hat;          /**< The joystick hat index */
+    Uint8 value;        /**< The hat position value.
+                         *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
+                         *   \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
+                         *   \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
+                         *
+                         *   Note that zero means the POV is centered.
+                         */
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_JoyHatEvent;
+
+/**
+ *  \brief Joystick button event structure (event.jbutton.*)
+ */
+typedef struct SDL_JoyButtonEvent
+{
+    Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 button;       /**< The joystick button index */
+    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_JoyButtonEvent;
+
+/**
+ *  \brief Joystick device event structure (event.jdevice.*)
+ */
+typedef struct SDL_JoyDeviceEvent
+{
+    Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
+    Uint32 timestamp;
+    Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
+} SDL_JoyDeviceEvent;
+
+
+/**
+ *  \brief Game controller axis motion event structure (event.caxis.*)
+ */
+typedef struct SDL_ControllerAxisEvent
+{
+    Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 value;       /**< The axis value (range: -32768 to 32767) */
+    Uint16 padding4;
+} SDL_ControllerAxisEvent;
+
+
+/**
+ *  \brief Game controller button event structure (event.cbutton.*)
+ */
+typedef struct SDL_ControllerButtonEvent
+{
+    Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
+    Uint32 timestamp;
+    SDL_JoystickID which; /**< The joystick instance id */
+    Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
+    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_ControllerButtonEvent;
+
+
+/**
+ *  \brief Controller device event structure (event.cdevice.*)
+ */
+typedef struct SDL_ControllerDeviceEvent
+{
+    Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
+    Uint32 timestamp;
+    Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
+} SDL_ControllerDeviceEvent;
+
+
+/**
+ *  \brief Touch finger event structure (event.tfinger.*)
+ */
+typedef struct SDL_TouchFingerEvent
+{
+    Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
+    Uint32 timestamp;
+    SDL_TouchID touchId; /**< The touch device id */
+    SDL_FingerID fingerId;
+    float x;            /**< Normalized in the range 0...1 */
+    float y;            /**< Normalized in the range 0...1 */
+    float dx;           /**< Normalized in the range 0...1 */
+    float dy;           /**< Normalized in the range 0...1 */
+    float pressure;     /**< Normalized in the range 0...1 */
+} SDL_TouchFingerEvent;
+
+
+/**
+ *  \brief Multiple Finger Gesture Event (event.mgesture.*)
+ */
+typedef struct SDL_MultiGestureEvent
+{
+    Uint32 type;        /**< ::SDL_MULTIGESTURE */
+    Uint32 timestamp;
+    SDL_TouchID touchId; /**< The touch device index */
+    float dTheta;
+    float dDist;
+    float x;
+    float y;
+    Uint16 numFingers;
+    Uint16 padding;
+} SDL_MultiGestureEvent;
+
+
+/**
+ * \brief Dollar Gesture Event (event.dgesture.*)
+ */
+typedef struct SDL_DollarGestureEvent
+{
+    Uint32 type;        /**< ::SDL_DOLLARGESTURE */
+    Uint32 timestamp;
+    SDL_TouchID touchId; /**< The touch device id */
+    SDL_GestureID gestureId;
+    Uint32 numFingers;
+    float error;
+    float x;            /**< Normalized center of gesture */
+    float y;            /**< Normalized center of gesture */
+} SDL_DollarGestureEvent;
+
+
+/**
+ *  \brief An event used to request a file open by the system (event.drop.*)
+ *         This event is disabled by default, you can enable it with SDL_EventState()
+ *  \note If you enable this event, you must free the filename in the event.
+ */
+typedef struct SDL_DropEvent
+{
+    Uint32 type;        /**< ::SDL_DROPFILE */
+    Uint32 timestamp;
+    char *file;         /**< The file name, which should be freed with SDL_free() */
+} SDL_DropEvent;
+
+
+/**
+ *  \brief The "quit requested" event
+ */
+typedef struct SDL_QuitEvent
+{
+    Uint32 type;        /**< ::SDL_QUIT */
+    Uint32 timestamp;
+} SDL_QuitEvent;
+
+/**
+ *  \brief OS Specific event
+ */
+typedef struct SDL_OSEvent
+{
+    Uint32 type;        /**< ::SDL_QUIT */
+    Uint32 timestamp;
+} SDL_OSEvent;
+
+/**
+ *  \brief A user-defined event type (event.user.*)
+ */
+typedef struct SDL_UserEvent
+{
+    Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
+    Uint32 timestamp;
+    Uint32 windowID;    /**< The associated window if any */
+    Sint32 code;        /**< User defined event code */
+    void *data1;        /**< User defined data pointer */
+    void *data2;        /**< User defined data pointer */
+} SDL_UserEvent;
+
+
+struct SDL_SysWMmsg;
+typedef struct SDL_SysWMmsg SDL_SysWMmsg;
+
+/**
+ *  \brief A video driver dependent system event (event.syswm.*)
+ *         This event is disabled by default, you can enable it with SDL_EventState()
+ *
+ *  \note If you want to use this event, you should include SDL_syswm.h.
+ */
+typedef struct SDL_SysWMEvent
+{
+    Uint32 type;        /**< ::SDL_SYSWMEVENT */
+    Uint32 timestamp;
+    SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
+} SDL_SysWMEvent;
+
+/**
+ *  \brief General event structure
+ */
+typedef union SDL_Event
+{
+    Uint32 type;                    /**< Event type, shared with all events */
+    SDL_CommonEvent common;         /**< Common event data */
+    SDL_WindowEvent window;         /**< Window event data */
+    SDL_KeyboardEvent key;          /**< Keyboard event data */
+    SDL_TextEditingEvent edit;      /**< Text editing event data */
+    SDL_TextInputEvent text;        /**< Text input event data */
+    SDL_MouseMotionEvent motion;    /**< Mouse motion event data */
+    SDL_MouseButtonEvent button;    /**< Mouse button event data */
+    SDL_MouseWheelEvent wheel;      /**< Mouse wheel event data */
+    SDL_JoyAxisEvent jaxis;         /**< Joystick axis event data */
+    SDL_JoyBallEvent jball;         /**< Joystick ball event data */
+    SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
+    SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
+    SDL_JoyDeviceEvent jdevice;     /**< Joystick device change event data */
+    SDL_ControllerAxisEvent caxis;      /**< Game Controller axis event data */
+    SDL_ControllerButtonEvent cbutton;  /**< Game Controller button event data */
+    SDL_ControllerDeviceEvent cdevice;  /**< Game Controller device event data */
+    SDL_QuitEvent quit;             /**< Quit request event data */
+    SDL_UserEvent user;             /**< Custom event data */
+    SDL_SysWMEvent syswm;           /**< System dependent window event data */
+    SDL_TouchFingerEvent tfinger;   /**< Touch finger event data */
+    SDL_MultiGestureEvent mgesture; /**< Gesture event data */
+    SDL_DollarGestureEvent dgesture; /**< Gesture event data */
+    SDL_DropEvent drop;             /**< Drag and drop event data */
+
+    /* This is necessary for ABI compatibility between Visual C++ and GCC
+       Visual C++ will respect the push pack pragma and use 52 bytes for
+       this structure, and GCC will use the alignment of the largest datatype
+       within the union, which is 8 bytes.
+
+       So... we'll add padding to force the size to be 56 bytes for both.
+    */
+    Uint8 padding[56];
+} SDL_Event;
+
+
+/* Function prototypes */
+
+/**
+ *  Pumps the event loop, gathering events from the input devices.
+ *
+ *  This function updates the event queue and internal input device state.
+ *
+ *  This should only be run in the thread that sets the video mode.
+ */
+extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
+
+/*@{*/
+typedef enum
+{
+    SDL_ADDEVENT,
+    SDL_PEEKEVENT,
+    SDL_GETEVENT
+} SDL_eventaction;
+
+/**
+ *  Checks the event queue for messages and optionally returns them.
+ *
+ *  If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
+ *  the back of the event queue.
+ *
+ *  If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
+ *  of the event queue, within the specified minimum and maximum type,
+ *  will be returned and will not be removed from the queue.
+ *
+ *  If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
+ *  of the event queue, within the specified minimum and maximum type,
+ *  will be returned and will be removed from the queue.
+ *
+ *  \return The number of events actually stored, or -1 if there was an error.
+ *
+ *  This function is thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
+                                           SDL_eventaction action,
+                                           Uint32 minType, Uint32 maxType);
+/*@}*/
+
+/**
+ *  Checks to see if certain event types are in the event queue.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ *  This function clears events from the event queue
+ */
+extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
+extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ *  \brief Polls for currently pending events.
+ *
+ *  \return 1 if there are any pending events, or 0 if there are none available.
+ *
+ *  \param event If not NULL, the next event is removed from the queue and
+ *               stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
+
+/**
+ *  \brief Waits indefinitely for the next available event.
+ *
+ *  \return 1, or 0 if there was an error while waiting for events.
+ *
+ *  \param event If not NULL, the next event is removed from the queue and
+ *               stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
+
+/**
+ *  \brief Waits until the specified timeout (in milliseconds) for the next
+ *         available event.
+ *
+ *  \return 1, or 0 if there was an error while waiting for events.
+ *
+ *  \param event If not NULL, the next event is removed from the queue and
+ *               stored in that area.
+ *  \param timeout The timeout (in milliseconds) to wait for next event.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
+                                                 int timeout);
+
+/**
+ *  \brief Add an event to the event queue.
+ *
+ *  \return 1 on success, 0 if the event was filtered, or -1 if the event queue
+ *          was full or there was some other error.
+ */
+extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
+
+typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
+
+/**
+ *  Sets up a filter to process all events before they change internal state and
+ *  are posted to the internal event queue.
+ *
+ *  The filter is prototyped as:
+ *  \code
+ *      int SDL_EventFilter(void *userdata, SDL_Event * event);
+ *  \endcode
+ *
+ *  If the filter returns 1, then the event will be added to the internal queue.
+ *  If it returns 0, then the event will be dropped from the queue, but the
+ *  internal state will still be updated.  This allows selective filtering of
+ *  dynamically arriving events.
+ *
+ *  \warning  Be very careful of what you do in the event filter function, as
+ *            it may run in a different thread!
+ *
+ *  There is one caveat when dealing with the ::SDL_QuitEvent event type.  The
+ *  event filter is only called when the window manager desires to close the
+ *  application window.  If the event filter returns 1, then the window will
+ *  be closed, otherwise the window will remain open if possible.
+ *
+ *  If the quit event is generated by an interrupt signal, it will bypass the
+ *  internal queue and be delivered to the application at the next event poll.
+ */
+extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
+                                                void *userdata);
+
+/**
+ *  Return the current event filter - can be used to "chain" filters.
+ *  If there is no event filter set, this function returns SDL_FALSE.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
+                                                    void **userdata);
+
+/**
+ *  Add a function which is called when an event is added to the queue.
+ */
+extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
+                                               void *userdata);
+
+/**
+ *  Remove an event watch function added with SDL_AddEventWatch()
+ */
+extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
+                                               void *userdata);
+
+/**
+ *  Run the filter function on the current event queue, removing any
+ *  events for which the filter returns 0.
+ */
+extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
+                                              void *userdata);
+
+/*@{*/
+#define SDL_QUERY   -1
+#define SDL_IGNORE   0
+#define SDL_DISABLE  0
+#define SDL_ENABLE   1
+
+/**
+ *  This function allows you to set the state of processing certain events.
+ *   - If \c state is set to ::SDL_IGNORE, that event will be automatically
+ *     dropped from the event queue and will not event be filtered.
+ *   - If \c state is set to ::SDL_ENABLE, that event will be processed
+ *     normally.
+ *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
+ *     current processing state of the specified event.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
+/*@}*/
+#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
+
+/**
+ *  This function allocates a set of user-defined events, and returns
+ *  the beginning event number for that set of events.
+ *
+ *  If there aren't enough user-defined events left, this function
+ *  returns (Uint32)-1
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_events_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 294 - 0
ThirdParty/SDL/include/SDL_gamecontroller.h

@@ -0,0 +1,294 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_gamecontroller.h
+ *
+ *  Include file for SDL game controller event handling
+ */
+
+#ifndef _SDL_gamecontroller_h
+#define _SDL_gamecontroller_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *  \file SDL_gamecontroller.h
+ *
+ *  In order to use these functions, SDL_Init() must have been called
+ *  with the ::SDL_INIT_JOYSTICK flag.  This causes SDL to scan the system
+ *  for game controllers, and load appropriate drivers.
+ */
+
+/* The gamecontroller structure used to identify an SDL game controller */
+struct _SDL_GameController;
+typedef struct _SDL_GameController SDL_GameController;
+
+
+typedef enum
+{
+    SDL_CONTROLLER_BINDTYPE_NONE = 0,
+    SDL_CONTROLLER_BINDTYPE_BUTTON,
+    SDL_CONTROLLER_BINDTYPE_AXIS,
+    SDL_CONTROLLER_BINDTYPE_HAT
+} SDL_GameControllerBindType;
+
+/**
+ *  Get the SDL joystick layer binding for this controller button/axis mapping
+ */
+typedef struct SDL_GameControllerButtonBind
+{
+    SDL_GameControllerBindType bindType;
+    union
+    {
+        int button;
+        int axis;
+        struct {
+            int hat;
+            int hat_mask;
+        } hat;
+    } value;
+
+} SDL_GameControllerButtonBind;
+
+
+/**
+ *  To count the number of game controllers in the system for the following:
+ *  int nJoysticks = SDL_NumJoysticks();
+ *  int nGameControllers = 0;
+ *  for ( int i = 0; i < nJoysticks; i++ ) {
+ *      if ( SDL_IsGameController(i) ) {
+ *          nGameControllers++;
+ *      }
+ *  }
+ *
+ *  Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
+ *  guid,name,mappings
+ *
+ *  Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
+ *  Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
+ *  The mapping format for joystick is:
+ *      bX - a joystick button, index X
+ *      hX.Y - hat X with value Y
+ *      aX - axis X of the joystick
+ *  Buttons can be used as a controller axis and vice versa.
+ *
+ *  This string shows an example of a valid mapping for a controller
+ *  "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
+ *
+ */
+
+/**
+ *  Add or update an existing mapping configuration
+ *
+ * \return 1 if mapping is added, 0 if updated, -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
+
+/**
+ *  Get a mapping string for a GUID
+ *
+ *  \return the mapping string.  Must be freed with SDL_free.  Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
+
+/**
+ *  Get a mapping string for an open GameController
+ *
+ *  \return the mapping string.  Must be freed with SDL_free.  Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
+
+/**
+ *  Is the joystick on this index supported by the game controller interface?
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
+
+
+/**
+ *  Get the implementation dependent name of a game controller.
+ *  This can be called before any controllers are opened.
+ *  If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+
+/**
+ *  Open a game controller for use.
+ *  The index passed as an argument refers to the N'th game controller on the system.
+ *  This index is the value which will identify this controller in future controller
+ *  events.
+ *
+ *  \return A controller identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
+
+/**
+ *  Return the name for this currently opened controller
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+
+/**
+ *  Returns SDL_TRUE if the controller has been opened and currently connected,
+ *  or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
+
+/**
+ *  Get the underlying joystick object used by a controller
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
+
+/**
+ *  Enable/disable controller event polling.
+ *
+ *  If controller events are disabled, you must call SDL_GameControllerUpdate()
+ *  yourself and check the state of the controller when you want controller
+ *  information.
+ *
+ *  The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
+
+/**
+ *  Update the current state of the open game controllers.
+ *
+ *  This is called automatically by the event loop if any game controller
+ *  events are enabled.
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
+
+
+/**
+ *  The list of axes available from a controller
+ */
+typedef enum
+{
+    SDL_CONTROLLER_AXIS_INVALID = -1,
+    SDL_CONTROLLER_AXIS_LEFTX,
+    SDL_CONTROLLER_AXIS_LEFTY,
+    SDL_CONTROLLER_AXIS_RIGHTX,
+    SDL_CONTROLLER_AXIS_RIGHTY,
+    SDL_CONTROLLER_AXIS_TRIGGERLEFT,
+    SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
+    SDL_CONTROLLER_AXIS_MAX
+} SDL_GameControllerAxis;
+
+/**
+ *  turn this string into a axis mapping
+ */
+extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
+
+/**
+ *  turn this axis enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
+
+/**
+ *  Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
+                                 SDL_GameControllerAxis axis);
+
+/**
+ *  Get the current state of an axis control on a game controller.
+ *
+ *  The state is a value ranging from -32768 to 32767.
+ *
+ *  The axis indices start at index 0.
+ */
+extern DECLSPEC Sint16 SDLCALL
+SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
+                          SDL_GameControllerAxis axis);
+
+/**
+ *  The list of buttons available from a controller
+ */
+typedef enum
+{
+    SDL_CONTROLLER_BUTTON_INVALID = -1,
+    SDL_CONTROLLER_BUTTON_A,
+    SDL_CONTROLLER_BUTTON_B,
+    SDL_CONTROLLER_BUTTON_X,
+    SDL_CONTROLLER_BUTTON_Y,
+    SDL_CONTROLLER_BUTTON_BACK,
+    SDL_CONTROLLER_BUTTON_GUIDE,
+    SDL_CONTROLLER_BUTTON_START,
+    SDL_CONTROLLER_BUTTON_LEFTSTICK,
+    SDL_CONTROLLER_BUTTON_RIGHTSTICK,
+    SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
+    SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
+    SDL_CONTROLLER_BUTTON_DPAD_UP,
+    SDL_CONTROLLER_BUTTON_DPAD_DOWN,
+    SDL_CONTROLLER_BUTTON_DPAD_LEFT,
+    SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
+    SDL_CONTROLLER_BUTTON_MAX
+} SDL_GameControllerButton;
+
+/**
+ *  turn this string into a button mapping
+ */
+extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
+
+/**
+ *  turn this button enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
+
+/**
+ *  Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
+                                   SDL_GameControllerButton button);
+
+
+/**
+ *  Get the current state of a button on a game controller.
+ *
+ *  The button indices start at index 0.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
+                                                          SDL_GameControllerButton button);
+
+/**
+ *  Close a controller previously opened with SDL_GameControllerOpen().
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_gamecontroller_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 6
ThirdParty/SDL/include/SDL_gesture.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_gesture.h
- *  
+ *
  *  Include file for SDL gesture event handling.
  */
 
@@ -38,9 +38,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 typedef Sint64 SDL_GestureID;
@@ -80,9 +78,7 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 175 - 180
ThirdParty/SDL/include/SDL_haptic.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,10 +21,10 @@
 
 /**
  *  \file SDL_haptic.h
- *  
+ *
  *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
  *         devices.
- * 
+ *
  *  The basic usage is as follows:
  *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
  *   - Open a Haptic Device.
@@ -119,16 +119,14 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-   /* *INDENT-ON* */                                                         
 #endif /* __cplusplus */
 
 /**
  *  \typedef SDL_Haptic
- *  
+ *
  *  \brief The haptic structure used to identify an SDL haptic.
- *  
+ *
  *  \sa SDL_HapticOpen
  *  \sa SDL_HapticOpenFromJoystick
  *  \sa SDL_HapticClose
@@ -139,7 +137,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \name Haptic features
- *  
+ *
  *  Different haptic features a device can have.
  */
 /*@{*/
@@ -153,68 +151,68 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *  \brief Constant effect supported.
  *
  *  Constant haptic effect.
- *  
+ *
  *  \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_CONSTANT   (1<<0)
 
 /**
  *  \brief Sine wave effect supported.
- *  
+ *
  *  Periodic haptic effect that simulates sine waves.
- *  
+ *
  *  \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SINE       (1<<1)
 
 /**
  *  \brief Square wave effect supported.
- *  
+ *
  *  Periodic haptic effect that simulates square waves.
- * 
+ *
  *  \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SQUARE     (1<<2)
 
 /**
  *  \brief Triangle wave effect supported.
- *  
+ *
  *  Periodic haptic effect that simulates triangular waves.
- *  
+ *
  *  \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_TRIANGLE   (1<<3)
 
 /**
  *  \brief Sawtoothup wave effect supported.
- *  
+ *
  *  Periodic haptic effect that simulates saw tooth up waves.
- *  
+ *
  *  \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
 
 /**
  *  \brief Sawtoothdown wave effect supported.
- *  
+ *
  *  Periodic haptic effect that simulates saw tooth down waves.
- *  
+ *
  *  \sa SDL_HapticPeriodic
  */
 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
 
 /**
  *  \brief Ramp effect supported.
- *  
+ *
  *  Ramp haptic effect.
- *  
+ *
  *  \sa SDL_HapticRamp
  */
 #define SDL_HAPTIC_RAMP       (1<<6)
 
 /**
  *  \brief Spring effect supported - uses axes position.
- *  
+ *
  *  Condition haptic effect that simulates a spring.  Effect is based on the
  *  axes position.
  *
@@ -224,17 +222,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \brief Damper effect supported - uses axes velocity.
- *  
+ *
  *  Condition haptic effect that simulates dampening.  Effect is based on the
  *  axes velocity.
- *  
+ *
  *  \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_DAMPER     (1<<8)
 
 /**
  *  \brief Inertia effect supported - uses axes acceleration.
- *  
+ *
  *  Condition haptic effect that simulates inertia.  Effect is based on the axes
  *  acceleration.
  *
@@ -244,17 +242,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \brief Friction effect supported - uses axes movement.
- *  
- *  Condition haptic effect that simulates friction.  Effect is based on the 
+ *
+ *  Condition haptic effect that simulates friction.  Effect is based on the
  *  axes movement.
- *  
+ *
  *  \sa SDL_HapticCondition
  */
 #define SDL_HAPTIC_FRICTION   (1<<10)
 
 /**
  *  \brief Custom effect is supported.
- *  
+ *
  *  User defined custom haptic effect.
  */
 #define SDL_HAPTIC_CUSTOM     (1<<11)
@@ -265,34 +263,34 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \brief Device can set global gain.
- *  
+ *
  *  Device supports setting the global gain.
- *  
+ *
  *  \sa SDL_HapticSetGain
  */
 #define SDL_HAPTIC_GAIN       (1<<12)
 
 /**
  *  \brief Device can set autocenter.
- *  
+ *
  *  Device supports setting autocenter.
- *  
+ *
  *  \sa SDL_HapticSetAutocenter
  */
 #define SDL_HAPTIC_AUTOCENTER (1<<13)
 
 /**
  *  \brief Device can be queried for effect status.
- *  
+ *
  *  Device can be queried for effect status.
- *  
+ *
  *  \sa SDL_HapticGetEffectStatus
  */
 #define SDL_HAPTIC_STATUS     (1<<14)
 
 /**
  *  \brief Device can be paused.
- *  
+ *
  *  \sa SDL_HapticPause
  *  \sa SDL_HapticUnpause
  */
@@ -306,21 +304,21 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \brief Uses polar coordinates for the direction.
- *  
+ *
  *  \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_POLAR      0
 
 /**
  *  \brief Uses cartesian coordinates for the direction.
- *  
+ *
  *  \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_CARTESIAN  1
 
 /**
  *  \brief Uses spherical coordinates for the direction.
- *  
+ *
  *  \sa SDL_HapticDirection
  */
 #define SDL_HAPTIC_SPHERICAL  2
@@ -343,7 +341,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
 
 /**
  *  \brief Structure that represents a haptic direction.
- *  
+ *
  *  Directions can be specified by:
  *   - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
  *   - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
@@ -361,8 +359,8 @@ typedef struct _SDL_Haptic SDL_Haptic;
                  |  | |'-----'|
                  |__|~')_____('
                    [ COMPUTER ]
-    
-    
+
+
                      North (0,-1)
                          ^
                          |
@@ -372,22 +370,22 @@ typedef struct _SDL_Haptic SDL_Haptic;
                          |
                          v
                       South (0,1)
-    
-    
+
+
                       [ USER ]
                         \|||/
                         (o o)
                   ---ooO-(_)-Ooo---
     \endverbatim
- *  
- *  If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a 
+ *
+ *  If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
  *  degree starting north and turning clockwise.  ::SDL_HAPTIC_POLAR only uses
  *  the first \c dir parameter.  The cardinal directions would be:
  *   - North: 0 (0 degrees)
  *   - East: 9000 (90 degrees)
  *   - South: 18000 (180 degrees)
  *   - West: 27000 (270 degrees)
- *  
+ *
  *  If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
  *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN uses
  *  the first three \c dir parameters.  The cardinal directions would be:
@@ -395,13 +393,13 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *   - East:  -1, 0, 0
  *   - South:  0, 1, 0
  *   - West:   1, 0, 0
- *  
+ *
  *  The Z axis represents the height of the effect if supported, otherwise
  *  it's unused.  In cartesian encoding (1, 2) would be the same as (2, 4), you
  *  can use any multiple you want, only the direction matters.
- *  
+ *
  *  If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
- *  The first two \c dir parameters are used.  The \c dir parameters are as 
+ *  The first two \c dir parameters are used.  The \c dir parameters are as
  *  follows (all values are in hundredths of degrees):
  *   - Degrees from (1, 0) rotated towards (0, 1).
  *   - Degrees towards (0, 0, 1) (device needs at least 3 axes).
@@ -411,17 +409,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *  from the south means the user will have to pull the stick to counteract):
  *  \code
  *  SDL_HapticDirection direction;
- *  
+ *
  *  // Cartesian directions
  *  direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
  *  direction.dir[0] = 0; // X position
  *  direction.dir[1] = 1; // Y position
  *  // Assuming the device has 2 axes, we don't need to specify third parameter.
- *  
+ *
  *  // Polar directions
  *  direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
  *  direction.dir[0] = 18000; // Polar only uses first parameter
- *  
+ *
  *  // Spherical coordinates
  *  direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
  *  direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
@@ -442,12 +440,12 @@ typedef struct SDL_HapticDirection
 
 /**
  *  \brief A structure containing a template for a Constant effect.
- *  
+ *
  *  The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
- *  
+ *
  *  A constant effect applies a constant force in the specified direction
  *  to the joystick.
- *  
+ *
  *  \sa SDL_HAPTIC_CONSTANT
  *  \sa SDL_HapticEffect
  */
@@ -477,25 +475,25 @@ typedef struct SDL_HapticConstant
 
 /**
  *  \brief A structure containing a template for a Periodic effect.
- *  
+ *
  *  The struct handles the following effects:
  *   - ::SDL_HAPTIC_SINE
  *   - ::SDL_HAPTIC_SQUARE
  *   - ::SDL_HAPTIC_TRIANGLE
  *   - ::SDL_HAPTIC_SAWTOOTHUP
  *   - ::SDL_HAPTIC_SAWTOOTHDOWN
- *  
+ *
  *  A periodic effect consists in a wave-shaped effect that repeats itself
  *  over time.  The type determines the shape of the wave and the parameters
  *  determine the dimensions of the wave.
- *  
- *  Phase is given by hundredth of a cyle meaning that giving the phase a value
- *  of 9000 will displace it 25% of it's period.  Here are sample values:
+ *
+ *  Phase is given by hundredth of a cycle meaning that giving the phase a value
+ *  of 9000 will displace it 25% of its period.  Here are sample values:
  *   -     0: No phase displacement.
- *   -  9000: Displaced 25% of it's period.
- *   - 18000: Displaced 50% of it's period.
- *   - 27000: Displaced 75% of it's period.
- *   - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered.
+ *   -  9000: Displaced 25% of its period.
+ *   - 18000: Displaced 50% of its period.
+ *   - 27000: Displaced 75% of its period.
+ *   - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
  *
  *  Examples:
  *  \verbatim
@@ -503,28 +501,28 @@ typedef struct SDL_HapticConstant
       __      __      __      __
      /  \    /  \    /  \    /
     /    \__/    \__/    \__/
-    
+
     SDL_HAPTIC_SQUARE
      __    __    __    __    __
     |  |  |  |  |  |  |  |  |  |
     |  |__|  |__|  |__|  |__|  |
-    
+
     SDL_HAPTIC_TRIANGLE
       /\    /\    /\    /\    /\
      /  \  /  \  /  \  /  \  /
     /    \/    \/    \/    \/
-    
+
     SDL_HAPTIC_SAWTOOTHUP
       /|  /|  /|  /|  /|  /|  /|
      / | / | / | / | / | / | / |
     /  |/  |/  |/  |/  |/  |/  |
-    
+
     SDL_HAPTIC_SAWTOOTHDOWN
     \  |\  |\  |\  |\  |\  |\  |
      \ | \ | \ | \ | \ | \ | \ |
       \|  \|  \|  \|  \|  \|  \|
     \endverbatim
- *  
+ *
  *  \sa SDL_HAPTIC_SINE
  *  \sa SDL_HAPTIC_SQUARE
  *  \sa SDL_HAPTIC_TRIANGLE
@@ -563,21 +561,21 @@ typedef struct SDL_HapticPeriodic
 
 /**
  *  \brief A structure containing a template for a Condition effect.
- *  
+ *
  *  The struct handles the following effects:
  *   - ::SDL_HAPTIC_SPRING: Effect based on axes position.
  *   - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
  *   - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
  *   - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
- *  
+ *
  *  Direction is handled by condition internals instead of a direction member.
  *  The condition effect specific members have three parameters.  The first
  *  refers to the X axis, the second refers to the Y axis and the third
  *  refers to the Z axis.  The right terms refer to the positive side of the
- *  axis and the left terms refer to the negative side of the axis.  Please 
+ *  axis and the left terms refer to the negative side of the axis.  Please
  *  refer to the ::SDL_HapticDirection diagram for which side is positive and
  *  which is negative.
- *  
+ *
  *  \sa SDL_HapticDirection
  *  \sa SDL_HAPTIC_SPRING
  *  \sa SDL_HAPTIC_DAMPER
@@ -611,14 +609,14 @@ typedef struct SDL_HapticCondition
 
 /**
  *  \brief A structure containing a template for a Ramp effect.
- *  
+ *
  *  This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
- *  
+ *
  *  The ramp effect starts at start strength and ends at end strength.
  *  It augments in linear fashion.  If you use attack and fade with a ramp
- *  they effects get added to the ramp effect making the effect become
+ *  the effects get added to the ramp effect making the effect become
  *  quadratic instead of linear.
- *  
+ *
  *  \sa SDL_HAPTIC_RAMP
  *  \sa SDL_HapticEffect
  */
@@ -649,14 +647,14 @@ typedef struct SDL_HapticRamp
 
 /**
  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
- *  
+ *
  *  A custom force feedback effect is much like a periodic effect, where the
- *  application can define it's exact shape.  You will have to allocate the
+ *  application can define its exact shape.  You will have to allocate the
  *  data yourself.  Data should consist of channels * samples Uint16 samples.
- *  
+ *
  *  If channels is one, the effect is rotated using the defined direction.
  *  Otherwise it uses the samples in data for the different axes.
- *  
+ *
  *  \sa SDL_HAPTIC_CUSTOM
  *  \sa SDL_HapticEffect
  */
@@ -689,34 +687,34 @@ typedef struct SDL_HapticCustom
 
 /**
  *  \brief The generic template for any haptic effect.
- *  
+ *
  *  All values max at 32767 (0x7FFF).  Signed values also can be negative.
  *  Time values unless specified otherwise are in milliseconds.
- *  
- *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 
- *  value.  Neither delay, interval, attack_length nor fade_length support 
+ *
+ *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
+ *  value.  Neither delay, interval, attack_length nor fade_length support
  *  ::SDL_HAPTIC_INFINITY.  Fade will also not be used since effect never ends.
- *  
+ *
  *  Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
  *  ::SDL_HAPTIC_INFINITY.
- *  
+ *
  *  Button triggers may not be supported on all devices, it is advised to not
  *  use them if possible.  Buttons start at index 1 instead of index 0 like
- *  they joystick.
- *  
+ *  the joystick.
+ *
  *  If both attack_length and fade_level are 0, the envelope is not used,
  *  otherwise both values are used.
- *  
+ *
  *  Common parts:
  *  \code
  *  // Replay - All effects have this
  *  Uint32 length;        // Duration of effect (ms).
  *  Uint16 delay;         // Delay before starting effect.
- *  
+ *
  *  // Trigger - All effects have this
  *  Uint16 button;        // Button that triggers effect.
  *  Uint16 interval;      // How soon before effect can be triggered again.
- *  
+ *
  *  // Envelope - All effects except condition effects have this
  *  Uint16 attack_length; // Duration of the attack (ms).
  *  Uint16 attack_level;  // Level at the start of the attack.
@@ -734,18 +732,18 @@ typedef struct SDL_HapticCustom
     |                     /                 \
     |                    /                   \
     |                   /                     \
-    |                  /                       \ 
+    |                  /                       \
     | attack_level --> |                        \
     |                  |                        |  <---  fade_level
     |
     +--------------------------------------------------> Time
                        [--]                 [---]
                        attack_length        fade_length
-    
+
     [------------------][-----------------------]
     delay               length
     \endverbatim
- *  
+ *
  *  Note either the attack_level or the fade_level may be above the actual
  *  effect level.
  *
@@ -769,19 +767,19 @@ typedef union SDL_HapticEffect
 
 /* Function prototypes */
 /**
- *  \brief Count the number of joysticks attached to the system.
- *  
+ *  \brief Count the number of haptic devices attached to the system.
+ *
  *  \return Number of haptic devices detected on the system.
  */
 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 
 /**
  *  \brief Get the implementation dependent name of a Haptic device.
- *  
+ *
  *  This can be called before any joysticks are opened.
  *  If no name can be found, this function returns NULL.
- *  
- *  \param device_index Index of the device to get it's name.
+ *
+ *  \param device_index Index of the device to get its name.
  *  \return Name of the device or NULL on error.
  *
  *  \sa SDL_NumHaptics
@@ -790,11 +788,11 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
 
 /**
  *  \brief Opens a Haptic device for usage.
- *  
- *  The index passed as an argument refers to the N'th Haptic device on this 
+ *
+ *  The index passed as an argument refers to the N'th Haptic device on this
  *  system.
  *
- *  When opening a haptic device, it's gain will be set to maximum and
+ *  When opening a haptic device, its gain will be set to maximum and
  *  autocenter will be disabled.  To modify these values use
  *  SDL_HapticSetGain() and SDL_HapticSetAutocenter().
  *
@@ -814,10 +812,10 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
 
 /**
  *  \brief Checks if the haptic device at index has been opened.
- *  
+ *
  *  \param device_index Index to check to see if it has been opened.
  *  \return 1 if it has been opened or 0 if it hasn't.
- *  
+ *
  *  \sa SDL_HapticOpen
  *  \sa SDL_HapticIndex
  */
@@ -825,10 +823,10 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
 
 /**
  *  \brief Gets the index of a haptic device.
- *  
+ *
  *  \param haptic Haptic device to get the index of.
  *  \return The index of the haptic device or -1 on error.
- *  
+ *
  *  \sa SDL_HapticOpen
  *  \sa SDL_HapticOpened
  */
@@ -836,18 +834,18 @@ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
 
 /**
  *  \brief Gets whether or not the current mouse has haptic capabilities.
- *  
+ *
  *  \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
- *  
+ *
  *  \sa SDL_HapticOpenFromMouse
  */
 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
 
 /**
  *  \brief Tries to open a haptic device from the current mouse.
- *  
+ *
  *  \return The haptic device identifier or NULL on error.
- *  
+ *
  *  \sa SDL_MouseIsHaptic
  *  \sa SDL_HapticOpen
  */
@@ -855,29 +853,29 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
 
 /**
  *  \brief Checks to see if a joystick has haptic features.
- *  
+ *
  *  \param joystick Joystick to test for haptic capabilities.
  *  \return 1 if the joystick is haptic, 0 if it isn't
  *          or -1 if an error ocurred.
- *  
+ *
  *  \sa SDL_HapticOpenFromJoystick
  */
 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
 
 /**
  *  \brief Opens a Haptic device for usage from a Joystick device.
- *  
- *  You must still close the haptic device seperately.  It will not be closed 
+ *
+ *  You must still close the haptic device seperately.  It will not be closed
  *  with the joystick.
- *  
+ *
  *  When opening from a joystick you should first close the haptic device before
  *  closing the joystick device.  If not, on some implementations the haptic
  *  device will also get unallocated and you'll be unable to use force feedback
  *  on that device.
- *  
+ *
  *  \param joystick Joystick to create a haptic device from.
  *  \return A valid haptic device identifier on success or NULL on error.
- *  
+ *
  *  \sa SDL_HapticOpen
  *  \sa SDL_HapticClose
  */
@@ -886,34 +884,34 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
 
 /**
  *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
- *  
+ *
  *  \param haptic Haptic device to close.
  */
 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
 
 /**
  *  \brief Returns the number of effects a haptic device can store.
- *  
+ *
  *  On some platforms this isn't fully supported, and therefore is an
- *  aproximation.  Always check to see if your created effect was actually
+ *  approximation.  Always check to see if your created effect was actually
  *  created and do not rely solely on SDL_HapticNumEffects().
- *  
+ *
  *  \param haptic The haptic device to query effect max.
  *  \return The number of effects the haptic device can store or
  *          -1 on error.
- *  
+ *
  *  \sa SDL_HapticNumEffectsPlaying
  *  \sa SDL_HapticQuery
  */
 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
 
 /**
- *  \brief Returns the number of effects a haptic device can play at the same 
+ *  \brief Returns the number of effects a haptic device can play at the same
  *         time.
- *  
- *  This is not supported on all platforms, but will always return a value.  
- *  Added here for the sake of completness.
- *  
+ *
+ *  This is not supported on all platforms, but will always return a value.
+ *  Added here for the sake of completeness.
+ *
  *  \param haptic The haptic device to query maximum playing effects.
  *  \return The number of effects the haptic device can play at the same time
  *          or -1 on error.
@@ -925,17 +923,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
 
 /**
  *  \brief Gets the haptic devices supported features in bitwise matter.
- *  
- *  Example: 
+ *
+ *  Example:
  *  \code
  *  if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) {
  *      printf("We have constant haptic effect!");
  *  }
  *  \endcode
- *  
+ *
  *  \param haptic The haptic device to query.
  *  \return Haptic features in bitwise manner (OR'd).
- *  
+ *
  *  \sa SDL_HapticNumEffects
  *  \sa SDL_HapticEffectSupported
  */
@@ -944,18 +942,18 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
 
 /**
  *  \brief Gets the number of haptic axes the device has.
- *  
+ *
  *  \sa SDL_HapticDirection
  */
 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
 
 /**
  *  \brief Checks to see if effect is supported by haptic.
- *  
+ *
  *  \param haptic Haptic device to check on.
  *  \param effect Effect to check to see if it is supported.
  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
- *  
+ *
  *  \sa SDL_HapticQuery
  *  \sa SDL_HapticNewEffect
  */
@@ -965,11 +963,11 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
 
 /**
  *  \brief Creates a new haptic effect on the device.
- *  
+ *
  *  \param haptic Haptic device to create the effect on.
  *  \param effect Properties of the effect to create.
  *  \return The id of the effect on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticDestroyEffect
@@ -979,17 +977,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
 
 /**
  *  \brief Updates the properties of an effect.
- *  
+ *
  *  Can be used dynamically, although behaviour when dynamically changing
  *  direction may be strange.  Specifically the effect may reupload itself
  *  and start playing from the start.  You cannot change the type either when
  *  running SDL_HapticUpdateEffect().
- *  
+ *
  *  \param haptic Haptic device that has the effect.
  *  \param effect Effect to update.
  *  \param data New effect properties to use.
  *  \return The id of the effect on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticNewEffect
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticDestroyEffect
@@ -999,19 +997,19 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
                                                    SDL_HapticEffect * data);
 
 /**
- *  \brief Runs the haptic effect on it's assosciated haptic device.
- *  
+ *  \brief Runs the haptic effect on its associated haptic device.
+ *
  *  If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
  *  repeating the envelope (attack and fade) every time.  If you only want the
  *  effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
  *  parameter.
- *  
+ *
  *  \param haptic Haptic device to run the effect on.
  *  \param effect Identifier of the haptic effect to run.
  *  \param iterations Number of iterations to run the effect. Use
  *         ::SDL_HAPTIC_INFINITY for infinity.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticStopEffect
  *  \sa SDL_HapticDestroyEffect
  *  \sa SDL_HapticGetEffectStatus
@@ -1021,12 +1019,12 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
                                                 Uint32 iterations);
 
 /**
- *  \brief Stops the haptic effect on it's assosciated haptic device.
- *  
+ *  \brief Stops the haptic effect on its associated haptic device.
+ *
  *  \param haptic Haptic device to stop the effect on.
  *  \param effect Identifier of the effect to stop.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticDestroyEffect
  */
@@ -1035,13 +1033,13 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
 
 /**
  *  \brief Destroys a haptic effect on the device.
- *  
- *  This will stop the effect if it's running.  Effects are automatically 
+ *
+ *  This will stop the effect if it's running.  Effects are automatically
  *  destroyed when the device is closed.
- *  
+ *
  *  \param haptic Device to destroy the effect on.
  *  \param effect Identifier of the effect to destroy.
- *  
+ *
  *  \sa SDL_HapticNewEffect
  */
 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
@@ -1049,14 +1047,13 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
 
 /**
  *  \brief Gets the status of the current effect on the haptic device.
- *  
+ *
  *  Device must support the ::SDL_HAPTIC_STATUS feature.
- *  
+ *
  *  \param haptic Haptic device to query the effect status on.
- *  \param effect Identifier of the effect to query it's status.
- *  \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing
- *          or -1 on error.
- *  
+ *  \param effect Identifier of the effect to query its status.
+ *  \return 0 if it isn't playing, 1 if it is playing or -1 on error.
+ *
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticStopEffect
  */
@@ -1065,26 +1062,26 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
 
 /**
  *  \brief Sets the global gain of the device.
- *  
+ *
  *  Device must support the ::SDL_HAPTIC_GAIN feature.
- *  
- *  The user may specify the maxmimum gain by setting the environment variable
- *  ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100.  All calls to
- *  SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the
+ *
+ *  The user may specify the maximum gain by setting the environment variable
+ *  SDL_HAPTIC_GAIN_MAX which should be between 0 and 100.  All calls to
+ *  SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
  *  maximum.
- *  
+ *
  *  \param haptic Haptic device to set the gain on.
  *  \param gain Value to set the gain to, should be between 0 and 100.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticQuery
  */
 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
 
 /**
  *  \brief Sets the global autocenter of the device.
- *  
- *  Autocenter should be between 0 and 100.  Setting it to 0 will disable 
+ *
+ *  Autocenter should be between 0 and 100.  Setting it to 0 will disable
  *  autocentering.
  *
  *  Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
@@ -1092,7 +1089,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
  *  \param haptic Haptic device to set autocentering on.
  *  \param autocenter Value to set autocenter to, 0 disables autocentering.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticQuery
  */
 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
@@ -1100,35 +1097,35 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
 
 /**
  *  \brief Pauses a haptic device.
- *  
- *  Device must support the ::SDL_HAPTIC_PAUSE feature.  Call 
+ *
+ *  Device must support the ::SDL_HAPTIC_PAUSE feature.  Call
  *  SDL_HapticUnpause() to resume playback.
- *  
+ *
  *  Do not modify the effects nor add new ones while the device is paused.
  *  That can cause all sorts of weird errors.
- *  
+ *
  *  \param haptic Haptic device to pause.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticUnpause
  */
 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
 
 /**
  *  \brief Unpauses a haptic device.
- *  
+ *
  *  Call to unpause after SDL_HapticPause().
- *  
+ *
  *  \param haptic Haptic device to pause.
  *  \return 0 on success or -1 on error.
- *  
+ *
  *  \sa SDL_HapticPause
  */
 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
 
 /**
  *  \brief Stops all the currently playing effects on a haptic device.
- *  
+ *
  *  \param haptic Haptic device to stop.
  *  \return 0 on success or -1 on error.
  */
@@ -1164,7 +1161,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
  *
  *  \param haptic Haptic device to play rumble effect on.
  *  \param strength Strength of the rumble to play as a 0-1 float value.
- *  \param length Length of the rumble to play in miliseconds.
+ *  \param length Length of the rumble to play in milliseconds.
  *  \return 0 on success or -1 on error.
  *
  *  \sa SDL_HapticRumbleSupported
@@ -1189,9 +1186,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 108 - 14
ThirdParty/SDL/include/SDL_hints.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_hints.h
- *  
+ *
  *  Official documentation for SDL configuration variables
  *
  *  This file contains functions to set and get configuration hints,
@@ -44,15 +44,13 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
- *  \brief  A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. 
+ *  \brief  A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
  *
- *  SDL can try to accelerate the SDL 1.2 screen surface by using streaming
+ *  SDL can try to accelerate the SDL screen surface by using streaming
  *  textures with a 3D rendering engine.  This variable controls whether and
  *  how this is done.
  *
@@ -109,7 +107,7 @@ extern "C" {
 #define SDL_HINT_RENDER_SCALE_QUALITY       "SDL_RENDER_SCALE_QUALITY"
 
 /**
- *  \brief  A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
+ *  \brief  A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
  *
  *  This variable can be set to the following values:
  *    "0"       - Disable vsync
@@ -118,7 +116,58 @@ extern "C" {
  *  By default SDL does not sync screen surface updates with vertical refresh.
  */
 #define SDL_HINT_RENDER_VSYNC               "SDL_RENDER_VSYNC"
-	
+
+/**
+ *  \brief  A variable controlling whether the X11 VidMode extension should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Disable XVidMode
+ *    "1"       - Enable XVidMode
+ *
+ *  By default SDL will use XVidMode if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XVIDMODE         "SDL_VIDEO_X11_XVIDMODE"
+
+/**
+ *  \brief  A variable controlling whether the X11 Xinerama extension should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Disable Xinerama
+ *    "1"       - Enable Xinerama
+ *
+ *  By default SDL will use Xinerama if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XINERAMA         "SDL_VIDEO_X11_XINERAMA"
+
+/**
+ *  \brief  A variable controlling whether the X11 XRandR extension should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Disable XRandR
+ *    "1"       - Enable XRandR
+ *
+ *  By default SDL will not use XRandR because of window manager issues.
+ */
+#define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
+
+/**
+ *  \brief  A variable controlling whether grabbing input grabs the keyboard
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Grab will affect only the mouse
+ *    "1"       - Grab will affect mouse and keyboard
+ *
+ *  By default SDL will not grab the keyboard so system shortcuts still work.
+ */
+#define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
+
+/**
+ *  \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true.
+ *
+ */
+#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS   "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
+
+
 /**
  *  \brief  A variable controlling whether the idle timer is disabled on iOS.
  *
@@ -132,7 +181,7 @@ extern "C" {
  *    "1"       - Disable idle timer
  */
 #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
-	
+
 /**
  *  \brief  A variable controlling which orientations are allowed on iOS.
  *
@@ -145,6 +194,53 @@ extern "C" {
 #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
 
 
+/**
+ *  \brief  A variable that lets you disable the detection and use of Xinput gamepad devices
+ *
+ *  The variable can be set to the following values:
+ *    "0"       - Disable XInput timer (only uses direct input)
+ *    "1"       - Enable XInput timer (the default)
+ */
+#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
+
+
+/**
+ *  \brief  A variable that lets you manually hint extra gamecontroller db entries
+ *
+ *  The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
+ *
+ *  This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
+ *  You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
+ */
+#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+
+
+/**
+ *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
+ *
+ * The default value is "0".
+ *
+ *  The variable can be set to the following values:
+ *    "0"       - Disable joystick & gamecontroller input events when the
+ *                application is in the background.
+ *    "1"       - Enable joystick & gamecontroller input events when the
+ *                application is in the backgroumd.
+ */
+#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+
+
+/**
+ *  \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
+ *      This is a debugging aid for developers and not expected to be used by end users. The default is "1"
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - don't allow topmost
+ *    "1"       - allow topmost
+ */
+#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
+
+
+
 /**
  *  \brief  An enumeration of hint priorities
  */
@@ -162,7 +258,7 @@ typedef enum
  *  The priority controls the behavior when setting a hint that already
  *  has a value.  Hints will replace existing hints of their priority and
  *  lower.  Environment variables are considered to have override priority.
- * 
+ *
  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
@@ -171,7 +267,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
 
 /**
  *  \brief Set a hint with normal priority
- * 
+ *
  *  \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
@@ -180,7 +276,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
 
 /**
  *  \brief Get a hint
- *  
+ *
  *  \return The string value of a hint variable.
  */
 extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
@@ -195,9 +291,7 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 75 - 34
ThirdParty/SDL/include/SDL_joystick.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,8 +21,19 @@
 
 /**
  *  \file SDL_joystick.h
- *  
+ *
  *  Include file for SDL joystick event handling
+ *
+ * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick
+ *   behind a device_index changing as joysticks are plugged and unplugged.
+ *
+ * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
+ *   then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
+ *
+ * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
+ *   the device (a X360 wired controller for example). This identifier is platform dependent.
+ *
+ *
  */
 
 #ifndef _SDL_joystick_h
@@ -34,9 +45,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -51,10 +60,17 @@ extern "C" {
 struct _SDL_Joystick;
 typedef struct _SDL_Joystick SDL_Joystick;
 
+/* A structure that encodes the stable unique id for a joystick device */
+typedef struct {
+    Uint8 data[16];
+} SDL_JoystickGUID;
+
+typedef Sint32 SDL_JoystickID;
+
 
 /* Function prototypes */
 /**
- *  Count the number of joysticks attached to the system
+ *  Count the number of joysticks attached to the system right now
  */
 extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
 
@@ -63,27 +79,54 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
  *  This can be called before any joysticks are opened.
  *  If no name can be found, this function returns NULL.
  */
-extern DECLSPEC const char *SDLCALL SDL_JoystickName(int device_index);
+extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
 
 /**
- *  Open a joystick for use.  
- *  The index passed as an argument refers tothe N'th joystick on the system.  
+ *  Open a joystick for use.
+ *  The index passed as an argument refers tothe N'th joystick on the system.
  *  This index is the value which will identify this joystick in future joystick
  *  events.
- *  
+ *
  *  \return A joystick identifier, or NULL if an error occurred.
  */
 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
 
 /**
- *  Returns 1 if the joystick has been opened, or 0 if it has not.
+ *  Return the name for this currently opened joystick.
+ *  If no name can be found, this function returns NULL.
  */
-extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
+extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
 
 /**
- *  Get the device index of an opened joystick.
+ *  Return the GUID for the joystick at this index
  */
-extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick * joystick);
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ *  Return the GUID for this opened joystick
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+
+/**
+ *  Return a string representation for this guid. pszGUID must point to at least 33 bytes
+ *  (32 for the string plus a NULL terminator).
+ */
+extern DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
+
+/**
+ *  convert a string into a joystick formatted guid
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
+
+/**
+ *  Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
+
+/**
+ *  Get the instance ID of an opened joystick or -1 if the joystick is invalid.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
 
 /**
  *  Get the number of general axis controls on a joystick.
@@ -92,7 +135,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
 
 /**
  *  Get the number of trackballs on a joystick.
- *  
+ *
  *  Joystick trackballs have only relative motion events associated
  *  with them and their state cannot be polled.
  */
@@ -110,7 +153,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
 
 /**
  *  Update the current state of the open joysticks.
- *  
+ *
  *  This is called automatically by the event loop if any joystick
  *  events are enabled.
  */
@@ -118,20 +161,20 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
 
 /**
  *  Enable/disable joystick event polling.
- *  
+ *
  *  If joystick events are disabled, you must call SDL_JoystickUpdate()
  *  yourself and check the state of the joystick when you want joystick
  *  information.
- *  
+ *
  *  The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
  */
 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 
 /**
  *  Get the current state of an axis control on a joystick.
- *  
+ *
  *  The state is a value ranging from -32768 to 32767.
- *  
+ *
  *  The axis indices start at index 0.
  */
 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
@@ -141,22 +184,22 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
  *  \name Hat positions
  */
 /*@{*/
-#define SDL_HAT_CENTERED	0x00
-#define SDL_HAT_UP		0x01
-#define SDL_HAT_RIGHT		0x02
-#define SDL_HAT_DOWN		0x04
-#define SDL_HAT_LEFT		0x08
-#define SDL_HAT_RIGHTUP		(SDL_HAT_RIGHT|SDL_HAT_UP)
-#define SDL_HAT_RIGHTDOWN	(SDL_HAT_RIGHT|SDL_HAT_DOWN)
-#define SDL_HAT_LEFTUP		(SDL_HAT_LEFT|SDL_HAT_UP)
-#define SDL_HAT_LEFTDOWN	(SDL_HAT_LEFT|SDL_HAT_DOWN)
+#define SDL_HAT_CENTERED    0x00
+#define SDL_HAT_UP      0x01
+#define SDL_HAT_RIGHT       0x02
+#define SDL_HAT_DOWN        0x04
+#define SDL_HAT_LEFT        0x08
+#define SDL_HAT_RIGHTUP     (SDL_HAT_RIGHT|SDL_HAT_UP)
+#define SDL_HAT_RIGHTDOWN   (SDL_HAT_RIGHT|SDL_HAT_DOWN)
+#define SDL_HAT_LEFTUP      (SDL_HAT_LEFT|SDL_HAT_UP)
+#define SDL_HAT_LEFTDOWN    (SDL_HAT_LEFT|SDL_HAT_DOWN)
 /*@}*/
 
 /**
  *  Get the current state of a POV hat on a joystick.
  *
  *  The hat indices start at index 0.
- *  
+ *
  *  \return The return value is one of the following positions:
  *           - ::SDL_HAT_CENTERED
  *           - ::SDL_HAT_UP
@@ -173,9 +216,9 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
 
 /**
  *  Get the ball axis change since the last poll.
- *  
+ *
  *  \return 0, or -1 if you passed it invalid parameters.
- *  
+ *
  *  The ball indices start at index 0.
  */
 extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
@@ -183,7 +226,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
 
 /**
  *  Get the current state of a button on a joystick.
- *  
+ *
  *  The button indices start at index 0.
  */
 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
@@ -197,9 +240,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 59 - 27
ThirdParty/SDL/include/SDL_keyboard.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_keyboard.h
- *  
+ *
  *  Include file for SDL keyboard event handling
  */
 
@@ -36,20 +36,20 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \brief The SDL keysym structure, used in key events.
+ *
+ *  \note  If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
  */
 typedef struct SDL_Keysym
 {
     SDL_Scancode scancode;      /**< SDL physical key code - see ::SDL_Scancode for details */
     SDL_Keycode sym;            /**< SDL virtual key code - see ::SDL_Keycode for details */
     Uint16 mod;                 /**< current key modifiers */
-    Uint32 unicode;             /**< \deprecated use SDL_TextInputEvent instead */
+    Uint32 unused;
 } SDL_Keysym;
 
 /* Function prototypes */
@@ -61,20 +61,20 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
 
 /**
  *  \brief Get a snapshot of the current state of the keyboard.
- *  
+ *
  *  \param numkeys if non-NULL, receives the length of the returned array.
- *  
+ *
  *  \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
- *  
+ *
  *  \b Example:
  *  \code
- *  Uint8 *state = SDL_GetKeyboardState(NULL);
+ *  const Uint8 *state = SDL_GetKeyboardState(NULL);
  *  if ( state[SDL_SCANCODE_RETURN] )   {
  *      printf("<RETURN> is pressed.\n");
  *  }
  *  \endcode
  */
-extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
+extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
 
 /**
  *  \brief Get the current key modifier state for the keyboard.
@@ -83,7 +83,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
 
 /**
  *  \brief Set the current key modifier state for the keyboard.
- *  
+ *
  *  \note This does not change the keyboard state, only the key modifier flags.
  */
 extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
@@ -91,9 +91,9 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
 /**
  *  \brief Get the key code corresponding to the given scancode according
  *         to the current keyboard layout.
- *  
+ *
  *  See ::SDL_Keycode for details.
- *  
+ *
  *  \sa SDL_GetKeyName()
  */
 extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
@@ -101,16 +101,16 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode
 /**
  *  \brief Get the scancode corresponding to the given key code according to the
  *         current keyboard layout.
- *  
+ *
  *  See ::SDL_Scancode for details.
- *  
+ *
  *  \sa SDL_GetScancodeName()
  */
 extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
 
 /**
  *  \brief Get a human-readable name for a scancode.
- *  
+ *
  *  \return A pointer to the name for the scancode.
  *          If the scancode doesn't have a name, this function returns
  *          an empty string ("").
@@ -121,7 +121,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
 
 /**
  *  \brief Get a scancode from a human-readable name
- *  
+ *
  *  \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
  *
  *  \sa SDL_Scancode
@@ -130,19 +130,19 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
 
 /**
  *  \brief Get a human-readable name for a key.
- *  
+ *
  *  \return A pointer to a UTF-8 string that stays valid at least until the next
- *          call to this function. If you need it around any longer, you must 
- *          copy it.  If the key doesn't have a name, this function returns an 
+ *          call to this function. If you need it around any longer, you must
+ *          copy it.  If the key doesn't have a name, this function returns an
  *          empty string ("").
- *  
+ *
  *  \sa SDL_Key
  */
 extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
 
 /**
  *  \brief Get a key code from a human-readable name
- *  
+ *
  *  \return key code, or SDLK_UNKNOWN if the name wasn't recognized
  *
  *  \sa SDL_Keycode
@@ -151,32 +151,64 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
 
 /**
  *  \brief Start accepting Unicode text input events.
- *  
+ *         This function will show the on-screen keyboard if supported.
+ *
  *  \sa SDL_StopTextInput()
  *  \sa SDL_SetTextInputRect()
+ *  \sa SDL_HasScreenKeyboardSupport()
  */
 extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
 
+/**
+ *  \brief Return whether or not Unicode text input events are enabled.
+ *
+ *  \sa SDL_StartTextInput()
+ *  \sa SDL_StopTextInput()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
+
 /**
  *  \brief Stop receiving any text input events.
- *  
+ *         This function will hide the on-screen keyboard if supported.
+ *
  *  \sa SDL_StartTextInput()
+ *  \sa SDL_HasScreenKeyboardSupport()
  */
 extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
 
 /**
  *  \brief Set the rectangle used to type Unicode text inputs.
- *  
+ *         This is used as a hint for IME and on-screen keyboard placement.
+ *
  *  \sa SDL_StartTextInput()
  */
 extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
 
+/**
+ *  \brief Returns whether the platform has some screen keyboard support.
+ *
+ *  \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
+ *
+ *  \note Not all screen keyboard functions are supported on all platforms.
+ *
+ *  \sa SDL_IsScreenKeyboardShown()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
+
+/**
+ *  \brief Returns whether the screen keyboard is shown for given window.
+ *
+ *  \param window The window for which screen keyboard should be queried.
+ *
+ *  \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
+ *
+ *  \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 9 - 9
ThirdParty/SDL/include/SDL_keycode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_keycode.h
- *  
+ *
  *  Defines constants which identify keyboard keys and modifiers.
  */
 
@@ -33,7 +33,7 @@
 
 /**
  *  \brief The SDL virtual key representation.
- *  
+ *
  *  Values of this type are used to represent keyboard keys using the current
  *  layout of the keyboard.  These values include Unicode values representing
  *  the unmodified character that would be generated by pressing the key, or
@@ -42,7 +42,7 @@
 typedef Sint32 SDL_Keycode;
 
 #define SDLK_SCANCODE_MASK (1<<30)
-#define SDL_SCANCODE_TO_KEYCODE(X)	(X | SDLK_SCANCODE_MASK)
+#define SDL_SCANCODE_TO_KEYCODE(X)  (X | SDLK_SCANCODE_MASK)
 
 enum
 {
@@ -85,7 +85,7 @@ enum
     SDLK_GREATER = '>',
     SDLK_QUESTION = '?',
     SDLK_AT = '@',
-    /* 
+    /*
        Skip uppercase letters
      */
     SDLK_LEFTBRACKET = '[',
@@ -331,10 +331,10 @@ typedef enum
     KMOD_RESERVED = 0x8000
 } SDL_Keymod;
 
-#define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
-#define KMOD_GUI	(KMOD_LGUI|KMOD_RGUI)
+#define KMOD_CTRL   (KMOD_LCTRL|KMOD_RCTRL)
+#define KMOD_SHIFT  (KMOD_LSHIFT|KMOD_RSHIFT)
+#define KMOD_ALT    (KMOD_LALT|KMOD_RALT)
+#define KMOD_GUI    (KMOD_LGUI|KMOD_RGUI)
 
 #endif /* _SDL_keycode_h */
 

+ 2 - 6
ThirdParty/SDL/include/SDL_loadso.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
  *
  *  System dependent library loading routines
  *
- *  Some things to keep in mind:                                        
+ *  Some things to keep in mind:
  *  \li These functions only work on C function names.  Other languages may
  *      have name mangling and intrinsic language support that varies from
  *      compiler to compiler.
@@ -47,9 +47,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -74,9 +72,7 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 7 - 7
ThirdParty/SDL/include/SDL_log.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_log.h
- *  
+ *
  *  Simple log messages with categories and priorities.
  *
  *  By default logs are quiet, but if you're debugging SDL you might want:
@@ -42,9 +42,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 
@@ -59,17 +57,21 @@ extern "C" {
  *  \brief The predefined log categories
  *
  *  By default the application category is enabled at the INFO level,
- *  and all other categories are enabled at the CRITICAL level.
+ *  the assert category is enabled at the WARN level, test is enabled
+ *  at the VERBOSE level and all other categories are enabled at the
+ *  CRITICAL level.
  */
 enum
 {
     SDL_LOG_CATEGORY_APPLICATION,
     SDL_LOG_CATEGORY_ERROR,
+    SDL_LOG_CATEGORY_ASSERT,
     SDL_LOG_CATEGORY_SYSTEM,
     SDL_LOG_CATEGORY_AUDIO,
     SDL_LOG_CATEGORY_VIDEO,
     SDL_LOG_CATEGORY_RENDER,
     SDL_LOG_CATEGORY_INPUT,
+    SDL_LOG_CATEGORY_TEST,
 
     /* Reserved for future SDL library use */
     SDL_LOG_CATEGORY_RESERVED1,
@@ -200,9 +202,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 37 - 13
ThirdParty/SDL/include/SDL_main.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 #ifndef _SDL_main_h
 #define _SDL_main_h
 
@@ -32,14 +30,36 @@
  *  Redefine main() on some platforms so that it is called by SDL.
  */
 
-#if defined(__IPHONEOS__) || defined(__ANDROID__)
 #ifndef SDL_MAIN_HANDLED
+#if defined(__WIN32__)
+/* On Windows SDL provides WinMain(), which parses the command line and passes
+   the arguments to your main function.
+
+   If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
+ */
+#define SDL_MAIN_AVAILABLE
+
+#elif defined(__IPHONEOS__)
+/* On iOS SDL provides a main function that creates an application delegate
+   and starts the iOS application run loop.
+
+   See src/video/uikit/SDL_uikitappdelegate.m for more details.
+ */
 #define SDL_MAIN_NEEDED
+
+#elif defined(__ANDROID__)
+/* On Android SDL provides a Java class in SDLActivity.java that is the
+   main activity entry point.
+
+   See README-android.txt for more details on extending that class.
+ */
+#define SDL_MAIN_NEEDED
+
 #endif
-#endif
+#endif /* SDL_MAIN_HANDLED */
 
 #ifdef __cplusplus
-#define C_LINKAGE	"C"
+#define C_LINKAGE   "C"
 #else
 #define C_LINKAGE
 #endif /* __cplusplus */
@@ -59,9 +79,8 @@
  *  \endcode
  */
 
-// Urho3D: commented out
-#ifdef SDL_MAIN_NEEDED
-#define main	SDL_main
+#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
+#define main    SDL_main
 #endif
 
 /**
@@ -72,11 +91,18 @@ extern C_LINKAGE int SDL_main(int argc, char *argv[]);
 
 #include "begin_code.h"
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
+/*
+ *  This is called by the real SDL main function to let the rest of the
+ *  library know that initialization was done properly.
+ *
+ *  Calling this yourself without knowing what you're doing can cause
+ *  crashes and hard to diagnose problems with your application.
+ */
+extern DECLSPEC void SDL_SetMainReady(void);
+
 #ifdef __WIN32__
 
 /**
@@ -90,9 +116,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
 
 
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 144 - 0
ThirdParty/SDL/include/SDL_messagebox.h

@@ -0,0 +1,144 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef _SDL_messagebox_h
+#define _SDL_messagebox_h
+
+#include "SDL_stdinc.h"
+#include "SDL_video.h"      /* For SDL_Window */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
+ */
+typedef enum
+{
+    SDL_MESSAGEBOX_ERROR        = 0x00000010,   /**< error dialog */
+    SDL_MESSAGEBOX_WARNING      = 0x00000020,   /**< warning dialog */
+    SDL_MESSAGEBOX_INFORMATION  = 0x00000040    /**< informational dialog */
+} SDL_MessageBoxFlags;
+
+/**
+ * \brief Flags for SDL_MessageBoxButtonData.
+ */
+typedef enum
+{
+    SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001,  /**< Marks the default button when return is hit */
+    SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002   /**< Marks the default button when escape is hit */
+} SDL_MessageBoxButtonFlags;
+
+/**
+ *  \brief Individual button data.
+ */
+typedef struct
+{
+    Uint32 flags;       /**< ::SDL_MessageBoxButtonFlags */
+    int buttonid;       /**< User defined button id (value returned via SDL_ShowMessageBox) */
+    const char * text;  /**< The UTF-8 button text */
+} SDL_MessageBoxButtonData;
+
+/**
+ * \brief RGB value used in a message box color scheme
+ */
+typedef struct
+{
+    Uint8 r, g, b;
+} SDL_MessageBoxColor;
+
+typedef enum
+{
+    SDL_MESSAGEBOX_COLOR_BACKGROUND,
+    SDL_MESSAGEBOX_COLOR_TEXT,
+    SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
+    SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
+    SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
+    SDL_MESSAGEBOX_COLOR_MAX
+} SDL_MessageBoxColorType;
+
+/**
+ * \brief A set of colors to use for message box dialogs
+ */
+typedef struct
+{
+    SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
+} SDL_MessageBoxColorScheme;
+
+/**
+ *  \brief MessageBox structure containing title, text, window, etc.
+ */
+typedef struct
+{
+    Uint32 flags;                       /**< ::SDL_MessageBoxFlags */
+    SDL_Window *window;                 /**< Parent window, can be NULL */
+    const char *title;                  /**< UTF-8 title */
+    const char *message;                /**< UTF-8 message text */
+
+    int numbuttons;
+    const SDL_MessageBoxButtonData *buttons;
+
+    const SDL_MessageBoxColorScheme *colorScheme;   /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
+} SDL_MessageBoxData;
+
+/**
+ *  \brief Create a modal message box.
+ *
+ *  \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
+ *  \param buttonid The pointer to which user id of hit button should be copied.
+ *
+ *  \return -1 on error, otherwise 0 and buttonid contains user id of button
+ *          hit or -1 if dialog was closed.
+ *
+ *  \note This function should be called on the thread that created the parent
+ *        window, or on the main thread if the messagebox has no parent.  It will
+ *        block execution of that thread until the user clicks a button or
+ *        closes the messagebox.
+ */
+extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+/**
+ *  \brief Create a simple modal message box
+ *
+ *  \param flags    ::SDL_MessageBoxFlags
+ *  \param title    UTF-8 title text
+ *  \param message  UTF-8 message text
+ *  \param window   The parent window, or NULL for no parent
+ *
+ *  \return 0 on success, -1 on error
+ *
+ *  \sa SDL_ShowMessageBox
+ */
+extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_messagebox_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 63 - 52
ThirdParty/SDL/include/SDL_mouse.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,24 +21,8 @@
 
 /**
  *  \file SDL_mouse.h
- *  
- *  Include file for SDL mouse event handling.
- *
- *  Please note that this ONLY discusses "mice" with the notion of the
- *  desktop GUI. You (usually) have one system cursor, and the OS hides
- *  the hardware details from you. If you plug in 10 mice, all ten move that
- *  one cursor. For many applications and games, this is perfect, and this
- *  API has served hundreds of SDL programs well since its birth.
- *
- *  It's not the whole picture, though. If you want more lowlevel control,
- *  SDL offers a different API, that gives you visibility into each input
- *  device, multi-touch interfaces, etc.
- *
- *  Those two APIs are incompatible, and you usually should not use both
- *  at the same time. But for legacy purposes, this API refers to a "mouse"
- *  when it actually means the system pointer and not a physical mouse.
  *
- *  The other API is in SDL_input.h
+ *  Include file for SDL mouse event handling.
  */
 
 #ifndef _SDL_mouse_h
@@ -51,13 +35,30 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
 
+/**
+ * \brief Cursor types for SDL_CreateSystemCursor.
+ */
+typedef enum
+{
+    SDL_SYSTEM_CURSOR_ARROW,     /**< Arrow */
+    SDL_SYSTEM_CURSOR_IBEAM,     /**< I-beam */
+    SDL_SYSTEM_CURSOR_WAIT,      /**< Wait */
+    SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
+    SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
+    SDL_SYSTEM_CURSOR_SIZENWSE,  /**< Double arrow pointing northwest and southeast */
+    SDL_SYSTEM_CURSOR_SIZENESW,  /**< Double arrow pointing northeast and southwest */
+    SDL_SYSTEM_CURSOR_SIZEWE,    /**< Double arrow pointing west and east */
+    SDL_SYSTEM_CURSOR_SIZENS,    /**< Double arrow pointing north and south */
+    SDL_SYSTEM_CURSOR_SIZEALL,   /**< Four pointed arrow pointing north, south, east, and west */
+    SDL_SYSTEM_CURSOR_NO,        /**< Slashed circle or crossbones */
+    SDL_SYSTEM_CURSOR_HAND,      /**< Hand */
+    SDL_NUM_SYSTEM_CURSORS
+} SDL_SystemCursor;
 
 /* Function prototypes */
 
@@ -68,13 +69,13 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
 
 /**
  *  \brief Retrieve the current state of the mouse.
- *  
+ *
  *  The current button state is returned as a button bitmask, which can
  *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
  *  mouse cursor position relative to the focus window for the currently
  *  selected mouse.  You can pass NULL for either x or y.
  */
-extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
+extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
 
 /**
  *  \brief Retrieve the relative state of the mouse.
@@ -83,15 +84,15 @@ extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
  *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
  *  mouse deltas since the last call to SDL_GetRelativeMouseState().
  */
-extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
+extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
 
 /**
  *  \brief Moves the mouse to the given position within the window.
- *  
+ *
  *  \param window The window to move the mouse into, or NULL for the current mouse focus
  *  \param x The x coordinate within the window
  *  \param y The y coordinate within the window
- *  
+ *
  *  \note This function generates a mouse motion event
  */
 extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
@@ -99,25 +100,25 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
 
 /**
  *  \brief Set relative mouse mode.
- *  
+ *
  *  \param enabled Whether or not to enable relative mode
  *
  *  \return 0 on success, or -1 if relative mode is not supported.
- *  
+ *
  *  While the mouse is in relative mode, the cursor is hidden, and the
  *  driver will try to report continuous motion in the current window.
  *  Only relative motion events will be delivered, the mouse position
  *  will not change.
- *  
+ *
  *  \note This function will flush any pending mouse motion.
- *  
+ *
  *  \sa SDL_GetRelativeMouseMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
 
 /**
  *  \brief Query whether relative mouse mode is enabled.
- *  
+ *
  *  \sa SDL_SetRelativeMouseMode()
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
@@ -125,19 +126,19 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
 /**
  *  \brief Create a cursor, using the specified bitmap data and
  *         mask (in MSB format).
- *  
+ *
  *  The cursor width must be a multiple of 8 bits.
- *  
+ *
  *  The cursor is created in black and white according to the following:
  *  <table>
  *  <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
  *  <tr><td>  0   </td><td>  1   </td><td> White </td></tr>
  *  <tr><td>  1   </td><td>  1   </td><td> Black </td></tr>
  *  <tr><td>  0   </td><td>  0   </td><td> Transparent </td></tr>
- *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black 
+ *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black
  *                                         if not. </td></tr>
  *  </table>
- *  
+ *
  *  \sa SDL_FreeCursor()
  */
 extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
@@ -147,13 +148,20 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
 
 /**
  *  \brief Create a color cursor.
- *  
+ *
  *  \sa SDL_FreeCursor()
  */
 extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
                                                           int hot_x,
                                                           int hot_y);
 
+/**
+ *  \brief Create a system cursor.
+ *
+ *  \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
+
 /**
  *  \brief Set the active cursor.
  */
@@ -164,19 +172,24 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
  */
 extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
 
+/**
+ *  \brief Return the default cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
+
 /**
  *  \brief Frees a cursor created with SDL_CreateCursor().
- *  
+ *
  *  \sa SDL_CreateCursor()
  */
 extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
 
 /**
  *  \brief Toggle whether or not the cursor is shown.
- *  
- *  \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current 
+ *
+ *  \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
  *                state.
- *  
+ *
  *  \return 1 if the cursor is shown, or 0 if the cursor is hidden.
  */
 extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
@@ -187,24 +200,22 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
  *   - Button 2:  Middle mouse button
  *   - Button 3:  Right mouse button
  */
-#define SDL_BUTTON(X)		(1 << ((X)-1))
-#define SDL_BUTTON_LEFT		1
-#define SDL_BUTTON_MIDDLE	2
-#define SDL_BUTTON_RIGHT	3
-#define SDL_BUTTON_X1		4
-#define SDL_BUTTON_X2		5
-#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
-#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
-#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
-#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
-#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2)
+#define SDL_BUTTON(X)       (1 << ((X)-1))
+#define SDL_BUTTON_LEFT     1
+#define SDL_BUTTON_MIDDLE   2
+#define SDL_BUTTON_RIGHT    3
+#define SDL_BUTTON_X1       4
+#define SDL_BUTTON_X2       5
+#define SDL_BUTTON_LMASK    SDL_BUTTON(SDL_BUTTON_LEFT)
+#define SDL_BUTTON_MMASK    SDL_BUTTON(SDL_BUTTON_MIDDLE)
+#define SDL_BUTTON_RMASK    SDL_BUTTON(SDL_BUTTON_RIGHT)
+#define SDL_BUTTON_X1MASK   SDL_BUTTON(SDL_BUTTON_X1)
+#define SDL_BUTTON_X2MASK   SDL_BUTTON(SDL_BUTTON_X2)
 
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 33 - 30
ThirdParty/SDL/include/SDL_mutex.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
 
 /**
  *  \file SDL_mutex.h
- *  
+ *
  *  Functions to provide thread synchronization primitives.
  */
 
@@ -34,21 +34,19 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  Synchronization functions which can time out return this value
  *  if they time out.
  */
-#define SDL_MUTEX_TIMEDOUT	1
+#define SDL_MUTEX_TIMEDOUT  1
 
 /**
  *  This is the timeout value which corresponds to never time out.
  */
-#define SDL_MUTEX_MAXWAIT	(~(Uint32)0)
+#define SDL_MUTEX_MAXWAIT   (~(Uint32)0)
 
 
 /**
@@ -67,24 +65,31 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
 
 /**
  *  Lock the mutex.
- *  
+ *
  *  \return 0, or -1 on error.
  */
-#define SDL_LockMutex(m)	SDL_mutexP(m)
-extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
+#define SDL_mutexP(m)   SDL_LockMutex(m)
+extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
+
+/**
+ *  Try to lock the mutex
+ *
+ *  \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
 
 /**
  *  Unlock the mutex.
- *  
+ *
  *  \return 0, or -1 on error.
- *  
+ *
  *  \warning It is an error to unlock a mutex that has not been locked by
  *           the current thread, and doing so results in undefined behavior.
  */
-#define SDL_UnlockMutex(m)	SDL_mutexV(m)
-extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex);
+#define SDL_mutexV(m)   SDL_UnlockMutex(m)
+extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
 
-/** 
+/**
  *  Destroy a mutex.
  */
 extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
@@ -112,34 +117,34 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
 extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
 
 /**
- *  This function suspends the calling thread until the semaphore pointed 
- *  to by \c sem has a positive count. It then atomically decreases the 
+ *  This function suspends the calling thread until the semaphore pointed
+ *  to by \c sem has a positive count. It then atomically decreases the
  *  semaphore count.
  */
 extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
 
 /**
  *  Non-blocking variant of SDL_SemWait().
- *  
- *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would 
+ *
+ *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
  *          block, and -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
 
 /**
  *  Variant of SDL_SemWait() with a timeout in milliseconds.
- *  
- *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not 
+ *
+ *  \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
  *          succeed in the allotted time, and -1 on error.
- *  
- *  \warning On some platforms this function is implemented by looping with a 
+ *
+ *  \warning On some platforms this function is implemented by looping with a
  *           delay of 1 ms, and so should be avoided if possible.
  */
 extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
 
 /**
  *  Atomically increases the semaphore's count (not blocking).
- *  
+ *
  *  \return 0, or -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
@@ -198,7 +203,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
 
 /**
  *  Restart one of the threads that are waiting on the condition variable.
- *  
+ *
  *  \return 0 or -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
@@ -212,11 +217,11 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
 
 /**
  *  Wait on the condition variable, unlocking the provided mutex.
- *  
+ *
  *  \warning The mutex must be locked before entering this function!
- *  
+ *
  *  The mutex is re-locked once the condition variable is signaled.
- *  
+ *
  *  \return 0 when it is signaled, or -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
@@ -226,7 +231,7 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
  *  variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
  *  signaled in the allotted time, and -1 on error.
  *
- *  \warning On some platforms this function is implemented by looping with a 
+ *  \warning On some platforms this function is implemented by looping with a
  *           delay of 1 ms, and so should be avoided if possible.
  */
 extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
@@ -237,9 +242,7 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 1 - 1
ThirdParty/SDL/include/SDL_name.h

@@ -6,6 +6,6 @@
 #define NeedFunctionPrototypes 1
 #endif
 
-#define SDL_NAME(X)	SDL_##X
+#define SDL_NAME(X) SDL_##X
 
 #endif /* _SDLname_h_ */

+ 10 - 16
ThirdParty/SDL/include/SDL_opengl.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_opengl.h
- *  
+ *
  *  This is a simple file to encapsulate the OpenGL API headers.
  */
 
@@ -40,10 +40,6 @@
 #include <windows.h>
 #endif
 
-#ifdef __HAIKU__  /* !!! FIXME: temp compiler warning fix... */
-#define NO_SDL_GLEXT 1
-#endif
-
 #ifdef __glext_h_
 /* Someone has already included glext.h */
 #define NO_SDL_GLEXT
@@ -63,23 +59,22 @@
 
 /**
  *  \file SDL_opengl.h
- *  
+ *
  *  This file is included because glext.h is not available on some systems.
  *  If you don't want this version included, simply define ::NO_SDL_GLEXT.
- *  
+ *
  *  The latest version is available from:
- *  	http://www.opengl.org/registry/
+ *      http://www.opengl.org/registry/
  */
 
 /**
  *  \def NO_SDL_GLEXT
- *  
- *  Define this if you have your own version of glext.h and want to disable the 
+ *
+ *  Define this if you have your own version of glext.h and want to disable the
  *  version included in SDL_opengl.h.
  */
 
 #if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
-/* *INDENT-OFF* */
 #ifndef __glext_h_
 #define __glext_h_
 
@@ -89,7 +84,7 @@ extern "C" {
 
 /*
 ** Copyright (c) 2007-2010 The Khronos Group Inc.
-** 
+**
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
 ** "Materials"), to deal in the Materials without restriction, including
@@ -97,10 +92,10 @@ extern "C" {
 ** distribute, sublicense, and/or sell copies of the Materials, and to
 ** permit persons to whom the Materials are furnished to do so, subject to
 ** the following conditions:
-** 
+**
 ** The above copyright notice and this permission notice shall be included
 ** in all copies or substantial portions of the Materials.
-** 
+**
 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -11122,7 +11117,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
 #endif
 
 #endif
-/* *INDENT-ON* */
 #endif /* NO_SDL_GLEXT */
 
 #endif /* !__IPHONEOS__ */

+ 2 - 2
ThirdParty/SDL/include/SDL_opengles.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_opengles.h
- *  
+ *
  *  This is a simple file to encapsulate the OpenGL ES 1.X API headers.
  */
 

+ 2 - 2
ThirdParty/SDL/include/SDL_opengles2.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_opengles.h
- *  
+ *
  *  This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
  */
 

+ 28 - 30
ThirdParty/SDL/include/SDL_pixels.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_pixels.h
- *  
+ *
  *  Header for the enumerated pixel format definitions.
  */
 
@@ -31,14 +31,12 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \name Transparency definitions
- *  
+ *
  *  These define alpha as the opacity of a surface.
  */
 /*@{*/
@@ -114,13 +112,14 @@ enum
 #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
 
 #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
-    ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
+    ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
      ((bits) << 8) | ((bytes) << 0))
 
-#define SDL_PIXELTYPE(X)	(((X) >> 24) & 0x0F)
-#define SDL_PIXELORDER(X)	(((X) >> 20) & 0x0F)
-#define SDL_PIXELLAYOUT(X)	(((X) >> 16) & 0x0F)
-#define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
+#define SDL_PIXELFLAG(X)    (((X) >> 28) & 0x0F)
+#define SDL_PIXELTYPE(X)    (((X) >> 24) & 0x0F)
+#define SDL_PIXELORDER(X)   (((X) >> 20) & 0x0F)
+#define SDL_PIXELLAYOUT(X)  (((X) >> 16) & 0x0F)
+#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
 #define SDL_BYTESPERPIXEL(X) \
     (SDL_ISPIXELFORMAT_FOURCC(X) ? \
         ((((X) == SDL_PIXELFORMAT_YUY2) || \
@@ -140,8 +139,9 @@ enum
       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
 
+/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
 #define SDL_ISPIXELFORMAT_FOURCC(format)    \
-    ((format) && !((format) & 0x80000000))
+    ((format) && (SDL_PIXELFLAG(format) != 1))
 
 /* Note: If you modify this list, update SDL_GetPixelFormatName() */
 enum
@@ -254,7 +254,7 @@ typedef struct SDL_Color
     Uint8 r;
     Uint8 g;
     Uint8 b;
-    Uint8 unused;
+    Uint8 a;
 } SDL_Color;
 #define SDL_Colour SDL_Color
 
@@ -299,9 +299,9 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
 
 /**
  *  \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
- *  
+ *
  *  \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
- *  
+ *
  *  \sa SDL_MasksToPixelFormatEnum()
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
@@ -313,10 +313,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
 
 /**
  *  \brief Convert a bpp and RGBA masks to an enumerated pixel format.
- *  
- *  \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion 
+ *
+ *  \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
  *          wasn't possible.
- *  
+ *
  *  \sa SDL_PixelFormatEnumToMasks()
  */
 extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
@@ -336,13 +336,13 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
 extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
 
 /**
- *  \brief Create a palette structure with the specified number of color 
+ *  \brief Create a palette structure with the specified number of color
  *         entries.
- *  
+ *
  *  \return A new palette, or NULL if there wasn't enough memory.
- *  
+ *
  *  \note The palette entries are initialized to white.
- *  
+ *
  *  \sa SDL_FreePalette()
  */
 extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
@@ -355,12 +355,12 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
 
 /**
  *  \brief Set a range of colors in a palette.
- *  
+ *
  *  \param palette    The palette to modify.
  *  \param colors     An array of colors to copy into the palette.
  *  \param firstcolor The index of the first palette entry to modify.
  *  \param ncolors    The number of entries to modify.
- *  
+ *
  *  \return 0 on success, or -1 if not all of the colors could be set.
  */
 extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
@@ -369,14 +369,14 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
 
 /**
  *  \brief Free a palette created with SDL_AllocPalette().
- *  
+ *
  *  \sa SDL_AllocPalette()
  */
 extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
 
 /**
  *  \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
- *  
+ *
  *  \sa SDL_MapRGBA
  */
 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
@@ -384,7 +384,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
 
 /**
  *  \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
- *  
+ *
  *  \sa SDL_MapRGB
  */
 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
@@ -393,7 +393,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
 
 /**
  *  \brief Get the RGB components from a pixel of the specified format.
- *  
+ *
  *  \sa SDL_GetRGBA
  */
 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
@@ -402,7 +402,7 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
 
 /**
  *  \brief Get the RGBA components from a pixel of the specified format.
- *  
+ *
  *  \sa SDL_GetRGB
  */
 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
@@ -418,9 +418,7 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 23 - 29
ThirdParty/SDL/include/SDL_platform.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_platform.h
- *  
+ *
  *  Try to get a standard set of platform defines.
  */
 
@@ -30,39 +30,39 @@
 
 #if defined(_AIX)
 #undef __AIX__
-#define __AIX__		1
+#define __AIX__     1
 #endif
 #if defined(__BEOS__)
 #undef __BEOS__
-#define __BEOS__	1
+#define __BEOS__    1
 #endif
 #if defined(__HAIKU__)
 #undef __HAIKU__
-#define __HAIKU__	1
+#define __HAIKU__   1
 #endif
 #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
 #undef __BSDI__
-#define __BSDI__	1
+#define __BSDI__    1
 #endif
 #if defined(_arch_dreamcast)
 #undef __DREAMCAST__
-#define __DREAMCAST__	1
+#define __DREAMCAST__   1
 #endif
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
 #undef __FREEBSD__
-#define __FREEBSD__	1
+#define __FREEBSD__ 1
 #endif
 #if defined(hpux) || defined(__hpux) || defined(__hpux__)
 #undef __HPUX__
-#define __HPUX__	1
+#define __HPUX__    1
 #endif
 #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
 #undef __IRIX__
-#define __IRIX__	1
+#define __IRIX__    1
 #endif
 #if defined(linux) || defined(__linux) || defined(__linux__)
 #undef __LINUX__
-#define __LINUX__	1
+#define __LINUX__   1
 #endif
 #if defined(ANDROID)
 #undef __ANDROID__
@@ -82,55 +82,51 @@
 #else
 /* if not compiling for iPhone */
 #undef __MACOSX__
-#define __MACOSX__	1
+#define __MACOSX__  1
 #endif /* TARGET_OS_IPHONE */
 #endif /* defined(__APPLE__) */
 
 #if defined(__NetBSD__)
 #undef __NETBSD__
-#define __NETBSD__	1
+#define __NETBSD__  1
 #endif
 #if defined(__OpenBSD__)
 #undef __OPENBSD__
-#define __OPENBSD__	1
+#define __OPENBSD__ 1
 #endif
 #if defined(__OS2__)
 #undef __OS2__
-#define __OS2__		1
+#define __OS2__     1
 #endif
 #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
 #undef __OSF__
-#define __OSF__		1
+#define __OSF__     1
 #endif
 #if defined(__QNXNTO__)
 #undef __QNXNTO__
-#define __QNXNTO__	1
+#define __QNXNTO__  1
 #endif
 #if defined(riscos) || defined(__riscos) || defined(__riscos__)
 #undef __RISCOS__
-#define __RISCOS__	1
+#define __RISCOS__  1
 #endif
 #if defined(__SVR4)
 #undef __SOLARIS__
-#define __SOLARIS__	1
+#define __SOLARIS__ 1
 #endif
 #if defined(WIN32) || defined(_WIN32)
 #undef __WIN32__
-#define __WIN32__	1
+#define __WIN32__   1
 #endif
-
-#if defined(__NDS__)
-#undef __NINTENDODS__
-#define __NINTENDODS__	1
+#if defined(__PSP__)
+#undef __PSP__
+#define __PSP__ 1
 #endif
 
-
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -140,9 +136,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 5 - 9
ThirdParty/SDL/include/SDL_power.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
 
 /**
  *  \file SDL_power.h
- *  
+ *
  *  Header for the SDL power management routines.
  */
 
@@ -33,9 +33,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -53,24 +51,22 @@ typedef enum
 
 /**
  *  \brief Get the current power supply details.
- *  
+ *
  *  \param secs Seconds of battery life left. You can pass a NULL here if
  *              you don't care. Will return -1 if we can't determine a
  *              value, or we're not running on a battery.
- *  
+ *
  *  \param pct Percentage of battery life left, between 0 and 100. You can
  *             pass a NULL here if you don't care. Will return -1 if we
  *             can't determine a value, or we're not running on a battery.
- *  
+ *
  *  \return The state of the battery (if any).
  */
 extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 5 - 5
ThirdParty/SDL/include/SDL_quit.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_quit.h
- *  
+ *
  *  Include file for SDL quit event handling.
  */
 
@@ -33,11 +33,11 @@
 
 /**
  *  \file SDL_quit.h
- *  
+ *
  *  An ::SDL_QUIT event is generated when the user tries to close the application
  *  window.  If it is ignored or filtered out, the window will remain open.
  *  If it is not ignored or filtered, it is queued normally and the window
- *  is allowed to close.  When the window is closed, screen updates will 
+ *  is allowed to close.  When the window is closed, screen updates will
  *  complete, but have no effect.
  *
  *  SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
@@ -46,7 +46,7 @@
  *  to determine the cause of an ::SDL_QUIT event, but setting a signal
  *  handler in your application will override the default generation of
  *  quit events for that signal.
- *  
+ *
  *  \sa SDL_Quit()
  */
 

+ 15 - 14
ThirdParty/SDL/include/SDL_rect.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_rect.h
- *  
+ *
  *  Header file for SDL_rect definition and management functions.
  */
 
@@ -36,9 +36,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -54,7 +52,7 @@ typedef struct
 
 /**
  *  \brief A rectangle, with the origin at the upper left.
- *  
+ *
  *  \sa SDL_RectEmpty
  *  \sa SDL_RectEquals
  *  \sa SDL_HasIntersection
@@ -71,18 +69,23 @@ typedef struct SDL_Rect
 /**
  *  \brief Returns true if the rectangle has no area.
  */
-#define SDL_RectEmpty(X)    ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0))
+SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
+{
+    return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
+}
 
 /**
  *  \brief Returns true if the two rectangles are equal.
  */
-#define SDL_RectEquals(A, B)   (((A)) && ((B)) && \
-                                ((A)->x == (B)->x) && ((A)->y == (B)->y) && \
-                                ((A)->w == (B)->w) && ((A)->h == (B)->h))
+SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
+{
+    return (a && b && (a->x == b->x) && (a->y == b->y) &&
+            (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
+}
 
 /**
  *  \brief Determine whether two rectangles intersect.
- *  
+ *
  *  \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
@@ -90,7 +93,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
 
 /**
  *  \brief Calculate the intersection of two rectangles.
- *  
+ *
  *  \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
@@ -116,7 +119,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
 
 /**
  *  \brief Calculate the intersection of a rectangle and line segment.
- *  
+ *
  *  \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
@@ -126,9 +129,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 300 - 112
ThirdParty/SDL/include/SDL_render.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_render.h
- *  
+ *
  *  Header file for SDL 2D rendering functions.
  *
  *  This API supports the following features:
@@ -52,9 +52,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
@@ -62,10 +60,10 @@ extern "C" {
  */
 typedef enum
 {
-    SDL_RENDERER_SOFTWARE = 0x00000001,         /**< The renderer is a software fallback */ 
-    SDL_RENDERER_ACCELERATED = 0x00000002,      /**< The renderer uses hardware 
+    SDL_RENDERER_SOFTWARE = 0x00000001,         /**< The renderer is a software fallback */
+    SDL_RENDERER_ACCELERATED = 0x00000002,      /**< The renderer uses hardware
                                                      acceleration */
-    SDL_RENDERER_PRESENTVSYNC = 0x00000004,     /**< Present is synchronized 
+    SDL_RENDERER_PRESENTVSYNC = 0x00000004,     /**< Present is synchronized
                                                      with the refresh rate */
     SDL_RENDERER_TARGETTEXTURE = 0x00000008     /**< The renderer supports
                                                      rendering to texture */
@@ -104,6 +102,16 @@ typedef enum
     SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
 } SDL_TextureModulate;
 
+/**
+ *  \brief Flip constants for SDL_RenderCopyEx
+ */
+typedef enum
+{
+    SDL_FLIP_NONE = 0x00000000,     /**< Do not flip */
+    SDL_FLIP_HORIZONTAL = 0x00000001,    /**< flip horizontally */
+    SDL_FLIP_VERTICAL = 0x00000002     /**< flip vertically */
+} SDL_RendererFlip;
+
 /**
  *  \brief A structure representing rendering state
  */
@@ -120,28 +128,28 @@ typedef struct SDL_Texture SDL_Texture;
 /* Function prototypes */
 
 /**
- *  \brief Get the number of 2D rendering drivers available for the current 
+ *  \brief Get the number of 2D rendering drivers available for the current
  *         display.
- *  
+ *
  *  A render driver is a set of code that handles rendering and texture
  *  management on a particular display.  Normally there is only one, but
  *  some drivers may have several available with different capabilities.
- *  
+ *
  *  \sa SDL_GetRenderDriverInfo()
  *  \sa SDL_CreateRenderer()
  */
 extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
 
 /**
- *  \brief Get information about a specific 2D rendering driver for the current 
+ *  \brief Get information about a specific 2D rendering driver for the current
  *         display.
- *  
+ *
  *  \param index The index of the driver to query information about.
- *  \param info  A pointer to an SDL_RendererInfo struct to be filled with 
+ *  \param info  A pointer to an SDL_RendererInfo struct to be filled with
  *               information on the rendering driver.
- *  
+ *
  *  \return 0 on success, -1 if the index was out of range.
- *  
+ *
  *  \sa SDL_CreateRenderer()
  */
 extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
@@ -165,14 +173,14 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
 
 /**
  *  \brief Create a 2D rendering context for a window.
- *  
+ *
  *  \param window The window where rendering is displayed.
- *  \param index    The index of the rendering driver to initialize, or -1 to 
+ *  \param index    The index of the rendering driver to initialize, or -1 to
  *                  initialize the first one supporting the requested flags.
  *  \param flags    ::SDL_RendererFlags.
- *  
+ *
  *  \return A valid rendering context or NULL if there was an error.
- *  
+ *
  *  \sa SDL_CreateSoftwareRenderer()
  *  \sa SDL_GetRendererInfo()
  *  \sa SDL_DestroyRenderer()
@@ -182,11 +190,11 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
 
 /**
  *  \brief Create a 2D software rendering context for a surface.
- *  
+ *
  *  \param surface The surface where rendering is done.
- *  
+ *
  *  \return A valid rendering context or NULL if there was an error.
- *  
+ *
  *  \sa SDL_CreateRenderer()
  *  \sa SDL_DestroyRenderer()
  */
@@ -203,18 +211,25 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
                                                 SDL_RendererInfo * info);
 
+/**
+ *  \brief Get the output size of a rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
+                                                      int *w, int *h);
+
 /**
  *  \brief Create a texture for a rendering context.
- *  
+ *
+ *  \param renderer The renderer.
  *  \param format The format of the texture.
  *  \param access One of the enumerated values in ::SDL_TextureAccess.
  *  \param w      The width of the texture in pixels.
  *  \param h      The height of the texture in pixels.
- *  
- *  \return The created texture is returned, or 0 if no rendering context was 
+ *
+ *  \return The created texture is returned, or 0 if no rendering context was
  *          active,  the format was unsupported, or the width or height were out
  *          of range.
- *  
+ *
  *  \sa SDL_QueryTexture()
  *  \sa SDL_UpdateTexture()
  *  \sa SDL_DestroyTexture()
@@ -226,13 +241,14 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
 
 /**
  *  \brief Create a texture from an existing surface.
- *  
+ *
+ *  \param renderer The renderer.
  *  \param surface The surface containing pixel data used to fill the texture.
- *  
+ *
  *  \return The created texture is returned, or 0 on error.
- *  
+ *
  *  \note The surface is not modified or freed by this function.
- *  
+ *
  *  \sa SDL_QueryTexture()
  *  \sa SDL_DestroyTexture()
  */
@@ -240,15 +256,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
 
 /**
  *  \brief Query the attributes of a texture
- *  
+ *
  *  \param texture A texture to be queried.
- *  \param format  A pointer filled in with the raw format of the texture.  The 
- *                 actual format may differ, but pixel transfers will use this 
+ *  \param format  A pointer filled in with the raw format of the texture.  The
+ *                 actual format may differ, but pixel transfers will use this
  *                 format.
  *  \param access  A pointer filled in with the actual access to the texture.
  *  \param w       A pointer filled in with the width of the texture in pixels.
  *  \param h       A pointer filled in with the height of the texture in pixels.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
  */
 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
@@ -257,15 +273,15 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
 
 /**
  *  \brief Set an additional color value used in render copy operations.
- *  
+ *
  *  \param texture The texture to update.
  *  \param r       The red color value multiplied into copy operations.
  *  \param g       The green color value multiplied into copy operations.
  *  \param b       The blue color value multiplied into copy operations.
- *  
- *  \return 0 on success, or -1 if the texture is not valid or color modulation 
+ *
+ *  \return 0 on success, or -1 if the texture is not valid or color modulation
  *          is not supported.
- *  
+ *
  *  \sa SDL_GetTextureColorMod()
  */
 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
@@ -274,14 +290,14 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
 
 /**
  *  \brief Get the additional color value used in render copy operations.
- *  
+ *
  *  \param texture The texture to query.
  *  \param r         A pointer filled in with the current red color value.
  *  \param g         A pointer filled in with the current green color value.
  *  \param b         A pointer filled in with the current blue color value.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
- *  
+ *
  *  \sa SDL_SetTextureColorMod()
  */
 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
@@ -290,13 +306,13 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
 
 /**
  *  \brief Set an additional alpha value used in render copy operations.
- *  
+ *
  *  \param texture The texture to update.
  *  \param alpha     The alpha value multiplied into copy operations.
- *  
- *  \return 0 on success, or -1 if the texture is not valid or alpha modulation 
+ *
+ *  \return 0 on success, or -1 if the texture is not valid or alpha modulation
  *          is not supported.
- *  
+ *
  *  \sa SDL_GetTextureAlphaMod()
  */
 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
@@ -304,12 +320,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
 
 /**
  *  \brief Get the additional alpha value used in render copy operations.
- *  
+ *
  *  \param texture The texture to query.
  *  \param alpha     A pointer filled in with the current alpha value.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
- *  
+ *
  *  \sa SDL_SetTextureAlphaMod()
  */
 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
@@ -317,16 +333,16 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
 
 /**
  *  \brief Set the blend mode used for texture copy operations.
- *  
+ *
  *  \param texture The texture to update.
  *  \param blendMode ::SDL_BlendMode to use for texture blending.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid or the blend mode is
  *          not supported.
- *  
+ *
  *  \note If the blend mode is not supported, the closest supported mode is
  *        chosen.
- *  
+ *
  *  \sa SDL_GetTextureBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
@@ -334,12 +350,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
 
 /**
  *  \brief Get the blend mode used for texture copy operations.
- *  
+ *
  *  \param texture   The texture to query.
  *  \param blendMode A pointer filled in with the current blend mode.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
- *  
+ *
  *  \sa SDL_SetTextureBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
@@ -347,15 +363,15 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
 
 /**
  *  \brief Update the given texture rectangle with new pixel data.
- *  
+ *
  *  \param texture   The texture to update
- *  \param rect      A pointer to the rectangle of pixels to update, or NULL to 
+ *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
  *                   update the entire texture.
  *  \param pixels    The raw pixel data.
  *  \param pitch     The number of bytes between rows of pixel data.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
- *  
+ *
  *  \note This is a fairly slow function.
  */
 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
@@ -363,18 +379,18 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
                                               const void *pixels, int pitch);
 
 /**
- *  \brief Lock a portion of the texture for pixel access.
- *  
- *  \param texture   The texture to lock for access, which was created with 
+ *  \brief Lock a portion of the texture for write-only pixel access.
+ *
+ *  \param texture   The texture to lock for access, which was created with
  *                   ::SDL_TEXTUREACCESS_STREAMING.
- *  \param rect      A pointer to the rectangle to lock for access. If the rect 
+ *  \param rect      A pointer to the rectangle to lock for access. If the rect
  *                   is NULL, the entire texture will be locked.
- *  \param pixels    This is filled in with a pointer to the locked pixels, 
+ *  \param pixels    This is filled in with a pointer to the locked pixels,
  *                   appropriately offset by the locked area.
  *  \param pitch     This is filled in with the pitch of the locked pixels.
- *  
+ *
  *  \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
- *  
+ *
  *  \sa SDL_UnlockTexture()
  */
 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
@@ -383,7 +399,7 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
 
 /**
  *  \brief Unlock a texture, uploading the changes to video memory, if needed.
- *  
+ *
  *  \sa SDL_LockTexture()
  */
 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
@@ -400,41 +416,156 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *rendere
 /**
  * \brief Set a texture as the current rendering target.
  *
+ * \param renderer The renderer.
  * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
  *
  * \return 0 on success, or -1 on error
+ *
+ *  \sa SDL_GetRenderTarget()
  */
 extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
                                                 SDL_Texture *texture);
 
+/**
+ * \brief Get the current render target or NULL for the default render target.
+ *
+ * \return The current render target
+ *
+ *  \sa SDL_SetRenderTarget()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
+
+/**
+ *  \brief Set device independent resolution for rendering
+ *
+ *  \param renderer The renderer for which resolution should be set.
+ *  \param w      The width of the logical resolution
+ *  \param h      The height of the logical resolution
+ *
+ *  This function uses the viewport and scaling functionality to allow a fixed logical
+ *  resolution for rendering, regardless of the actual output resolution.  If the actual
+ *  output resolution doesn't have the same aspect ratio the output rendering will be
+ *  centered within the output display.
+ *
+ *  If the output display is a window, mouse events in the window will be filtered
+ *  and scaled so they seem to arrive within the logical resolution.
+ *
+ *  \note If this function results in scaling or subpixel drawing by the
+ *        rendering backend, it will be handled using the appropriate
+ *        quality hints.
+ *
+ *  \sa SDL_RenderGetLogicalSize()
+ *  \sa SDL_RenderSetScale()
+ *  \sa SDL_RenderSetViewport()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
+
+/**
+ *  \brief Get device independent resolution for rendering
+ *
+ *  \param renderer The renderer from which resolution should be queried.
+ *  \param w      A pointer filled with the width of the logical resolution
+ *  \param h      A pointer filled with the height of the logical resolution
+ *
+ *  \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
+
 /**
  *  \brief Set the drawing area for rendering on the current target.
  *
+ *  \param renderer The renderer for which the drawing area should be set.
  *  \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
  *
  *  The x,y of the viewport rect represents the origin for rendering.
  *
- *  \note When the window is resized, the current viewport is automatically
- *        centered within the new window size.
+ *  \return 0 on success, or -1 on error
+ *
+ *  \note If the window associated with the renderer is resized, the viewport is automatically reset.
+ *
+ *  \sa SDL_RenderGetViewport()
+ *  \sa SDL_RenderSetLogicalSize()
  */
 extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
                                                   const SDL_Rect * rect);
 
 /**
  *  \brief Get the drawing area for the current target.
+ *
+ *  \sa SDL_RenderSetViewport()
  */
 extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
                                                    SDL_Rect * rect);
 
+/**
+ *  \brief Set the clip rectangle for the current target.
+ *
+ *  \param renderer The renderer for which clip rectangle should be set.
+ *  \param rect   A pointer to the rectangle to set as the clip rectangle, or
+ *                NULL to disable clipping.
+ *
+ *  \return 0 on success, or -1 on error
+ *
+ *  \sa SDL_RenderGetClipRect()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
+                                                  const SDL_Rect * rect);
+
+/**
+ *  \brief Get the clip rectangle for the current target.
+ *
+ *  \param renderer The renderer from which clip rectangle should be queried.
+ *  \param rect   A pointer filled in with the current clip rectangle, or
+ *                an empty rectangle if clipping is disabled.
+ *
+ *  \sa SDL_RenderSetClipRect()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
+                                                   SDL_Rect * rect);
+
+/**
+ *  \brief Set the drawing scale for rendering on the current target.
+ *
+ *  \param renderer The renderer for which the drawing scale should be set.
+ *  \param scaleX The horizontal scaling factor
+ *  \param scaleY The vertical scaling factor
+ *
+ *  The drawing coordinates are scaled by the x/y scaling factors
+ *  before they are used by the renderer.  This allows resolution
+ *  independent drawing with a single coordinate system.
+ *
+ *  \note If this results in scaling or subpixel drawing by the
+ *        rendering backend, it will be handled using the appropriate
+ *        quality hints.  For best results use integer scaling factors.
+ *
+ *  \sa SDL_RenderGetScale()
+ *  \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
+                                               float scaleX, float scaleY);
+
+/**
+ *  \brief Get the drawing scale for the current target.
+ *
+ *  \param renderer The renderer from which drawing scale should be queried.
+ *  \param scaleX A pointer filled in with the horizontal scaling factor
+ *  \param scaleY A pointer filled in with the vertical scaling factor
+ *
+ *  \sa SDL_RenderSetScale()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
+                                               float *scaleX, float *scaleY);
+
 /**
  *  \brief Set the color used for drawing operations (Rect, Line and Clear).
- *  
+ *
+ *  \param renderer The renderer for which drawing color should be set.
  *  \param r The red value used to draw on the rendering target.
  *  \param g The green value used to draw on the rendering target.
  *  \param b The blue value used to draw on the rendering target.
- *  \param a The alpha value used to draw on the rendering target, usually 
+ *  \param a The alpha value used to draw on the rendering target, usually
  *           ::SDL_ALPHA_OPAQUE (255).
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
@@ -443,13 +574,14 @@ extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
 
 /**
  *  \brief Get the color used for drawing operations (Rect, Line and Clear).
- *  
+ *
+ *  \param renderer The renderer from which drawing color should be queried.
  *  \param r A pointer to the red value used to draw on the rendering target.
  *  \param g A pointer to the green value used to draw on the rendering target.
  *  \param b A pointer to the blue value used to draw on the rendering target.
- *  \param a A pointer to the alpha value used to draw on the rendering target, 
+ *  \param a A pointer to the alpha value used to draw on the rendering target,
  *           usually ::SDL_ALPHA_OPAQUE (255).
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
@@ -458,14 +590,15 @@ extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
 
 /**
  *  \brief Set the blend mode used for drawing operations (Fill and Line).
- *  
+ *
+ *  \param renderer The renderer for which blend mode should be set.
  *  \param blendMode ::SDL_BlendMode to use for blending.
- *  
+ *
  *  \return 0 on success, or -1 on error
- *  
- *  \note If the blend mode is not supported, the closest supported mode is 
+ *
+ *  \note If the blend mode is not supported, the closest supported mode is
  *        chosen.
- *  
+ *
  *  \sa SDL_GetRenderDrawBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
@@ -473,11 +606,12 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
 
 /**
  *  \brief Get the blend mode used for drawing operations.
- *  
+ *
+ *  \param renderer The renderer from which blend mode should be queried.
  *  \param blendMode A pointer filled in with the current blend mode.
- *  
+ *
  *  \return 0 on success, or -1 on error
- *  
+ *
  *  \sa SDL_SetRenderDrawBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
@@ -487,15 +621,18 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
  *  \brief Clear the current rendering target with the drawing color
  *
  *  This function clears the entire rendering target, ignoring the viewport.
+ *
+ *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
 
 /**
  *  \brief Draw a point on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw a point.
  *  \param x The x coordinate of the point.
  *  \param y The y coordinate of the point.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
@@ -503,10 +640,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
 
 /**
  *  \brief Draw multiple points on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw multiple points.
  *  \param points The points to draw
  *  \param count The number of points to draw
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
@@ -515,12 +653,13 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
 
 /**
  *  \brief Draw a line on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw a line.
  *  \param x1 The x coordinate of the start point.
  *  \param y1 The y coordinate of the start point.
  *  \param x2 The x coordinate of the end point.
  *  \param y2 The y coordinate of the end point.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
@@ -528,10 +667,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
 
 /**
  *  \brief Draw a series of connected lines on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw multiple lines.
  *  \param points The points along the lines
  *  \param count The number of points, drawing count-1 lines
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
@@ -540,9 +680,10 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
 
 /**
  *  \brief Draw a rectangle on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw a rectangle.
  *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
@@ -550,10 +691,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
 
 /**
  *  \brief Draw some number of rectangles on the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should draw multiple rectangles.
  *  \param rects A pointer to an array of destination rectangles.
  *  \param count The number of rectangles.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
@@ -562,10 +704,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
 
 /**
  *  \brief Fill a rectangle on the current rendering target with the drawing color.
- *  
- *  \param rect A pointer to the destination rectangle, or NULL for the entire 
+ *
+ *  \param renderer The renderer which should fill a rectangle.
+ *  \param rect A pointer to the destination rectangle, or NULL for the entire
  *              rendering target.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
@@ -573,10 +716,11 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
 
 /**
  *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
- *  
+ *
+ *  \param renderer The renderer which should fill multiple rectangles.
  *  \param rects A pointer to an array of destination rectangles.
  *  \param count The number of rectangles.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
@@ -585,13 +729,14 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
 
 /**
  *  \brief Copy a portion of the texture to the current rendering target.
- *  
+ *
+ *  \param renderer The renderer which should copy parts of a texture.
  *  \param texture The source texture.
- *  \param srcrect   A pointer to the source rectangle, or NULL for the entire 
+ *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
  *                   texture.
- *  \param dstrect   A pointer to the destination rectangle, or NULL for the 
+ *  \param dstrect   A pointer to the destination rectangle, or NULL for the
  *                   entire rendering target.
- *  
+ *
  *  \return 0 on success, or -1 on error
  */
 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
@@ -599,19 +744,42 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
                                            const SDL_Rect * srcrect,
                                            const SDL_Rect * dstrect);
 
+/**
+ *  \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ *  \param renderer The renderer which should copy parts of a texture.
+ *  \param texture The source texture.
+ *  \param srcrect   A pointer to the source rectangle, or NULL for the entire
+ *                   texture.
+ *  \param dstrect   A pointer to the destination rectangle, or NULL for the
+ *                   entire rendering target.
+ *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect
+ *  \param center   A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
+ *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ *  \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
+                                           SDL_Texture * texture,
+                                           const SDL_Rect * srcrect,
+                                           const SDL_Rect * dstrect,
+                                           const double angle,
+                                           const SDL_Point *center,
+                                           const SDL_RendererFlip flip);
 
 /**
  *  \brief Read pixels from the current rendering target.
- *  
- *  \param rect   A pointer to the rectangle to read, or NULL for the entire 
+ *
+ *  \param renderer The renderer from which pixels should be read.
+ *  \param rect   A pointer to the rectangle to read, or NULL for the entire
  *                render target.
  *  \param format The desired format of the pixel data, or 0 to use the format
  *                of the rendering target
  *  \param pixels A pointer to be filled in with the pixel data
  *  \param pitch  The pitch of the pixels parameter.
- *  
+ *
  *  \return 0 on success, or -1 if pixel reading is not supported.
- *  
+ *
  *  \warning This is a very slow operation, and should not be used frequently.
  */
 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
@@ -626,7 +794,7 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
 
 /**
  *  \brief Destroy the specified texture.
- *  
+ *
  *  \sa SDL_CreateTexture()
  *  \sa SDL_CreateTextureFromSurface()
  */
@@ -635,17 +803,37 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
 /**
  *  \brief Destroy the rendering context for a window and free associated
  *         textures.
- *  
+ *
  *  \sa SDL_CreateRenderer()
  */
 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
 
 
+/**
+ *  \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
+ *         OpenGL instructions.
+ *
+ *  \param texture  The SDL texture to bind
+ *  \param texw     A pointer to a float that will be filled with the texture width
+ *  \param texh     A pointer to a float that will be filled with the texture height
+ *
+ *  \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
+
+/**
+ *  \brief Unbind a texture from the current OpenGL/ES/ES2 context.
+ *
+ *  \param texture  The SDL texture to unbind
+ *
+ *  \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+
+
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 48 - 32
ThirdParty/SDL/include/SDL_rwops.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_rwops.h
- *  
+ *
  *  This file provides a general interface for SDL to read and write
  *  data streams.  It can easily be extended to files, memory, etc.
  */
@@ -35,46 +35,57 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
+/* RWops Types */
+#define SDL_RWOPS_UNKNOWN   0   /* Unknown stream type */
+#define SDL_RWOPS_WINFILE   1   /* Win32 file */
+#define SDL_RWOPS_STDFILE   2   /* Stdio file */
+#define SDL_RWOPS_JNIFILE   3   /* Android asset */
+#define SDL_RWOPS_MEMORY    4   /* Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5   /* Read-Only memory stream */
+
 /**
  * This is the read/write operation structure -- very basic.
  */
 typedef struct SDL_RWops
 {
+    /**
+     *  Return the size of the file in this rwops, or -1 if unknown
+     */
+    Sint64 (SDLCALL * size) (struct SDL_RWops * context);
+
     /**
      *  Seek to \c offset relative to \c whence, one of stdio's whence values:
      *  RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
-     *  
-     *  \return the final offset in the data stream.
+     *
+     *  \return the final offset in the data stream, or -1 on error.
      */
-    long (SDLCALL * seek) (struct SDL_RWops * context, long offset,
-                           int whence);
+    Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
+                             int whence);
 
     /**
      *  Read up to \c maxnum objects each of size \c size from the data
      *  stream to the area pointed at by \c ptr.
-     *  
+     *
      *  \return the number of objects read, or 0 at error or end of file.
      */
-    size_t(SDLCALL * read) (struct SDL_RWops * context, void *ptr,
-                            size_t size, size_t maxnum);
+    size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
+                             size_t size, size_t maxnum);
 
     /**
      *  Write exactly \c num objects each of size \c size from the area
      *  pointed at by \c ptr to data stream.
-     *  
+     *
      *  \return the number of objects written, or 0 at error or end of file.
      */
-    size_t(SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
-                             size_t size, size_t num);
+    size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
+                              size_t size, size_t num);
 
     /**
      *  Close and free an allocated SDL_RWops structure.
-     *  
+     *
      *  \return 0 if successful or -1 on write error when flushing data.
      */
     int (SDLCALL * close) (struct SDL_RWops * context);
@@ -89,8 +100,11 @@ typedef struct SDL_RWops
             void *inputStreamRef;
             void *readableByteChannelRef;
             void *readMethod;
+            void *assetFileDescriptorRef;
             long position;
-            int size;
+            long size;
+            long offset;
+            int fd;
         } androidio;
 #elif defined(__WIN32__)
         struct
@@ -122,6 +136,7 @@ typedef struct SDL_RWops
         struct
         {
             void *data1;
+            void *data2;
         } unknown;
     } hidden;
 
@@ -130,7 +145,7 @@ typedef struct SDL_RWops
 
 /**
  *  \name RWFrom functions
- *  
+ *
  *  Functions to create SDL_RWops structures from various data streams.
  */
 /*@{*/
@@ -156,30 +171,32 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
 extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
 extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
 
-#define RW_SEEK_SET	0       /**< Seek from the beginning of data */
-#define RW_SEEK_CUR	1       /**< Seek relative to current read point */
-#define RW_SEEK_END	2       /**< Seek relative to the end of data */
+#define RW_SEEK_SET 0       /**< Seek from the beginning of data */
+#define RW_SEEK_CUR 1       /**< Seek relative to current read point */
+#define RW_SEEK_END 2       /**< Seek relative to the end of data */
 
 /**
  *  \name Read/write macros
- *  
+ *
  *  Macros to easily read and write from an SDL_RWops structure.
  */
 /*@{*/
-#define SDL_RWseek(ctx, offset, whence)	(ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx)			(ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n)	(ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n)	(ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx)		(ctx)->close(ctx)
+#define SDL_RWsize(ctx)         (ctx)->size(ctx)
+#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
+#define SDL_RWtell(ctx)         (ctx)->seek(ctx, 0, RW_SEEK_CUR)
+#define SDL_RWread(ctx, ptr, size, n)   (ctx)->read(ctx, ptr, size, n)
+#define SDL_RWwrite(ctx, ptr, size, n)  (ctx)->write(ctx, ptr, size, n)
+#define SDL_RWclose(ctx)        (ctx)->close(ctx)
 /*@}*//*Read/write macros*/
 
 
-/** 
+/**
  *  \name Read endian functions
- *  
+ *
  *  Read an item of the specified endianness and return in native format.
  */
 /*@{*/
+extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
 extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
 extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
 extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
@@ -188,12 +205,13 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
 extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
 /*@}*//*Read endian functions*/
 
-/** 
+/**
  *  \name Write endian functions
- *  
+ *
  *  Write an item of native format to the specified endianness.
  */
 /*@{*/
+extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
 extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
 extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
 extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
@@ -205,9 +223,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 60 - 57
ThirdParty/SDL/include/SDL_scancode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_scancode.h
- *  
+ *
  *  Defines keyboard scancodes.
  */
 
@@ -32,21 +32,21 @@
 
 /**
  *  \brief The SDL keyboard scancode representation.
- *  
+ *
  *  Values of this type are used to represent keyboard keys, among other places
  *  in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
  *  SDL_Event structure.
- *  
+ *
  *  The values in this enumeration are based on the USB usage page standard:
- *  http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
+ *  http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
  */
 typedef enum
 {
     SDL_SCANCODE_UNKNOWN = 0,
 
-    /** 
+    /**
      *  \name Usage page 0x07
-     *  
+     *
      *  These values are from usage page 0x07 (USB keyboard page).
      */
     /*@{*/
@@ -99,49 +99,49 @@ typedef enum
     SDL_SCANCODE_EQUALS = 46,
     SDL_SCANCODE_LEFTBRACKET = 47,
     SDL_SCANCODE_RIGHTBRACKET = 48,
-    SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return 
-                                  *   key on ISO keyboards and at the right end 
-                                  *   of the QWERTY row on ANSI keyboards. 
-                                  *   Produces REVERSE SOLIDUS (backslash) and 
-                                  *   VERTICAL LINE in a US layout, REVERSE 
-                                  *   SOLIDUS and VERTICAL LINE in a UK Mac 
-                                  *   layout, NUMBER SIGN and TILDE in a UK 
+    SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
+                                  *   key on ISO keyboards and at the right end
+                                  *   of the QWERTY row on ANSI keyboards.
+                                  *   Produces REVERSE SOLIDUS (backslash) and
+                                  *   VERTICAL LINE in a US layout, REVERSE
+                                  *   SOLIDUS and VERTICAL LINE in a UK Mac
+                                  *   layout, NUMBER SIGN and TILDE in a UK
                                   *   Windows layout, DOLLAR SIGN and POUND SIGN
-                                  *   in a Swiss German layout, NUMBER SIGN and 
-                                  *   APOSTROPHE in a German layout, GRAVE 
-                                  *   ACCENT and POUND SIGN in a French Mac 
-                                  *   layout, and ASTERISK and MICRO SIGN in a 
+                                  *   in a Swiss German layout, NUMBER SIGN and
+                                  *   APOSTROPHE in a German layout, GRAVE
+                                  *   ACCENT and POUND SIGN in a French Mac
+                                  *   layout, and ASTERISK and MICRO SIGN in a
                                   *   French Windows layout.
                                   */
-    SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code 
-                                  *   instead of 49 for the same key, but all 
-                                  *   OSes I've seen treat the two codes 
+    SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
+                                  *   instead of 49 for the same key, but all
+                                  *   OSes I've seen treat the two codes
                                   *   identically. So, as an implementor, unless
-                                  *   your keyboard generates both of those 
+                                  *   your keyboard generates both of those
                                   *   codes and your OS treats them differently,
                                   *   you should generate SDL_SCANCODE_BACKSLASH
-                                  *   instead of this code. As a user, you 
-                                  *   should not rely on this code because SDL 
-                                  *   will never generate it with most (all?) 
-                                  *   keyboards. 
+                                  *   instead of this code. As a user, you
+                                  *   should not rely on this code because SDL
+                                  *   will never generate it with most (all?)
+                                  *   keyboards.
                                   */
     SDL_SCANCODE_SEMICOLON = 51,
     SDL_SCANCODE_APOSTROPHE = 52,
-    SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI 
-                              *   and ISO keyboards). Produces GRAVE ACCENT and 
-                              *   TILDE in a US Windows layout and in US and UK 
-                              *   Mac layouts on ANSI keyboards, GRAVE ACCENT 
-                              *   and NOT SIGN in a UK Windows layout, SECTION 
-                              *   SIGN and PLUS-MINUS SIGN in US and UK Mac 
-                              *   layouts on ISO keyboards, SECTION SIGN and 
-                              *   DEGREE SIGN in a Swiss German layout (Mac: 
-                              *   only on ISO keyboards), CIRCUMFLEX ACCENT and 
-                              *   DEGREE SIGN in a German layout (Mac: only on 
+    SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
+                              *   and ISO keyboards). Produces GRAVE ACCENT and
+                              *   TILDE in a US Windows layout and in US and UK
+                              *   Mac layouts on ANSI keyboards, GRAVE ACCENT
+                              *   and NOT SIGN in a UK Windows layout, SECTION
+                              *   SIGN and PLUS-MINUS SIGN in US and UK Mac
+                              *   layouts on ISO keyboards, SECTION SIGN and
+                              *   DEGREE SIGN in a Swiss German layout (Mac:
+                              *   only on ISO keyboards), CIRCUMFLEX ACCENT and
+                              *   DEGREE SIGN in a German layout (Mac: only on
                               *   ISO keyboards), SUPERSCRIPT TWO and TILDE in a
-                              *   French Windows layout, COMMERCIAL AT and 
-                              *   NUMBER SIGN in a French Mac layout on ISO 
+                              *   French Windows layout, COMMERCIAL AT and
+                              *   NUMBER SIGN in a French Mac layout on ISO
                               *   keyboards, and LESS-THAN SIGN and GREATER-THAN
-                              *   SIGN in a Swiss German, German, or French Mac 
+                              *   SIGN in a Swiss German, German, or French Mac
                               *   layout on ANSI keyboards.
                               */
     SDL_SCANCODE_COMMA = 54,
@@ -178,7 +178,7 @@ typedef enum
     SDL_SCANCODE_DOWN = 81,
     SDL_SCANCODE_UP = 82,
 
-    SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards 
+    SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
                                      */
     SDL_SCANCODE_KP_DIVIDE = 84,
     SDL_SCANCODE_KP_MULTIPLY = 85,
@@ -197,19 +197,19 @@ typedef enum
     SDL_SCANCODE_KP_0 = 98,
     SDL_SCANCODE_KP_PERIOD = 99,
 
-    SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO 
-                                        *   keyboards have over ANSI ones, 
-                                        *   located between left shift and Y. 
+    SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
+                                        *   keyboards have over ANSI ones,
+                                        *   located between left shift and Y.
                                         *   Produces GRAVE ACCENT and TILDE in a
                                         *   US or UK Mac layout, REVERSE SOLIDUS
-                                        *   (backslash) and VERTICAL LINE in a 
-                                        *   US or UK Windows layout, and 
+                                        *   (backslash) and VERTICAL LINE in a
+                                        *   US or UK Windows layout, and
                                         *   LESS-THAN SIGN and GREATER-THAN SIGN
                                         *   in a Swiss German, German, or French
                                         *   layout. */
     SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
-    SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, 
-                               *   not a physical key - but some Mac keyboards 
+    SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
+                               *   not a physical key - but some Mac keyboards
                                *   do have a power key. */
     SDL_SCANCODE_KP_EQUALS = 103,
     SDL_SCANCODE_F13 = 104,
@@ -245,7 +245,7 @@ typedef enum
     SDL_SCANCODE_KP_COMMA = 133,
     SDL_SCANCODE_KP_EQUALSAS400 = 134,
 
-    SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see 
+    SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
                                             footnotes in USB doc */
     SDL_SCANCODE_INTERNATIONAL2 = 136,
     SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
@@ -334,16 +334,16 @@ typedef enum
     SDL_SCANCODE_RALT = 230, /**< alt gr, option */
     SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
 
-    SDL_SCANCODE_MODE = 257,    /**< I'm not sure if this is really not covered 
-                                 *   by any of the above, but since there's a 
+    SDL_SCANCODE_MODE = 257,    /**< I'm not sure if this is really not covered
+                                 *   by any of the above, but since there's a
                                  *   special KMOD_MODE for it I'm adding it here
                                  */
-    
+
     /*@}*//*Usage page 0x07*/
 
     /**
      *  \name Usage page 0x0C
-     *  
+     *
      *  These values are mapped from usage page 0x0C (USB consumer page).
      */
     /*@{*/
@@ -365,31 +365,34 @@ typedef enum
     SDL_SCANCODE_AC_STOP = 272,
     SDL_SCANCODE_AC_REFRESH = 273,
     SDL_SCANCODE_AC_BOOKMARKS = 274,
-    
+
     /*@}*//*Usage page 0x0C*/
 
     /**
      *  \name Walther keys
-     *  
+     *
      *  These are values that Christian Walther added (for mac keyboard?).
      */
     /*@{*/
 
     SDL_SCANCODE_BRIGHTNESSDOWN = 275,
     SDL_SCANCODE_BRIGHTNESSUP = 276,
-    SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display 
+    SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
                                            switch, video mode switch */
     SDL_SCANCODE_KBDILLUMTOGGLE = 278,
     SDL_SCANCODE_KBDILLUMDOWN = 279,
     SDL_SCANCODE_KBDILLUMUP = 280,
     SDL_SCANCODE_EJECT = 281,
     SDL_SCANCODE_SLEEP = 282,
-    
+
+    SDL_SCANCODE_APP1 = 283,
+    SDL_SCANCODE_APP2 = 284,
+
     /*@}*//*Walther keys*/
 
     /* Add any other keys here. */
 
-    SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes 
+    SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
                                  for array bounds */
 } SDL_Scancode;
 

+ 24 - 28
ThirdParty/SDL/include/SDL_shape.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -31,9 +31,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /** \file SDL_shape.h
@@ -47,28 +45,28 @@ extern "C" {
 
 /**
  *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
- *  
+ *
  *  \param title The title of the window, in UTF-8 encoding.
- *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
  *               ::SDL_WINDOWPOS_UNDEFINED.
- *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  *               ::SDL_WINDOWPOS_UNDEFINED.
  *  \param w     The width of the window.
  *  \param h     The height of the window.
- *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: 
+ *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
  *               ::SDL_WINDOW_OPENGL,     ::SDL_WINDOW_INPUT_GRABBED,
  *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_RESIZABLE,
  *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
- *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
- *  
+ *       ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
+ *
  *  \return The window created, or NULL if window creation failed.
- *  
+ *
  *  \sa SDL_DestroyWindow()
  */
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
 
 /**
- * \brief Return whether the given window is a shaped window. 
+ * \brief Return whether the given window is a shaped window.
  *
  * \param window The window to query for being shaped.
  *
@@ -79,31 +77,31 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
 
 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
 typedef enum {
-	/** \brief The default mode, a binarized alpha cutoff of 1. */
-	ShapeModeDefault,
-	/** \brief A binarized alpha cutoff with a given integer value. */
-	ShapeModeBinarizeAlpha,
-	/** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
-	ShapeModeReverseBinarizeAlpha,
-	/** \brief A color key is applied. */
-	ShapeModeColorKey
+    /** \brief The default mode, a binarized alpha cutoff of 1. */
+    ShapeModeDefault,
+    /** \brief A binarized alpha cutoff with a given integer value. */
+    ShapeModeBinarizeAlpha,
+    /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
+    ShapeModeReverseBinarizeAlpha,
+    /** \brief A color key is applied. */
+    ShapeModeColorKey
 } WindowShapeMode;
 
 #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
 
 /** \brief A union containing parameters for shaped windows. */
 typedef union {
-	/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
-	Uint8 binarizationCutoff;
-	SDL_Color colorKey;
+    /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+    Uint8 binarizationCutoff;
+    SDL_Color colorKey;
 } SDL_WindowShapeParams;
 
 /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
 typedef struct SDL_WindowShapeMode {
-	/** \brief The mode of these window-shape parameters. */
-	WindowShapeMode mode;
-	/** \brief Window-shape parameters. */
-	SDL_WindowShapeParams parameters;
+    /** \brief The mode of these window-shape parameters. */
+    WindowShapeMode mode;
+    /** \brief Window-shape parameters. */
+    SDL_WindowShapeParams parameters;
 } SDL_WindowShapeMode;
 
 /**
@@ -138,9 +136,7 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 423 - 350
ThirdParty/SDL/include/SDL_stdinc.h


+ 87 - 84
ThirdParty/SDL/include/SDL_surface.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,8 +21,8 @@
 
 /**
  *  \file SDL_surface.h
- *  
- *  Header file for ::SDL_surface definition and management functions.
+ *
+ *  Header file for ::SDL_Surface definition and management functions.
  */
 
 #ifndef _SDL_surface_h
@@ -37,16 +37,14 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \name Surface flags
- *  
- *  These are the currently supported flags for the ::SDL_surface.
- *  
+ *
+ *  These are the currently supported flags for the ::SDL_Surface.
+ *
  *  \internal
  *  Used internally (read-only).
  */
@@ -60,7 +58,7 @@ extern "C" {
 /**
  *  Evaluates to true if the surface needs to be locked before access.
  */
-#define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
+#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
 
 /**
  * \brief A collection of pixels used in software blitting.
@@ -101,14 +99,21 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
 
 /**
  *  Allocate and free an RGB surface.
- *  
+ *
  *  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  *  If the depth is greater than 8 bits, the pixel format is set using the
  *  flags '[RGB]mask'.
- *  
+ *
  *  If the function runs out of memory, it will return NULL.
- *  
+ *
  *  \param flags The \c flags are obsolete and should be set to 0.
+ *  \param width The width in pixels of the surface to create.
+ *  \param height The height in pixels of the surface to create.
+ *  \param depth The depth in bits of the surface to create.
+ *  \param Rmask The red mask of the surface to create.
+ *  \param Gmask The green mask of the surface to create.
+ *  \param Bmask The blue mask of the surface to create.
+ *  \param Amask The alpha mask of the surface to create.
  */
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
     (Uint32 flags, int width, int height, int depth,
@@ -126,9 +131,9 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
 
 /**
  *  \brief Set the palette used by a surface.
- *  
+ *
  *  \return 0, or -1 if the surface format doesn't use a palette.
- *  
+ *
  *  \note A single palette can be shared with many surfaces.
  */
 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
@@ -136,21 +141,21 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
 
 /**
  *  \brief Sets up a surface for directly accessing the pixels.
- *  
+ *
  *  Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
- *  to and read from \c surface->pixels, using the pixel format stored in 
- *  \c surface->format.  Once you are done accessing the surface, you should 
+ *  to and read from \c surface->pixels, using the pixel format stored in
+ *  \c surface->format.  Once you are done accessing the surface, you should
  *  use SDL_UnlockSurface() to release it.
- *  
+ *
  *  Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
  *  to 0, then you can read and write to the surface at any time, and the
  *  pixel format of the surface will not change.
- *  
+ *
  *  No operating system or library calls should be made between lock/unlock
  *  pairs, as critical system locks may be held during this time.
- *  
+ *
  *  SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
- *  
+ *
  *  \sa SDL_UnlockSurface()
  */
 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
@@ -159,11 +164,11 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
 
 /**
  *  Load a surface from a seekable SDL data stream (memory or file).
- *  
+ *
  *  If \c freesrc is non-zero, the stream will be closed after being read.
- *  
+ *
  *  The new surface should be freed with SDL_FreeSurface().
- *  
+ *
  *  \return the new surface, or NULL if there was an error.
  */
 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
@@ -171,34 +176,34 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
 
 /**
  *  Load a surface from a file.
- *  
+ *
  *  Convenience macro.
  */
-#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
+#define SDL_LoadBMP(file)   SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
 
 /**
  *  Save a surface to a seekable SDL data stream (memory or file).
- *  
+ *
  *  If \c freedst is non-zero, the stream will be closed after being written.
- *  
+ *
  *  \return 0 if successful or -1 if there was an error.
  */
 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
     (SDL_Surface * surface, SDL_RWops * dst, int freedst);
 
-/** 
+/**
  *  Save a surface to a file.
- *  
+ *
  *  Convenience macro.
  */
 #define SDL_SaveBMP(surface, file) \
-		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
+        SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
 
 /**
  *  \brief Sets the RLE acceleration hint for a surface.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid
- *  
+ *
  *  \note If RLE is enabled, colorkey and alpha blending blits are much faster,
  *        but the surface must be locked before directly accessing the pixels.
  */
@@ -207,11 +212,11 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
 
 /**
  *  \brief Sets the color key (transparent pixel) in a blittable surface.
- *  
+ *
  *  \param surface The surface to update
  *  \param flag Non-zero to enable colorkey and 0 to disable colorkey
  *  \param key The transparent pixel in the native surface format
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid
  *
  *  You can pass SDL_RLEACCEL to enable RLE accelerated blits.
@@ -221,12 +226,12 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
 
 /**
  *  \brief Gets the color key (transparent pixel) in a blittable surface.
- *  
+ *
  *  \param surface The surface to update
- *  \param key A pointer filled in with the transparent pixel in the native 
+ *  \param key A pointer filled in with the transparent pixel in the native
  *             surface format
- *  
- *  \return 0 on success, or -1 if the surface is not valid or colorkey is not 
+ *
+ *  \return 0 on success, or -1 if the surface is not valid or colorkey is not
  *          enabled.
  */
 extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
@@ -234,14 +239,14 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
 
 /**
  *  \brief Set an additional color value used in blit operations.
- *  
+ *
  *  \param surface The surface to update.
  *  \param r The red color value multiplied into blit operations.
  *  \param g The green color value multiplied into blit operations.
  *  \param b The blue color value multiplied into blit operations.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid.
- *  
+ *
  *  \sa SDL_GetSurfaceColorMod()
  */
 extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
@@ -250,14 +255,14 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
 
 /**
  *  \brief Get the additional color value used in blit operations.
- *  
+ *
  *  \param surface The surface to query.
  *  \param r A pointer filled in with the current red color value.
  *  \param g A pointer filled in with the current green color value.
  *  \param b A pointer filled in with the current blue color value.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid.
- *  
+ *
  *  \sa SDL_SetSurfaceColorMod()
  */
 extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
@@ -266,12 +271,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
 
 /**
  *  \brief Set an additional alpha value used in blit operations.
- *  
+ *
  *  \param surface The surface to update.
  *  \param alpha The alpha value multiplied into blit operations.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid.
- *  
+ *
  *  \sa SDL_GetSurfaceAlphaMod()
  */
 extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
@@ -279,12 +284,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
 
 /**
  *  \brief Get the additional alpha value used in blit operations.
- *  
+ *
  *  \param surface The surface to query.
  *  \param alpha A pointer filled in with the current alpha value.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid.
- *  
+ *
  *  \sa SDL_SetSurfaceAlphaMod()
  */
 extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
@@ -292,12 +297,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
 
 /**
  *  \brief Set the blend mode used for blit operations.
- *  
+ *
  *  \param surface The surface to update.
  *  \param blendMode ::SDL_BlendMode to use for blit blending.
- *  
+ *
  *  \return 0 on success, or -1 if the parameters are not valid.
- *  
+ *
  *  \sa SDL_GetSurfaceBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
@@ -305,12 +310,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
 
 /**
  *  \brief Get the blend mode used for blit operations.
- *  
+ *
  *  \param surface   The surface to query.
  *  \param blendMode A pointer filled in with the current blend mode.
- *  
+ *
  *  \return 0 on success, or -1 if the surface is not valid.
- *  
+ *
  *  \sa SDL_SetSurfaceBlendMode()
  */
 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
@@ -318,14 +323,14 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
 
 /**
  *  Sets the clipping rectangle for the destination surface in a blit.
- *  
+ *
  *  If the clip rectangle is NULL, clipping will be disabled.
- *  
+ *
  *  If the clip rectangle doesn't intersect the surface, the function will
  *  return SDL_FALSE and blits will be completely clipped.  Otherwise the
  *  function returns SDL_TRUE and blits to the surface will be clipped to
  *  the intersection of the surface area and the clipping rectangle.
- *  
+ *
  *  Note that blits are automatically clipped to the edges of the source
  *  and destination surfaces.
  */
@@ -334,7 +339,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
 
 /**
  *  Gets the clipping rectangle for the destination surface in a blit.
- *  
+ *
  *  \c rect must be a pointer to a valid rectangle which will be filled
  *  with the correct values.
  */
@@ -342,11 +347,11 @@ extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
                                              SDL_Rect * rect);
 
 /**
- *  Creates a new surface of the specified format, and then copies and maps 
- *  the given surface to it so the blit of the converted surface will be as 
+ *  Creates a new surface of the specified format, and then copies and maps
+ *  the given surface to it so the blit of the converted surface will be as
  *  fast as possible.  If this function fails, it returns NULL.
- *  
- *  The \c flags parameter is passed to SDL_CreateRGBSurface() and has those 
+ *
+ *  The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
  *  semantics.  You can also pass ::SDL_RLEACCEL in the flags parameter and
  *  SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  *  surface.
@@ -358,7 +363,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
 
 /**
  * \brief Copy a block of pixels of one format to another format
- *  
+ *
  *  \return 0 on success, or -1 if there was an error
  */
 extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
@@ -369,12 +374,12 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
 
 /**
  *  Performs a fast fill of the given rectangle with \c color.
- *  
+ *
  *  If \c rect is NULL, the whole surface will be filled with \c color.
- *  
- *  The color should be a pixel of the format used by the surface, and 
+ *
+ *  The color should be a pixel of the format used by the surface, and
  *  can be generated by the SDL_MapRGB() function.
- *  
+ *
  *  \return 0 on success, or -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_FillRect
@@ -384,12 +389,12 @@ extern DECLSPEC int SDLCALL SDL_FillRects
 
 /**
  *  Performs a fast blit from the source surface to the destination surface.
- *  
+ *
  *  This assumes that the source and destination rectangles are
  *  the same size.  If either \c srcrect or \c dstrect are NULL, the entire
  *  surface (\c src or \c dst) is copied.  The final blit rectangles are saved
  *  in \c srcrect and \c dstrect after all clipping is performed.
- *  
+ *
  *  \return If the blit is successful, it returns 0, otherwise it returns -1.
  *
  *  The blit function should not be called on a locked surface.
@@ -404,9 +409,9 @@ extern DECLSPEC int SDLCALL SDL_FillRects
       SDL_SRCALPHA not set:
         copy RGB.
         if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        RGB values of the source colour key, ignoring alpha in the
+        RGB values of the source color key, ignoring alpha in the
         comparison.
-   
+
     RGB->RGBA:
       SDL_SRCALPHA set:
         alpha-blend (using the source per-surface alpha value);
@@ -415,8 +420,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
         copy RGB, set destination alpha to source per-surface alpha value.
       both:
         if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        source colour key.
-   
+        source color key.
+
     RGBA->RGBA:
       SDL_SRCALPHA set:
         alpha-blend (using the source alpha channel) the RGB values;
@@ -425,19 +430,19 @@ extern DECLSPEC int SDLCALL SDL_FillRects
       SDL_SRCALPHA not set:
         copy all of RGBA to the destination.
         if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        RGB values of the source colour key, ignoring alpha in the
+        RGB values of the source color key, ignoring alpha in the
        comparison.
-   
-    RGB->RGB: 
+
+    RGB->RGB:
       SDL_SRCALPHA set:
         alpha-blend (using the source per-surface alpha value).
       SDL_SRCALPHA not set:
         copy RGB.
       both:
         if SDL_SRCCOLORKEY set, only copy the pixels matching the
-        source colour key.
+        source color key.
     \endverbatim
- *  
+ *
  *  You should call SDL_BlitSurface() unless you know exactly how SDL
  *  blitting works internally and how to use the other blit functions.
  */
@@ -462,7 +467,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
 /**
  *  \brief Perform a fast, low quality, stretch blit between two surfaces of the
  *         same pixel format.
- *  
+ *
  *  \note This function uses a static buffer, and is not thread-safe.
  */
 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
@@ -491,9 +496,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 105 - 0
ThirdParty/SDL/include/SDL_system.h

@@ -0,0 +1,105 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_system.h
+ *
+ *  Include file for platform specific SDL API functions
+ */
+
+#ifndef _SDL_system_h
+#define _SDL_system_h
+
+#include "SDL_stdinc.h"
+
+#if defined(__IPHONEOS__) && __IPHONEOS__
+#include "SDL_video.h"
+#include "SDL_keyboard.h"
+#endif
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Platform specific functions for iOS */
+#if defined(__IPHONEOS__) && __IPHONEOS__
+
+extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
+
+#endif /* __IPHONEOS__ */
+
+
+/* Platform specific functions for Android */
+#if defined(__ANDROID__) && __ANDROID__
+
+/* Get the JNI environment for the current thread
+   This returns JNIEnv*, but the prototype is void* so we don't need jni.h
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+
+/* Get the SDL Activity object for the application
+   This returns jobject, but the prototype is void* so we don't need jni.h
+   The jobject returned by SDL_AndroidGetActivity is a local reference.
+   It is the caller's responsibility to properly release it
+   (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+
+/* See the official Android developer guide for more information:
+   http://developer.android.com/guide/topics/data/data-storage.html
+*/
+#define SDL_ANDROID_EXTERNAL_STORAGE_READ   0x01
+#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE  0x02
+
+/* Get the path used for internal storage for this application.
+   This path is unique to your application and cannot be written to
+   by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+
+/* Get the current state of external storage, a bitmask of these values:
+    SDL_ANDROID_EXTERNAL_STORAGE_READ
+    SDL_ANDROID_EXTERNAL_STORAGE_WRITE
+   If external storage is currently unavailable, this will return 0.
+*/
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+
+/* Get the path used for external storage for this application.
+   This path is unique to your application, but is public and can be
+   written to by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+
+#endif /* __ANDROID__ */
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_system_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 9 - 13
ThirdParty/SDL/include/SDL_syswm.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_syswm.h
- *  
+ *
  *  Include file for SDL custom system window manager hooks.
  */
 
@@ -36,14 +36,12 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \file SDL_syswm.h
- *  
+ *
  *  Your application has access to a special type of event ::SDL_SYSWMEVENT,
  *  which contains window-manager specific information and arrives whenever
  *  an unhandled window event occurs.  This event is ignored by default, but
@@ -95,7 +93,7 @@ typedef struct _UIWindow UIWindow;
 #endif
 #endif
 
-/** 
+/**
  *  These are the various supported windowing subsystems
  */
 typedef enum
@@ -209,14 +207,14 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
 /* Function prototypes */
 /**
  *  \brief This function allows access to driver-dependent window information.
- *  
+ *
  *  \param window The window about which information is being requested
- *  \param info This structure must be initialized with the SDL version, and is 
+ *  \param info This structure must be initialized with the SDL version, and is
  *              then filled in with information about the given window.
- *  
- *  \return SDL_TRUE if the function is implemented and the version member of 
+ *
+ *  \return SDL_TRUE if the function is implemented and the version member of
  *          the \c info struct is valid, SDL_FALSE otherwise.
- *  
+ *
  *  You typically use this function like this:
  *  \code
  *  SDL_SysWMinfo info;
@@ -230,9 +228,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 68 - 0
ThirdParty/SDL/include/SDL_test.h

@@ -0,0 +1,68 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef _SDL_test_h
+#define _SDL_test_h
+
+#include "SDL.h"
+#include "SDL_test_common.h"
+#include "SDL_test_font.h"
+#include "SDL_test_random.h"
+#include "SDL_test_fuzzer.h"
+#include "SDL_test_crc32.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_log.h"
+#include "SDL_test_assert.h"
+#include "SDL_test_harness.h"
+#include "SDL_test_images.h"
+#include "SDL_test_compare.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Global definitions */
+
+/*
+ * Note: Maximum size of SDLTest log message is less than SDLs limit
+ * to ensure we can fit additional information such as the timestamp.
+ */
+#define SDLTEST_MAX_LOGMESSAGE_LENGTH   3584
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 105 - 0
ThirdParty/SDL/include/SDL_test_assert.h

@@ -0,0 +1,105 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_assert.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ * Assert API for test code and test cases
+ *
+ */
+
+#ifndef _SDL_test_assert_h
+#define _SDL_test_assert_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Fails the assert.
+ */
+#define ASSERT_FAIL     0
+
+/**
+ * \brief Passes the assert.
+ */
+#define ASSERT_PASS     1
+
+/**
+ * \brief Assert that logs and break execution flow on failures.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_Assert(int assertCondition, const char *assertDescription, ...);
+
+/**
+ * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ *
+ * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
+ */
+int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...);
+
+/**
+ * \brief Explicitely pass without checking an assertion condition. Updates assertion counter.
+ *
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_AssertPass(const char *assertDescription, ...);
+
+/**
+ * \brief Resets the assert summary counters to zero.
+ */
+void SDLTest_ResetAssertSummary();
+
+/**
+ * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
+ */
+void SDLTest_LogAssertSummary();
+
+
+/**
+ * \brief Converts the current assert summary state to a test result.
+ *
+ * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
+ */
+int SDLTest_AssertSummaryToTestResult();
+
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_assert_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 186 - 0
ThirdParty/SDL/include/SDL_test_common.h

@@ -0,0 +1,186 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_common.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/* Ported from original test\common.h file. */
+
+#ifndef _SDL_test_common_h
+#define _SDL_test_common_h
+
+#include "SDL.h"
+
+#if defined(__PSP__)
+#define DEFAULT_WINDOW_WIDTH  480
+#define DEFAULT_WINDOW_HEIGHT 272
+#else
+#define DEFAULT_WINDOW_WIDTH  640
+#define DEFAULT_WINDOW_HEIGHT 480
+#endif
+
+#define VERBOSE_VIDEO   0x00000001
+#define VERBOSE_MODES   0x00000002
+#define VERBOSE_RENDER  0x00000004
+#define VERBOSE_EVENT   0x00000008
+#define VERBOSE_AUDIO   0x00000010
+
+typedef struct
+{
+    /* SDL init flags */
+    char **argv;
+    Uint32 flags;
+    Uint32 verbose;
+
+    /* Video info */
+    const char *videodriver;
+    int display;
+    const char *window_title;
+    const char *window_icon;
+    Uint32 window_flags;
+    int window_x;
+    int window_y;
+    int window_w;
+    int window_h;
+    int window_minW;
+    int window_minH;
+    int window_maxW;
+    int window_maxH;
+    int logical_w;
+    int logical_h;
+    float scale;
+    int depth;
+    int refresh_rate;
+    int num_windows;
+    SDL_Window **windows;
+
+    /* Renderer info */
+    const char *renderdriver;
+    Uint32 render_flags;
+    SDL_bool skip_renderer;
+    SDL_Renderer **renderers;
+
+    /* Audio info */
+    const char *audiodriver;
+    SDL_AudioSpec audiospec;
+
+    /* GL settings */
+    int gl_red_size;
+    int gl_green_size;
+    int gl_blue_size;
+    int gl_alpha_size;
+    int gl_buffer_size;
+    int gl_depth_size;
+    int gl_stencil_size;
+    int gl_double_buffer;
+    int gl_accum_red_size;
+    int gl_accum_green_size;
+    int gl_accum_blue_size;
+    int gl_accum_alpha_size;
+    int gl_stereo;
+    int gl_multisamplebuffers;
+    int gl_multisamplesamples;
+    int gl_retained_backing;
+    int gl_accelerated;
+    int gl_major_version;
+    int gl_minor_version;
+    int gl_debug;
+} SDLTest_CommonState;
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ * \brief Parse command line parameters and create common state.
+ *
+ * \param argv Array of command line parameters
+ * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
+ *
+ * \returns Returns a newly allocated common state object.
+ */
+SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
+
+/**
+ * \brief Process one common argument.
+ *
+ * \param state The common state describing the test window to create.
+ * \param index The index of the argument to process in argv[].
+ *
+ * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
+ */
+int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
+
+/**
+ * \brief Returns common usage information
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns String with usage information
+ */
+const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
+
+/**
+ * \brief Open test window.
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns True if initialization succeeded, false otherwise
+ */
+SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
+
+/**
+ * \brief Common event handler for test windows.
+ *
+ * \param state The common state used to create test window.
+ * \param event The event to handle.
+ * \param done Flag indicating we are done.
+ *
+ */
+void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
+
+/**
+ * \brief Close test window.
+ *
+ * \param state The common state used to create test window.
+ *
+ */
+void SDLTest_CommonQuit(SDLTest_CommonState * state);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_common_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 69 - 0
ThirdParty/SDL/include/SDL_test_compare.h

@@ -0,0 +1,69 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_compare.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines comparison functions (i.e. for surfaces).
+
+*/
+
+#ifndef _SDL_test_compare_h
+#define _SDL_test_compare_h
+
+#include "SDL.h"
+
+#include "SDL_test_images.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Compares a surface and with reference image data for equality
+ *
+ * \param surface Surface used in comparison
+ * \param referenceSurface Test Surface used in comparison
+ * \param allowable_error Allowable difference (squared) in blending accuracy.
+ *
+ * \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
+ */
+int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_compare_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 124 - 0
ThirdParty/SDL/include/SDL_test_crc32.h

@@ -0,0 +1,124 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_crc32.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
+
+*/
+
+#ifndef _SDL_test_crc32_h
+#define _SDL_test_crc32_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ------------ Definitions --------- */
+
+/* Definition shared by all CRC routines */
+
+#ifndef CrcUint32
+ #define CrcUint32  unsigned int
+#endif
+#ifndef CrcUint8
+ #define CrcUint8   unsigned char
+#endif
+
+#ifdef ORIGINAL_METHOD
+ #define CRC32_POLY 0x04c11db7   /* AUTODIN II, Ethernet, & FDDI */
+#else
+ #define CRC32_POLY 0xEDB88320   /* Perl String::CRC32 compatible */
+#endif
+
+/**
+ * Data structure for CRC32 (checksum) computation
+ */
+  typedef struct {
+    CrcUint32    crc32_table[256]; /* CRC table */
+  } SDLTest_Crc32Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * /brief Initialize the CRC context
+ *
+ * Note: The function initializes the crc table required for all crc calculations.
+ *
+ * /param crcContext        pointer to context variable
+ *
+ * /returns 0 for OK, -1 on error
+ *
+ */
+ int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
+
+
+/**
+ * /brief calculate a crc32 from a data block
+ *
+ * /param crcContext         pointer to context variable
+ * /param inBuf              input buffer to checksum
+ * /param inLen              length of input buffer
+ * /param crc32              pointer to Uint32 to store the final CRC into
+ *
+ * /returns 0 for OK, -1 on error
+ *
+ */
+int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+/* Same routine broken down into three steps */
+int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+
+/**
+ * /brief clean up CRC context
+ *
+ * /param crcContext        pointer to context variable
+ *
+ * /returns 0 for OK, -1 on error
+ *
+*/
+
+int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_crc32_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 62 - 0
ThirdParty/SDL/include/SDL_test_font.h

@@ -0,0 +1,62 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_font.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef _SDL_test_font_h
+#define _SDL_test_font_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ *  \brief Draw a string in the currently set font.
+ *
+ *  \param renderer The renderer to draw on.
+ *  \param x The X coordinate of the upper left corner of the string.
+ *  \param y The Y coordinate of the upper left corner of the string.
+ *  \param s The string to draw.
+ *
+ *  \returns Returns 0 on success, -1 on failure.
+ */
+int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_font_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 384 - 0
ThirdParty/SDL/include/SDL_test_fuzzer.h

@@ -0,0 +1,384 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_fuzzer.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+  Data generators for fuzzing test data in a reproducible way.
+
+*/
+
+#ifndef _SDL_test_fuzzer_h
+#define _SDL_test_fuzzer_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+  Based on GSOC code by Markus Kauppila <[email protected]>
+*/
+
+
+/**
+ * \file
+ * Note: The fuzzer implementation uses a static instance of random context
+ * internally which makes it thread-UNsafe.
+ */
+
+/**
+ * Initializes the fuzzer for a test
+ *
+ * /param execKey Execution "Key" that initializes the random number generator uniquely for the test.
+ *
+ */
+void SDLTest_FuzzerInit(Uint64 execKey);
+
+
+/**
+ * Returns a random Uint8
+ *
+ * \returns Generated integer
+ */
+Uint8 SDLTest_RandomUint8();
+
+/**
+ * Returns a random Sint8
+ *
+ * \returns Generated signed integer
+ */
+Sint8 SDLTest_RandomSint8();
+
+
+/**
+ * Returns a random Uint16
+ *
+ * \returns Generated integer
+ */
+Uint16 SDLTest_RandomUint16();
+
+/**
+ * Returns a random Sint16
+ *
+ * \returns Generated signed integer
+ */
+Sint16 SDLTest_RandomSint16();
+
+
+/**
+ * Returns a random integer
+ *
+ * \returns Generated integer
+ */
+Sint32 SDLTest_RandomSint32();
+
+
+/**
+ * Returns a random positive integer
+ *
+ * \returns Generated integer
+ */
+Uint32 SDLTest_RandomUint32();
+
+/**
+ * Returns random Uint64.
+ *
+ * \returns Generated integer
+ */
+Uint64 SDLTest_RandomUint64();
+
+
+/**
+ * Returns random Sint64.
+ *
+ * \returns Generated signed integer
+ */
+Sint64 SDLTest_RandomSint64();
+
+/**
+ * \returns random float in range [0.0 - 1.0[
+ */
+float SDLTest_RandomUnitFloat();
+
+/**
+ * \returns random double in range [0.0 - 1.0[
+ */
+double SDLTest_RandomUnitDouble();
+
+/**
+ * \returns random float.
+ *
+ */
+float SDLTest_RandomFloat();
+
+/**
+ * \returns random double.
+ *
+ */
+double SDLTest_RandomDouble();
+
+/**
+ * Returns a random boundary value for Uint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
+ */
+Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns a random boundary value for Sint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
+ */
+Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
+ */
+Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
+ */
+Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns integer in range [min, max] (inclusive).
+ * Min and max values can be negative values.
+ * If Max in smaller tham min, then the values are swapped.
+ * Min and max are the same value, that value will be returned.
+ *
+ * \param min Minimum inclusive value of returned random number
+ * \param max Maximum inclusive value of returned random number
+ *
+ * \returns Generated random integer in range
+ */
+Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
+
+
+/**
+ * Generates random null-terminated string. The minimum length for
+ * the string is 1 character, maximum length for the string is 255
+ * characters and it can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiString();
+
+
+/**
+ * Generates random null-terminated string. The maximum length for
+ * the string is defined by the maxLength parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param maxLength The maximum length of the generated string.
+ *
+ * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
+
+
+/**
+ * Generates random null-terminated string. The length for
+ * the string is defined by the size parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param size The length of the generated string
+ *
+ * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringOfSize(int size);
+
+/**
+ * Returns the invocation count for the fuzzer since last ...FuzzerInit.
+ */
+int SDLTest_GetFuzzerInvocationCount();
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_fuzzer_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 123 - 0
ThirdParty/SDL/include/SDL_test_harness.h

@@ -0,0 +1,123 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_harness.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+  Defines types for test case definitions and the test execution harness API.
+
+  Based on original GSOC code by Markus Kauppila <[email protected]>
+*/
+
+#ifndef _SDL_test_harness_h
+#define _SDL_test_harness_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//! Definitions for test case structures
+#define TEST_ENABLED  1
+#define TEST_DISABLED 0
+
+//! Definition of all the possible test return values of the test case method
+#define TEST_ABORTED        -1
+#define TEST_STARTED         0
+#define TEST_COMPLETED       1
+#define TEST_SKIPPED         2
+
+//! Definition of all the possible test results for the harness
+#define TEST_RESULT_PASSED              0
+#define TEST_RESULT_FAILED              1
+#define TEST_RESULT_NO_ASSERT           2
+#define TEST_RESULT_SKIPPED             3
+#define TEST_RESULT_SETUP_FAILURE       4
+
+//!< Function pointer to a test case setup function (run before every test)
+typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
+
+//!< Function pointer to a test case function
+typedef int (*SDLTest_TestCaseFp)(void *arg);
+
+//!< Function pointer to a test case teardown function (run after every test)
+typedef void  (*SDLTest_TestCaseTearDownFp)(void *arg);
+
+/**
+ * Holds information about a single test case.
+ */
+typedef struct SDLTest_TestCaseReference {
+    /*!< Func2Stress */
+    SDLTest_TestCaseFp testCase;
+    /*!< Short name (or function name) "Func2Stress" */
+    char *name;
+    /*!< Long name or full description "This test pushes func2() to the limit." */
+    char *description;
+    /*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
+    int enabled;
+} SDLTest_TestCaseReference;
+
+/**
+ * Holds information about a test suite (multiple test cases).
+ */
+typedef struct SDLTest_TestSuiteReference {
+    /*!< "PlatformSuite" */
+    char *name;
+    /*!< The function that is run before each test. NULL skips. */
+    SDLTest_TestCaseSetUpFp testSetUp;
+    /*!< The test cases that are run as part of the suite. Last item should be NULL. */
+    const SDLTest_TestCaseReference **testCases;
+    /*!< The function that is run after each test. NULL skips. */
+    SDLTest_TestCaseTearDownFp testTearDown;
+} SDLTest_TestSuiteReference;
+
+
+/**
+ * \brief Execute a test suite using the given run seed and execution key.
+ *
+ * \param testSuites Suites containing the test case.
+ * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
+ * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
+ * \param filter Filter specification. NULL disables. Case sensitive.
+ * \param testIterations Number of iterations to run each test case.
+ *
+ * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
+ */
+int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_harness_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 78 - 0
ThirdParty/SDL/include/SDL_test_images.h

@@ -0,0 +1,78 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_images.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines some images for tests.
+
+*/
+
+#ifndef _SDL_test_images_h
+#define _SDL_test_images_h
+
+#include "SDL.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *Type for test images.
+ */
+typedef struct SDLTest_SurfaceImage_s {
+  int width;
+  int height;
+  unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
+  const char *pixel_data;
+} SDLTest_SurfaceImage_t;
+
+/* Test images */
+SDL_Surface *SDLTest_ImageBlit();
+SDL_Surface *SDLTest_ImageBlitColor();
+SDL_Surface *SDLTest_ImageBlitAlpha();
+SDL_Surface *SDLTest_ImageBlitBlendAdd();
+SDL_Surface *SDLTest_ImageBlitBlend();
+SDL_Surface *SDLTest_ImageBlitBlendMod();
+SDL_Surface *SDLTest_ImageBlitBlendNone();
+SDL_Surface *SDLTest_ImageBlitBlendAll();
+SDL_Surface *SDLTest_ImageFace();
+SDL_Surface *SDLTest_ImagePrimitives();
+SDL_Surface *SDLTest_ImagePrimitivesBlend();
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_images_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 67 - 0
ThirdParty/SDL/include/SDL_test_log.h

@@ -0,0 +1,67 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_log.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ *  Wrapper to log in the TEST category
+ *
+ */
+
+#ifndef _SDL_test_log_h
+#define _SDL_test_log_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and INFO priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_Log(const char *fmt, ...);
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_LogError(const char *fmt, ...);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_log_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 129 - 0
ThirdParty/SDL/include/SDL_test_md5.h

@@ -0,0 +1,129 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_md5.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ ***********************************************************************
+ ** Header file for implementation of MD5                             **
+ ** RSA Data Security, Inc. MD5 Message-Digest Algorithm              **
+ ** Created: 2/17/90 RLR                                              **
+ ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version               **
+ ** Revised (for MD5): RLR 4/27/91                                    **
+ **   -- G modified to have y&~z instead of y&z                       **
+ **   -- FF, GG, HH modified to add in last register done             **
+ **   -- Access pattern: round 2 works mod 5, round 3 works mod 3     **
+ **   -- distinct additive constant for each step                     **
+ **   -- round 4 added, working mod 7                                 **
+ ***********************************************************************
+*/
+
+/*
+ ***********************************************************************
+ **  Message-digest routines:                                         **
+ **  To form the message digest for a message M                       **
+ **    (1) Initialize a context buffer mdContext using MD5Init        **
+ **    (2) Call MD5Update on mdContext and M                          **
+ **    (3) Call MD5Final on mdContext                                 **
+ **  The message digest is now in mdContext->digest[0...15]           **
+ ***********************************************************************
+*/
+
+#ifndef _SDL_test_md5_h
+#define _SDL_test_md5_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ------------ Definitions --------- */
+
+/* typedef a 32-bit type */
+  typedef unsigned long int MD5UINT4;
+
+/* Data structure for MD5 (Message-Digest) computation */
+  typedef struct {
+    MD5UINT4  i[2];     /* number of _bits_ handled mod 2^64 */
+    MD5UINT4  buf[4];       /* scratch buffer */
+    unsigned char in[64];   /* input buffer */
+    unsigned char digest[16];   /* actual digest after Md5Final call */
+  } SDLTest_Md5Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * /brief initialize the context
+ *
+ * /param  mdContext        pointer to context variable
+ *
+ * Note: The function initializes the message-digest context
+ *       mdContext. Call before each new use of the context -
+ *       all fields are set to zero.
+ */
+ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
+
+
+/**
+ * /brief update digest from variable length data
+ *
+ * /param  mdContext       pointer to context variable
+ * /param  inBuf           pointer to data array/string
+ * /param  inLen           length of data array/string
+ *
+ * Note: The function updates the message-digest context to account
+ *       for the presence of each of the characters inBuf[0..inLen-1]
+ *       in the message whose digest is being computed.
+*/
+
+ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
+                 unsigned int inLen);
+
+
+/*
+ * /brief complete digest computation
+ *
+ * /param mdContext     pointer to context variable
+ *
+ * Note: The function terminates the message-digest computation and
+ *       ends with the desired message digest in mdContext.digest[0..15].
+ *       Always call before using the digest[] variable.
+*/
+
+ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_md5_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 115 - 0
ThirdParty/SDL/include/SDL_test_random.h

@@ -0,0 +1,115 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_random.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ A "32-bit Multiply with carry random number generator. Very fast.
+ Includes a list of recommended multipliers.
+
+ multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
+ period: (a*2^31)-1
+
+*/
+
+#ifndef _SDL_test_random_h
+#define _SDL_test_random_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* --- Definitions */
+
+/*
+ * Macros that return a random number in a specific format.
+ */
+#define SDLTest_RandomInt(c)        ((int)SDLTest_Random(c))
+
+/*
+ * Context structure for the random number generator state.
+ */
+  typedef struct {
+    unsigned int a;
+    unsigned int x;
+    unsigned int c;
+    unsigned int ah;
+    unsigned int al;
+  } SDLTest_RandomContext;
+
+
+/* --- Function prototypes */
+
+/**
+ *  \brief Initialize random number generator with two integers.
+ *
+ *  Note: The random sequence of numbers returned by ...Random() is the
+ *  same for the same two integers and has a period of 2^31.
+ *
+ *  \param rndContext     pointer to context structure
+ *  \param xi         integer that defines the random sequence
+ *  \param ci         integer that defines the random sequence
+ *
+ */
+ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
+                  unsigned int ci);
+
+/**
+ *  \brief Initialize random number generator based on current system time.
+ *
+ *  \param rndContext     pointer to context structure
+ *
+ */
+ void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
+
+
+/**
+ *  \brief Initialize random number generator based on current system time.
+ *
+ *  Note: ...RandomInit() or ...RandomInitTime() must have been called
+ *  before using this function.
+ *
+ *  \param rndContext     pointer to context structure
+ *
+ *  \returns A random number (32bit unsigned integer)
+ *
+ */
+ unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_test_random_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 10 - 26
ThirdParty/SDL/include/SDL_thread.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
 
 /**
  *  \file SDL_thread.h
- *  
+ *
  *  Header for the SDL thread management routines.
  */
 
@@ -37,9 +37,7 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /* The SDL thread structure, defined in SDL_thread.c */
@@ -67,28 +65,26 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
 #if defined(__WIN32__) && !defined(HAVE_LIBC)
 /**
  *  \file SDL_thread.h
- *  
+ *
  *  We compile SDL into a DLL. This means, that it's the DLL which
  *  creates a new thread for the calling process with the SDL_CreateThread()
  *  API. There is a problem with this, that only the RTL of the SDL.DLL will
- *  be initialized for those threads, and not the RTL of the calling 
+ *  be initialized for those threads, and not the RTL of the calling
  *  application!
- *  
+ *
  *  To solve this, we make a little hack here.
- *  
+ *
  *  We'll always use the caller's _beginthread() and _endthread() APIs to
  *  start a new thread. This way, if it's the SDL.DLL which uses this API,
  *  then the RTL of SDL.DLL will be used to create the new thread, and if it's
  *  the application, then the RTL of the application will be used.
- *  
+ *
  *  So, in short:
- *  Always use the _beginthread() and _endthread() of the calling runtime 
+ *  Always use the _beginthread() and _endthread() of the calling runtime
  *  library!
  */
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#ifndef _WIN32_WCE
 #include <process.h>            /* This has _beginthread() and _endthread() defined! */
-#endif
 
 typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
                                                         unsigned (__stdcall *
@@ -106,21 +102,11 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
                  pfnSDL_CurrentBeginThread pfnBeginThread,
                  pfnSDL_CurrentEndThread pfnEndThread);
 
-#if defined(_WIN32_WCE)
-
-/**
- *  Create a thread.
- */
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, NULL, NULL)
-
-#else
-
 /**
  *  Create a thread.
  */
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex)
 
-#endif
 #else
 
 /**
@@ -162,7 +148,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
 
 /**
  *  Get the thread identifier for the specified thread.
- *  
+ *
  *  Equivalent to SDL_ThreadID() if the specified thread is NULL.
  */
 extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
@@ -174,7 +160,7 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
 
 /**
  *  Wait for a thread to finish.
- *  
+ *
  *  The return code for the thread function is placed in the area
  *  pointed to by \c status, if \c status is not NULL.
  */
@@ -183,9 +169,7 @@ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 4 - 8
ThirdParty/SDL/include/SDL_timer.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
 
 /**
  *  \file SDL_timer.h
- *  
+ *
  *  Header for the SDL time management routines.
  */
 
@@ -34,14 +34,12 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  * \brief Get the number of milliseconds since the SDL library initialization.
- *  
+ *
  * \note This value wraps if the program runs for more than ~49 days.
  */
 extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
@@ -63,7 +61,7 @@ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
 
 /**
  *  Function prototype for the timer callback function.
- *  
+ *
  *  The callback function is passed the current timer interval and returns
  *  the next timer interval.  If the returned value is the same as the one
  *  passed in, the periodic alarm continues, otherwise a new alarm is
@@ -97,9 +95,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 24 - 62
ThirdParty/SDL/include/SDL_touch.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_touch.h
- *  
+ *
  *  Include file for SDL touch event handling.
  */
 
@@ -35,90 +35,52 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
-
 typedef Sint64 SDL_TouchID;
 typedef Sint64 SDL_FingerID;
 
+typedef struct SDL_Finger
+{
+    SDL_FingerID id;
+    float x;
+    float y;
+    float pressure;
+} SDL_Finger;
 
-struct SDL_Finger {
-  SDL_FingerID id;
-  Uint16 x;
-  Uint16 y;
-  Uint16 pressure;
-  Uint16 xdelta;
-  Uint16 ydelta;
-  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
-  SDL_bool down;
-};
-
-typedef struct SDL_Touch SDL_Touch;
-typedef struct SDL_Finger SDL_Finger;
-
-
-struct SDL_Touch {
-  
-  /* Free the touch when it's time */
-  void (*FreeTouch) (SDL_Touch * touch);
-  
-  /* data common for tablets */
-  float pressure_max, pressure_min;
-  float x_max,x_min;
-  float y_max,y_min;
-  Uint16 xres,yres,pressureres;
-  float native_xres,native_yres,native_pressureres;
-  float tilt;                   /* for future use */
-  float rotation;               /* for future use */
-  
-  /* Data common to all touch */
-  SDL_TouchID id;
-  SDL_Window *focus;
-  
-  char *name;
-  Uint8 buttonstate;
-  SDL_bool relative_mode;
-  SDL_bool flush_motion;
-
-  int num_fingers;
-  int max_fingers;
-  SDL_Finger** fingers;
-    
-  void *driverdata;
-};
-
+/* Used as the device ID for mouse events simulated with touch input */
+#define SDL_TOUCH_MOUSEID ((Uint32)-1)
 
 
 /* Function prototypes */
 
 /**
- *  \brief Get the touch object at the given id.
- *
- *
+ *  \brief Get the number of registered touch devices.
  */
-  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
+extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
 
+/**
+ *  \brief Get the touch ID with the given index, or 0 if the index is invalid.
+ */
+extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
 
+/**
+ *  \brief Get the number of active fingers for a given touch device.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
 
 /**
- *  \brief Get the finger object of the given touch, at the given id.
- *
- *
+ *  \brief Get the finger object of the given touch, with the given index.
  */
-  extern 
-  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
+extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_mouse_h */
+#endif /* _SDL_touch_h */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 2
ThirdParty/SDL/include/SDL_types.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_types.h
- *  
+ *
  *  \deprecated
  */
 

+ 24 - 28
ThirdParty/SDL/include/SDL_version.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file SDL_version.h
- *  
+ *
  *  This header defines the current SDL version.
  */
 
@@ -33,20 +33,18 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \brief Information the version of SDL in use.
- *  
+ *
  *  Represents the library's version as three levels: major revision
  *  (increments with massive changes, additions, and enhancements),
  *  minor revision (increments with backwards-compatible changes to the
  *  major revision), and patchlevel (increments with fixes to the minor
  *  revision).
- *  
+ *
  *  \sa SDL_VERSION
  *  \sa SDL_GetVersion
  */
@@ -59,30 +57,30 @@ typedef struct SDL_version
 
 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
 */
-#define SDL_MAJOR_VERSION	2
-#define SDL_MINOR_VERSION	0
-#define SDL_PATCHLEVEL		0
+#define SDL_MAJOR_VERSION   2
+#define SDL_MINOR_VERSION   0
+#define SDL_PATCHLEVEL      0
 
 /**
  *  \brief Macro to determine SDL version program was compiled against.
- *  
+ *
  *  This macro fills in a SDL_version structure with the version of the
  *  library you compiled against. This is determined by what header the
  *  compiler uses. Note that if you dynamically linked the library, you might
  *  have a slightly newer or older version at runtime. That version can be
  *  determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
  *  is not a macro.
- *  
+ *
  *  \param x A pointer to a SDL_version struct to initialize.
- *  
+ *
  *  \sa SDL_version
  *  \sa SDL_GetVersion
  */
-#define SDL_VERSION(x)							\
-{									\
-	(x)->major = SDL_MAJOR_VERSION;					\
-	(x)->minor = SDL_MINOR_VERSION;					\
-	(x)->patch = SDL_PATCHLEVEL;					\
+#define SDL_VERSION(x)                          \
+{                                   \
+    (x)->major = SDL_MAJOR_VERSION;                 \
+    (x)->minor = SDL_MINOR_VERSION;                 \
+    (x)->patch = SDL_PATCHLEVEL;                    \
 }
 
 /**
@@ -90,23 +88,23 @@ typedef struct SDL_version
  *  \verbatim
     (1,2,3) -> (1203)
     \endverbatim
- *  
+ *
  *  This assumes that there will never be more than 100 patchlevels.
  */
-#define SDL_VERSIONNUM(X, Y, Z)						\
-	((X)*1000 + (Y)*100 + (Z))
+#define SDL_VERSIONNUM(X, Y, Z)                     \
+    ((X)*1000 + (Y)*100 + (Z))
 
 /**
  *  This is the version number macro for the current SDL version.
  */
 #define SDL_COMPILEDVERSION \
-	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+    SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
 
 /**
  *  This macro will evaluate to true if compiled with SDL at least X.Y.Z.
  */
 #define SDL_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
+    (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
 
 /**
  *  \brief Get the version of SDL that is linked against your program.
@@ -115,11 +113,11 @@ typedef struct SDL_version
  *  current version will be different than the version you compiled against.
  *  This function returns the current version, while SDL_VERSION() is a
  *  macro that tells you what version you compiled with.
- *  
+ *
  *  \code
  *  SDL_version compiled;
  *  SDL_version linked;
- *  
+ *
  *  SDL_VERSION(&compiled);
  *  SDL_GetVersion(&linked);
  *  printf("We compiled against SDL version %d.%d.%d ...\n",
@@ -127,9 +125,9 @@ typedef struct SDL_version
  *  printf("But we linked against SDL version %d.%d.%d.\n",
  *         linked.major, linked.minor, linked.patch);
  *  \endcode
- *  
+ *
  *  This function may be called safely at any time, even before SDL_Init().
- *  
+ *
  *  \sa SDL_VERSION
  */
 extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
@@ -155,9 +153,7 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 232 - 128
ThirdParty/SDL/include/SDL_video.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -23,7 +23,7 @@
 
 /**
  *  \file SDL_video.h
- *  
+ *
  *  Header file for SDL video functions.
  */
 
@@ -38,14 +38,12 @@
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 extern "C" {
-/* *INDENT-ON* */
 #endif
 
 /**
  *  \brief  The structure that defines a display mode
- *  
+ *
  *  \sa SDL_GetNumDisplayModes()
  *  \sa SDL_GetDisplayMode()
  *  \sa SDL_GetDesktopDisplayMode()
@@ -65,7 +63,7 @@ typedef struct
 
 /**
  *  \brief The type used to identify a window
- *  
+ *
  *  \sa SDL_CreateWindow()
  *  \sa SDL_CreateWindowFrom()
  *  \sa SDL_DestroyWindow()
@@ -86,6 +84,7 @@ typedef struct
  *  \sa SDL_SetWindowIcon()
  *  \sa SDL_SetWindowPosition()
  *  \sa SDL_SetWindowSize()
+ *  \sa SDL_SetWindowBordered()
  *  \sa SDL_SetWindowTitle()
  *  \sa SDL_ShowWindow()
  */
@@ -93,7 +92,7 @@ typedef struct SDL_Window SDL_Window;
 
 /**
  *  \brief The flags on a window
- *  
+ *
  *  \sa SDL_GetWindowFlags()
  */
 typedef enum
@@ -109,6 +108,7 @@ typedef enum
     SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
     SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
     SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
+    SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
     SDL_WINDOW_FOREIGN = 0x00000800             /**< window not created by SDL */
 } SDL_WindowFlags;
 
@@ -138,9 +138,9 @@ typedef enum
     SDL_WINDOWEVENT_NONE,           /**< Never used */
     SDL_WINDOWEVENT_SHOWN,          /**< Window has been shown */
     SDL_WINDOWEVENT_HIDDEN,         /**< Window has been hidden */
-    SDL_WINDOWEVENT_EXPOSED,        /**< Window has been exposed and should be 
+    SDL_WINDOWEVENT_EXPOSED,        /**< Window has been exposed and should be
                                          redrawn */
-    SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2 
+    SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2
                                      */
     SDL_WINDOWEVENT_RESIZED,        /**< Window has been resized to data1xdata2 */
     SDL_WINDOWEVENT_SIZE_CHANGED,   /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */
@@ -152,10 +152,8 @@ typedef enum
     SDL_WINDOWEVENT_LEAVE,          /**< Window has lost mouse focus */
     SDL_WINDOWEVENT_FOCUS_GAINED,   /**< Window has gained keyboard focus */
     SDL_WINDOWEVENT_FOCUS_LOST,     /**< Window has lost keyboard focus */
-    SDL_WINDOWEVENT_CLOSE,          /**< The window manager requests that the 
+    SDL_WINDOWEVENT_CLOSE           /**< The window manager requests that the
                                          window be closed */
-    SDL_WINDOWEVENT_SURFACE_LOST,   /**< Android only: surface has been lost */
-    SDL_WINDOWEVENT_SURFACE_CREATED /**< Android only: surface has been restored after loss */
 } SDL_WindowEventID;
 
 /**
@@ -187,22 +185,25 @@ typedef enum
     SDL_GL_RETAINED_BACKING,
     SDL_GL_CONTEXT_MAJOR_VERSION,
     SDL_GL_CONTEXT_MINOR_VERSION,
+    SDL_GL_CONTEXT_EGL,
     SDL_GL_CONTEXT_FLAGS,
-    SDL_GL_CONTEXT_PROFILE_MASK
+    SDL_GL_CONTEXT_PROFILE_MASK,
+    SDL_GL_SHARE_WITH_CURRENT_CONTEXT
 } SDL_GLattr;
 
 typedef enum
 {
     SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
     SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
-    SDL_GL_CONTEXT_PROFILE_ES2            = 0x0004
+    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004
 } SDL_GLprofile;
 
 typedef enum
 {
     SDL_GL_CONTEXT_DEBUG_FLAG              = 0x0001,
     SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
-    SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      = 0x0004
+    SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      = 0x0004,
+    SDL_GL_CONTEXT_RESET_ISOLATION_FLAG    = 0x0008
 } SDL_GLcontextFlag;
 
 
@@ -210,52 +211,52 @@ typedef enum
 
 /**
  *  \brief Get the number of video drivers compiled into SDL
- *  
+ *
  *  \sa SDL_GetVideoDriver()
  */
 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
 
 /**
  *  \brief Get the name of a built in video driver.
- *  
+ *
  *  \note The video drivers are presented in the order in which they are
  *        normally checked during initialization.
- *  
+ *
  *  \sa SDL_GetNumVideoDrivers()
  */
 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
 
 /**
  *  \brief Initialize the video subsystem, optionally specifying a video driver.
- *  
- *  \param driver_name Initialize a specific driver by name, or NULL for the 
+ *
+ *  \param driver_name Initialize a specific driver by name, or NULL for the
  *                     default video driver.
- *  
+ *
  *  \return 0 on success, -1 on error
- *  
+ *
  *  This function initializes the video subsystem; setting up a connection
  *  to the window manager, etc, and determines the available display modes
  *  and pixel formats, but does not initialize a window or graphics mode.
- *  
+ *
  *  \sa SDL_VideoQuit()
  */
 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
 
 /**
  *  \brief Shuts down the video subsystem.
- *  
+ *
  *  This function closes all windows, and restores the original video mode.
- *  
+ *
  *  \sa SDL_VideoInit()
  */
 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
 
 /**
  *  \brief Returns the name of the currently initialized video driver.
- *  
+ *
  *  \return The name of the current video driver or NULL if no driver
  *          has been initialized
- *  
+ *
  *  \sa SDL_GetNumVideoDrivers()
  *  \sa SDL_GetVideoDriver()
  */
@@ -263,37 +264,46 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
 
 /**
  *  \brief Returns the number of available video displays.
- *  
+ *
  *  \sa SDL_GetDisplayBounds()
  */
 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
 
+/**
+ *  \brief Get the name of a display in UTF-8 encoding
+ *
+ *  \return The name of a display, or NULL for an invalid display index.
+ *
+ *  \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
+
 /**
  *  \brief Get the desktop area represented by a display, with the primary
  *         display located at 0,0
- *  
+ *
  *  \return 0 on success, or -1 if the index is out of range.
- *  
+ *
  *  \sa SDL_GetNumVideoDisplays()
  */
 extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
 
 /**
  *  \brief Returns the number of available display modes.
- *  
+ *
  *  \sa SDL_GetDisplayMode()
  */
 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
 
 /**
  *  \brief Fill in information about a specific display mode.
- *  
+ *
  *  \note The display modes are sorted in this priority:
  *        \li bits per pixel -> more colors to fewer colors
  *        \li width -> largest to smallest
  *        \li height -> largest to smallest
  *        \li refresh rate -> highest to lowest
- *  
+ *
  *  \sa SDL_GetNumDisplayModes()
  */
 extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
@@ -312,21 +322,22 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
 
 /**
  *  \brief Get the closest match to the requested display mode.
- *  
+ *
+ *  \param displayIndex The index of display from which mode should be queried.
  *  \param mode The desired display mode
- *  \param closest A pointer to a display mode to be filled in with the closest 
+ *  \param closest A pointer to a display mode to be filled in with the closest
  *                 match of the available display modes.
- *  
- *  \return The passed in value \c closest, or NULL if no matching video mode 
+ *
+ *  \return The passed in value \c closest, or NULL if no matching video mode
  *          was available.
- *  
+ *
  *  The available display modes are scanned, and \c closest is filled in with the
- *  closest mode matching the requested mode and returned.  The mode format and 
- *  refresh_rate default to the desktop mode if they are 0.  The modes are 
- *  scanned with size being first priority, format being second priority, and 
- *  finally checking the refresh_rate.  If all the available modes are too 
+ *  closest mode matching the requested mode and returned.  The mode format and
+ *  refresh_rate default to the desktop mode if they are 0.  The modes are
+ *  scanned with size being first priority, format being second priority, and
+ *  finally checking the refresh_rate.  If all the available modes are too
  *  small, then NULL is returned.
- *  
+ *
  *  \sa SDL_GetNumDisplayModes()
  *  \sa SDL_GetDisplayMode()
  */
@@ -334,22 +345,23 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI
 
 /**
  *  \brief Get the display index associated with a window.
- *  
+ *
  *  \return the display index of the display containing the center of the
  *          window, or -1 on error.
  */
-extern DECLSPEC int SDLCALL SDL_GetWindowDisplay(SDL_Window * window);
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
 
 /**
  *  \brief Set the display mode used when a fullscreen window is visible.
  *
  *  By default the window's dimensions and the desktop format and refresh rate
  *  are used.
- *  
+ *
+ *  \param window The window for which the display mode should be set.
  *  \param mode The mode to use, or NULL for the default mode.
- *  
+ *
  *  \return 0 on success, or -1 if setting the display mode failed.
- *  
+ *
  *  \sa SDL_GetWindowDisplayMode()
  *  \sa SDL_SetWindowFullscreen()
  */
@@ -374,22 +386,22 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
 
 /**
  *  \brief Create a window with the specified position, dimensions, and flags.
- *  
+ *
  *  \param title The title of the window, in UTF-8 encoding.
- *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
  *               ::SDL_WINDOWPOS_UNDEFINED.
- *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  *               ::SDL_WINDOWPOS_UNDEFINED.
  *  \param w     The width of the window.
  *  \param h     The height of the window.
- *  \param flags The flags for the window, a mask of any of the following: 
- *               ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, 
- *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_BORDERLESS, 
- *               ::SDL_WINDOW_RESIZABLE,  ::SDL_WINDOW_MAXIMIZED, 
+ *  \param flags The flags for the window, a mask of any of the following:
+ *               ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
+ *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_BORDERLESS,
+ *               ::SDL_WINDOW_RESIZABLE,  ::SDL_WINDOW_MAXIMIZED,
  *               ::SDL_WINDOW_MINIMIZED,  ::SDL_WINDOW_INPUT_GRABBED.
- *  
+ *
  *  \return The id of the window created, or zero if window creation failed.
- *  
+ *
  *  \sa SDL_DestroyWindow()
  */
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
@@ -398,15 +410,14 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
 
 /**
  *  \brief Create an SDL window from an existing native window.
- *  
+ *
  *  \param data A pointer to driver-dependent window creation data
- *  \param flags The flags for the window, specify SDL_WINDOW_OPENGL to setup
- *               OpenGL pixel format
  *
  *  \return The id of the window created, or zero if window creation failed.
- *  
+ *
  *  \sa SDL_DestroyWindow()
  */
+// Urho3D: added window flags parameter
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data, Uint32 flags);
 
 /**
@@ -426,7 +437,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
 
 /**
  *  \brief Set the title of a window, in UTF-8 format.
- *  
+ *
  *  \sa SDL_GetWindowTitle()
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
@@ -434,14 +445,15 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
 
 /**
  *  \brief Get the title of a window, in UTF-8 format.
- *  
+ *
  *  \sa SDL_SetWindowTitle()
  */
 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
 
 /**
  *  \brief Set the icon for a window.
- *  
+ *
+ *  \param window The window for which the icon should be set.
  *  \param icon The icon for the window.
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
@@ -449,7 +461,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
 
 /**
  *  \brief Associate an arbitrary named pointer with a window.
- *  
+ *
  *  \param window   The window to associate with the pointer.
  *  \param name     The name of the pointer.
  *  \param userdata The associated pointer.
@@ -466,12 +478,12 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
 
 /**
  *  \brief Retrieve the data pointer associated with a window.
- *  
+ *
  *  \param window   The window to query.
  *  \param name     The name of the pointer.
  *
  *  \return The value associated with 'name'
- *  
+ *
  *  \sa SDL_SetWindowData()
  */
 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
@@ -479,15 +491,15 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
 
 /**
  *  \brief Set the position of a window.
- *  
+ *
  *  \param window   The window to reposition.
  *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
                     ::SDL_WINDOWPOS_UNDEFINED.
  *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
                     ::SDL_WINDOWPOS_UNDEFINED.
- *  
+ *
  *  \note The window coordinate origin is the upper left of the display.
- *  
+ *
  *  \sa SDL_GetWindowPosition()
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
@@ -495,7 +507,11 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
 
 /**
  *  \brief Get the position of a window.
- *  
+ *
+ *  \param window   The window to query.
+ *  \param x        Pointer to variable for storing the x position, may be NULL
+ *  \param y        Pointer to variable for storing the y position, may be NULL
+ *
  *  \sa SDL_SetWindowPosition()
  */
 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
@@ -503,10 +519,14 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
 
 /**
  *  \brief Set the size of a window's client area.
- *  
+ *
+ *  \param window   The window to resize.
+ *  \param w        The width of the window, must be >0
+ *  \param h        The height of the window, must be >0
+ *
  *  \note You can't change the size of a fullscreen window, it automatically
  *        matches the size of the display mode.
- *  
+ *
  *  \sa SDL_GetWindowSize()
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
@@ -514,22 +534,101 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
 
 /**
  *  \brief Get the size of a window's client area.
- *  
+ *
+ *  \param window   The window to query.
+ *  \param w        Pointer to variable for storing the width, may be NULL
+ *  \param h        Pointer to variable for storing the height, may be NULL
+ *
  *  \sa SDL_SetWindowSize()
  */
 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
                                                int *h);
 
+/**
+ *  \brief Set the minimum size of a window's client area.
+ *
+ *  \param window    The window to set a new minimum size.
+ *  \param min_w     The minimum width of the window, must be >0
+ *  \param min_h     The minimum height of the window, must be >0
+ *
+ *  \note You can't change the minimum size of a fullscreen window, it
+ *        automatically matches the size of the display mode.
+ *
+ *  \sa SDL_GetWindowMinimumSize()
+ *  \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
+                                                      int min_w, int min_h);
+
+/**
+ *  \brief Get the minimum size of a window's client area.
+ *
+ *  \param window   The window to query.
+ *  \param w        Pointer to variable for storing the minimum width, may be NULL
+ *  \param h        Pointer to variable for storing the minimum height, may be NULL
+ *
+ *  \sa SDL_GetWindowMaximumSize()
+ *  \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
+                                                      int *w, int *h);
+
+/**
+ *  \brief Set the maximum size of a window's client area.
+ *
+ *  \param window    The window to set a new maximum size.
+ *  \param max_w     The maximum width of the window, must be >0
+ *  \param max_h     The maximum height of the window, must be >0
+ *
+ *  \note You can't change the maximum size of a fullscreen window, it
+ *        automatically matches the size of the display mode.
+ *
+ *  \sa SDL_GetWindowMaximumSize()
+ *  \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
+                                                      int max_w, int max_h);
+
+/**
+ *  \brief Get the maximum size of a window's client area.
+ *
+ *  \param window   The window to query.
+ *  \param w        Pointer to variable for storing the maximum width, may be NULL
+ *  \param h        Pointer to variable for storing the maximum height, may be NULL
+ *
+ *  \sa SDL_GetWindowMinimumSize()
+ *  \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
+                                                      int *w, int *h);
+
+/**
+ *  \brief Set the border state of a window.
+ *
+ *  This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
+ *  add or remove the border from the actual window. This is a no-op if the
+ *  window's border already matches the requested state.
+ *
+ *  \param window The window of which to change the border state.
+ *  \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
+ *
+ *  \note You can't change the border state of a fullscreen window.
+ *
+ *  \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
+                                                   SDL_bool bordered);
+
 /**
  *  \brief Show a window.
- *  
+ *
  *  \sa SDL_HideWindow()
  */
 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
 
 /**
  *  \brief Hide a window.
- *  
+ *
  *  \sa SDL_ShowWindow()
  */
 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
@@ -541,21 +640,21 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
 
 /**
  *  \brief Make a window as large as possible.
- *  
+ *
  *  \sa SDL_RestoreWindow()
  */
 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
 
 /**
  *  \brief Minimize a window to an iconic representation.
- *  
+ *
  *  \sa SDL_RestoreWindow()
  */
 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
 
 /**
  *  \brief Restore the size and position of a minimized or maximized window.
- *  
+ *
  *  \sa SDL_MaximizeWindow()
  *  \sa SDL_MinimizeWindow()
  */
@@ -563,19 +662,19 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
 
 /**
  *  \brief Set a window's fullscreen state.
- *  
+ *
  *  \return 0 on success, or -1 if setting the display mode failed.
- *  
+ *
  *  \sa SDL_SetWindowDisplayMode()
  *  \sa SDL_GetWindowDisplayMode()
  */
 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
-                                                    SDL_bool fullscreen);
+                                                    Uint32 flags);
 
 /**
  *  \brief Get the SDL surface associated with the window.
  *
- *  \return The window's framebuffer surface, or NULL on error. 
+ *  \return The window's framebuffer surface, or NULL on error.
  *
  *  A new surface will be created with the optimal format for the window,
  *  if necessary. This surface will be freed when the window is destroyed.
@@ -606,14 +705,15 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
  *  \sa SDL_UpdateWindowSurfaceRect()
  */
 extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
-                                                         SDL_Rect * rects,
+                                                         const SDL_Rect * rects,
                                                          int numrects);
 
 /**
  *  \brief Set a window's input grab mode.
- *  
+ *
+ *  \param window The window for which the input grab mode should be set.
  *  \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
- *  
+ *
  *  \sa SDL_GetWindowGrab()
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
@@ -621,18 +721,18 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
 
 /**
  *  \brief Get a window's input grab mode.
- *  
+ *
  *  \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
- *  
+ *
  *  \sa SDL_SetWindowGrab()
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
 
 /**
  *  \brief Set the brightness (gamma correction) for a window.
- *  
+ *
  *  \return 0 on success, or -1 if setting the brightness isn't supported.
- *  
+ *
  *  \sa SDL_GetWindowBrightness()
  *  \sa SDL_SetWindowGammaRamp()
  */
@@ -640,22 +740,23 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b
 
 /**
  *  \brief Get the brightness (gamma correction) for a window.
- *  
+ *
  *  \return The last brightness value passed to SDL_SetWindowBrightness()
- *  
+ *
  *  \sa SDL_SetWindowBrightness()
  */
 extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
 
 /**
  *  \brief Set the gamma ramp for a window.
- *  
+ *
+ *  \param window The window for which the gamma ramp should be set.
  *  \param red The translation table for the red channel, or NULL.
  *  \param green The translation table for the green channel, or NULL.
  *  \param blue The translation table for the blue channel, or NULL.
- *  
+ *
  *  \return 0 on success, or -1 if gamma ramps are unsupported.
- *  
+ *
  *  Set the gamma translation table for the red, green, and blue channels
  *  of the video hardware.  Each table is an array of 256 16-bit quantities,
  *  representing a mapping between the input and output for that channel.
@@ -671,16 +772,17 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
 
 /**
  *  \brief Get the gamma ramp for a window.
- *  
- *  \param red   A pointer to a 256 element array of 16-bit quantities to hold 
+ *
+ *  \param window The window from which the gamma ramp should be queried.
+ *  \param red   A pointer to a 256 element array of 16-bit quantities to hold
  *               the translation table for the red channel, or NULL.
- *  \param green A pointer to a 256 element array of 16-bit quantities to hold 
+ *  \param green A pointer to a 256 element array of 16-bit quantities to hold
  *               the translation table for the green channel, or NULL.
- *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold 
+ *  \param blue  A pointer to a 256 element array of 16-bit quantities to hold
  *               the translation table for the blue channel, or NULL.
- *   
+ *
  *  \return 0 on success, or -1 if gamma ramps are unsupported.
- *  
+ *
  *  \sa SDL_SetWindowGammaRamp()
  */
 extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
@@ -696,7 +798,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
 
 /**
  *  \brief Returns whether the screensaver is currently enabled (default on).
- *  
+ *
  *  \sa SDL_EnableScreenSaver()
  *  \sa SDL_DisableScreenSaver()
  */
@@ -704,7 +806,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
 
 /**
  *  \brief Allow the screen to be blanked by a screensaver
- *  
+ *
  *  \sa SDL_IsScreenSaverEnabled()
  *  \sa SDL_DisableScreenSaver()
  */
@@ -712,7 +814,7 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
 
 /**
  *  \brief Prevent the screen from being blanked by a screensaver
- *  
+ *
  *  \sa SDL_IsScreenSaverEnabled()
  *  \sa SDL_EnableScreenSaver()
  */
@@ -726,19 +828,19 @@ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
 
 /**
  *  \brief Dynamically load an OpenGL library.
- *  
- *  \param path The platform dependent OpenGL library name, or NULL to open the 
+ *
+ *  \param path The platform dependent OpenGL library name, or NULL to open the
  *              default OpenGL library.
- *  
+ *
  *  \return 0 on success, or -1 if the library couldn't be loaded.
- *  
+ *
  *  This should be done after initializing the video driver, but before
  *  creating any OpenGL windows.  If no OpenGL library is loaded, the default
  *  library will be loaded upon creation of the first OpenGL window.
- *  
+ *
  *  \note If you do this, you need to retrieve all of the GL functions used in
  *        your program from the dynamic library using SDL_GL_GetProcAddress().
- *  
+ *
  *  \sa SDL_GL_GetProcAddress()
  *  \sa SDL_GL_UnloadLibrary()
  */
@@ -751,13 +853,13 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
 
 /**
  *  \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
- *  
+ *
  *  \sa SDL_GL_LoadLibrary()
  */
 extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
 
 /**
- *  \brief Return true if an OpenGL extension is supported for the current 
+ *  \brief Return true if an OpenGL extension is supported for the current
  *         context.
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
@@ -774,9 +876,9 @@ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
 
 /**
- *  \brief Create an OpenGL context for use with an OpenGL window, and make it 
+ *  \brief Create an OpenGL context for use with an OpenGL window, and make it
  *         current.
- *  
+ *
  *  \sa SDL_GL_DeleteContext()
  */
 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
@@ -784,7 +886,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
 
 /**
  *  \brief Set up an OpenGL context for rendering into an OpenGL window.
- *  
+ *
  *  \note The context must have been created with a compatible window.
  */
 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
@@ -792,36 +894,40 @@ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
 
 /**
  *  \brief Set the swap interval for the current OpenGL context.
- *  
+ *
  *  \param interval 0 for immediate updates, 1 for updates synchronized with the
- *                  vertical retrace.
- *  
+ *                  vertical retrace. If the system supports it, you may
+ *                  specify -1 to allow late swaps to happen immediately
+ *                  instead of waiting for the next retrace.
+ *
  *  \return 0 on success, or -1 if setting the swap interval is not supported.
- *  
+ *
  *  \sa SDL_GL_GetSwapInterval()
  */
 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
 
 /**
  *  \brief Get the swap interval for the current OpenGL context.
- *  
- *  \return 0 if there is no vertical retrace synchronization, 1 if the buffer 
- *          swap is synchronized with the vertical retrace, and -1 if getting 
- *          the swap interval is not supported.
- *  
+ *
+ *  \return 0 if there is no vertical retrace synchronization, 1 if the buffer
+ *          swap is synchronized with the vertical retrace, and -1 if late
+ *          swaps happen immediately instead of waiting for the next retrace.
+ *          If the system can't determine the swap interval, or there isn't a
+ *          valid current context, this will return 0 as a safe default.
+ *
  *  \sa SDL_GL_SetSwapInterval()
  */
 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
 
 /**
- * \brief Swap the OpenGL buffers for a window, if double-buffering is 
+ * \brief Swap the OpenGL buffers for a window, if double-buffering is
  *        supported.
  */
 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
 
 /**
  *  \brief Delete an OpenGL context.
- *  
+ *
  *  \sa SDL_GL_CreateContext()
  */
 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
@@ -831,9 +937,7 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
-/* *INDENT-OFF* */
 }
-/* *INDENT-ON* */
 #endif
 #include "close_code.h"
 

+ 17 - 15
ThirdParty/SDL/include/begin_code.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-// Modified by Lasse Oorni for Urho3D
-
 /**
  *  \file begin_code.h
  *
@@ -36,37 +34,31 @@
 #define _begin_code_h
 
 /* Some compilers use a special export keyword */
-// Urho3D: compile as a static lib, no export keyword required
-/*
 #ifndef DECLSPEC
 # if defined(__BEOS__) || defined(__HAIKU__)
 #  if defined(__GNUC__)
-#   define DECLSPEC	__declspec(dllexport)
+#   define DECLSPEC __declspec(dllexport)
 #  else
-#   define DECLSPEC	__declspec(export)
+#   define DECLSPEC __declspec(export)
 #  endif
 # elif defined(__WIN32__)
 #  ifdef __BORLANDC__
 #   ifdef BUILD_SDL
 #    define DECLSPEC
 #   else
-#    define DECLSPEC	__declspec(dllimport)
+#    define DECLSPEC    __declspec(dllimport)
 #   endif
 #  else
-#   define DECLSPEC	__declspec(dllexport)
+#   define DECLSPEC __declspec(dllexport)
 #  endif
 # else
 #  if defined(__GNUC__) && __GNUC__ >= 4
-#   define DECLSPEC	__attribute__ ((visibility("default")))
+#   define DECLSPEC __attribute__ ((visibility("default")))
 #  else
 #   define DECLSPEC
 #  endif
 # endif
 #endif
-*/
-#ifndef DECLSPEC
-#define DECLSPEC
-#endif
 
 /* By default SDL uses the C calling convention */
 #ifndef SDLCALL
@@ -114,7 +106,7 @@
     defined(__WATCOMC__) || defined(__LCC__) || \
     defined(__DECC)
 #ifndef __inline__
-#define __inline__	__inline
+#define __inline__  __inline
 #endif
 #define SDL_INLINE_OKAY
 #else
@@ -136,6 +128,16 @@
 #define __inline__
 #endif
 
+#ifndef SDL_FORCE_INLINE
+#if defined(_MSC_VER)
+#define SDL_FORCE_INLINE __forceinline
+#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
+#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
+#else
+#define SDL_FORCE_INLINE static __inline__
+#endif
+#endif
+
 /* Apparently this is needed by several Windows compilers */
 #if !defined(__MACH__)
 #ifndef NULL

+ 2 - 2
ThirdParty/SDL/include/close_code.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -21,7 +21,7 @@
 
 /**
  *  \file close_code.h
- *  
+ *
  *  This file reverses the effects of begin_code.h and should be included
  *  after you finish any function and structure declarations in your headers
  */

+ 1555 - 0
ThirdParty/SDL/include/doxyfile

@@ -0,0 +1,1555 @@
+# Doxyfile 1.5.9
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = SDL
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 2.0.0
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = YES
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, 
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "defined=\"\def\"" \
+                         "discussion=\"\par Discussion:\n\""
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses. 
+# With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this tag. 
+# The format is ext=language, where ext is a file extension, and language is one of 
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, 
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat 
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), 
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set
+# FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen to replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = YES
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penality. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will rougly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by 
+# doxygen. The layout file controls the global structure of the generated output files 
+# in an output format independent way. The create the layout file that represents 
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a 
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name 
+# of the layout file.
+
+LAYOUT_FILE            = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = ./doxygen_warn.txt
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = .
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.f90 \
+                         *.f \
+                         *.vhd \
+                         *.vhdl \
+                         *.h.in \
+                         *.h.default
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = ../doxy \
+                         ../test \
+                         ../Xcode \
+                         ../VisualC \
+                         ../VisualCE \
+                         ../Xcode-iOS
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = SDL_ \
+                         SDL
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "SDL 2.0 Doxygen"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.libsdl.sdl20
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = ./sdl20.chm
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER 
+# are set, an additional index file will be generated that can be used as input for 
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated 
+# HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = 
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. 
+# For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 1
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to FRAME, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature. Other possible values 
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories, 
+# and Class Hierarchy pages using a tree view instead of an ordered list; 
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which 
+# disables this behavior completely. For backwards compatibility with previous 
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE 
+# respectively.
+
+GENERATE_TREEVIEW      = ALL
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = DOXYGEN_SHOULD_IGNORE_THIS=1 \
+                         DECLSPEC= \
+                         SDLCALL= \
+                         _WIN32=1
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links. 
+# Note that each tag file must have a unique name 
+# (where the name does NOT include the path) 
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = ./SDL.tag
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = c:\Perl\bin\perl.exe
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# By default doxygen will write a font called FreeSans.ttf to the output 
+# directory and reference it in all dot files that doxygen generates. This 
+# font does not include all possible unicode characters however, so when you need 
+# these (or just want a differently looking font) you can specify the font name 
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
+# which can be done by putting it in a standard location or by setting the 
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the 
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
+# different font using DOT_FONTNAME you can set the path where dot 
+# can find it using this tag.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif 
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 2
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Options related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO

+ 201 - 88
ThirdParty/SDL/src/SDL.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -23,6 +23,7 @@
 /* Initialization code for SDL */
 
 #include "SDL.h"
+#include "SDL_bits.h"
 #include "SDL_revision.h"
 #include "SDL_fatal.h"
 #include "SDL_assert_c.h"
@@ -31,105 +32,173 @@
 
 /* Initialization/Cleanup routines */
 #if !SDL_TIMERS_DISABLED
-extern void SDL_StartTicks(void);
 extern int SDL_TimerInit(void);
 extern void SDL_TimerQuit(void);
+extern void SDL_InitTicks(void);
 #endif
-#if defined(__WIN32__)
+#if SDL_VIDEO_DRIVER_WINDOWS
 extern int SDL_HelperWindowCreate(void);
 extern int SDL_HelperWindowDestroy(void);
 #endif
 
-// Urho3D: added prototype
-void SDL_ThreadsQuit();
-
 
 /* The initialized subsystems */
-static Uint32 SDL_initialized = 0;
-static Uint32 ticks_started = 0;
+#ifdef SDL_MAIN_NEEDED
+static SDL_bool SDL_MainIsReady = SDL_FALSE;
+#else
+static SDL_bool SDL_MainIsReady = SDL_TRUE;
+#endif
+static SDL_bool SDL_bInMainQuit = SDL_FALSE;
+static Uint8 SDL_SubsystemRefCount[ 32 ];
+
+/* Private helper to increment a subsystem's ref counter. */
+static void
+SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem)
+{
+    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+    SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
+    ++SDL_SubsystemRefCount[subsystem_index];
+}
 
+/* Private helper to decrement a subsystem's ref counter. */
+static void
+SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem)
+{
+    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+    if (SDL_SubsystemRefCount[subsystem_index] > 0) {
+        --SDL_SubsystemRefCount[subsystem_index];
+    }
+}
+
+/* Private helper to check if a system needs init. */
+static SDL_bool
+SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
+{
+    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+    SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
+    return (SDL_SubsystemRefCount[subsystem_index] == 0);
+}
+
+/* Private helper to check if a system needs to be quit. */
+static SDL_bool
+SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) {
+    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+    if (SDL_SubsystemRefCount[subsystem_index] == 0) {
+      return SDL_FALSE;
+    }
+
+    /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
+     * isn't zero.
+     */
+    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
+}
+
+void
+SDL_SetMainReady(void)
+{
+    SDL_MainIsReady = SDL_TRUE;
+}
 
 int
 SDL_InitSubSystem(Uint32 flags)
 {
+    if (!SDL_MainIsReady) {
+        SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
+        return -1;
+    }
+
 #if !SDL_TIMERS_DISABLED
+    SDL_InitTicks();
+#endif
+
     /* Initialize the timer subsystem */
-    if (!ticks_started) {
-        SDL_StartTicks();
-        ticks_started = 1;
-    }
-    if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) {
-        if (SDL_TimerInit() < 0) {
-            return (-1);
+    if ((flags & SDL_INIT_TIMER) ){
+#if !SDL_TIMERS_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
+            if (SDL_TimerInit() < 0) {
+                return (-1);
+            }
         }
-        SDL_initialized |= SDL_INIT_TIMER;
-    }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER);
 #else
-    if (flags & SDL_INIT_TIMER) {
-        SDL_SetError("SDL not built with timer support");
-        return (-1);
-    }
+        return SDL_SetError("SDL not built with timer support");
 #endif
+    }
 
-#if !SDL_VIDEO_DISABLED
     /* Initialize the video/event subsystem */
-    if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
-        if (SDL_VideoInit(NULL) < 0) {
-            return (-1);
+    if ((flags & SDL_INIT_VIDEO) ){
+#if !SDL_VIDEO_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
+            if (SDL_VideoInit(NULL) < 0) {
+                return (-1);
+            }
         }
-        SDL_initialized |= SDL_INIT_VIDEO;
-    }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO);
 #else
-    if (flags & SDL_INIT_VIDEO) {
-        SDL_SetError("SDL not built with video support");
-        return (-1);
-    }
+        return SDL_SetError("SDL not built with video support");
 #endif
+    }
 
-#if !SDL_AUDIO_DISABLED
     /* Initialize the audio subsystem */
-    if ((flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO)) {
-        if (SDL_AudioInit(NULL) < 0) {
-            return (-1);
+    if ((flags & SDL_INIT_AUDIO) ){
+#if !SDL_AUDIO_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
+            if (SDL_AudioInit(NULL) < 0) {
+                return (-1);
+            }
         }
-        SDL_initialized |= SDL_INIT_AUDIO;
-    }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO);
 #else
-    if (flags & SDL_INIT_AUDIO) {
-        SDL_SetError("SDL not built with audio support");
-        return (-1);
-    }
+        return SDL_SetError("SDL not built with audio support");
 #endif
+    }
+
+    if ((flags & SDL_INIT_GAMECONTROLLER)) {
+        /* Game controller implies Joystick. */
+        flags |= SDL_INIT_JOYSTICK;
+    }
 
-#if !SDL_JOYSTICK_DISABLED
     /* Initialize the joystick subsystem */
-    if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) {
-        if (SDL_JoystickInit() < 0) {
-            return (-1);
+    if ((flags & SDL_INIT_JOYSTICK) ){
+#if !SDL_JOYSTICK_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
+           if (SDL_JoystickInit() < 0) {
+               return (-1);
+           }
         }
-        SDL_initialized |= SDL_INIT_JOYSTICK;
-    }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK);
 #else
-    if (flags & SDL_INIT_JOYSTICK) {
-        SDL_SetError("SDL not built with joystick support");
-        return (-1);
+        return SDL_SetError("SDL not built with joystick support");
+#endif
     }
+
+    if ((flags & SDL_INIT_GAMECONTROLLER) ){
+#if !SDL_JOYSTICK_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
+            if (SDL_GameControllerInit() < 0) {
+                return (-1);
+            }
+        }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
+#else
+        return SDL_SetError("SDL not built with joystick support");
 #endif
+    }
 
-#if !SDL_HAPTIC_DISABLED
     /* Initialize the haptic subsystem */
-    if ((flags & SDL_INIT_HAPTIC) && !(SDL_initialized & SDL_INIT_HAPTIC)) {
-        if (SDL_HapticInit() < 0) {
-            return (-1);
+    if ((flags & SDL_INIT_HAPTIC) ){
+#if !SDL_HAPTIC_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
+            if (SDL_HapticInit() < 0) {
+                return (-1);
+            }
         }
-        SDL_initialized |= SDL_INIT_HAPTIC;
-    }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC);
 #else
-    if (flags & SDL_INIT_HAPTIC) {
-        SDL_SetError("SDL not built with haptic (force feedback) support");
-        return (-1);
-    }
+        return SDL_SetError("SDL not built with haptic (force feedback) support");
 #endif
+    }
+
     return (0);
 }
 
@@ -143,7 +212,7 @@ SDL_Init(Uint32 flags)
     /* Clear the error message */
     SDL_ClearError();
 
-#if defined(__WIN32__)
+#if SDL_VIDEO_DRIVER_WINDOWS
     if (SDL_HelperWindowCreate() < 0) {
         return -1;
     }
@@ -167,33 +236,57 @@ SDL_QuitSubSystem(Uint32 flags)
 {
     /* Shut down requested initialized subsystems */
 #if !SDL_JOYSTICK_DISABLED
-    if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) {
-        SDL_JoystickQuit();
-        SDL_initialized &= ~SDL_INIT_JOYSTICK;
+    if ((flags & SDL_INIT_GAMECONTROLLER)) {
+        /* Game controller implies Joystick. */
+        flags |= SDL_INIT_JOYSTICK;
+
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
+            SDL_GameControllerQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER);
+    }
+
+    if ((flags & SDL_INIT_JOYSTICK)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) {
+            SDL_JoystickQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK);
     }
 #endif
+
 #if !SDL_HAPTIC_DISABLED
-    if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) {
-        SDL_HapticQuit();
-        SDL_initialized &= ~SDL_INIT_HAPTIC;
+    if ((flags & SDL_INIT_HAPTIC)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
+            SDL_HapticQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC);
     }
 #endif
+
 #if !SDL_AUDIO_DISABLED
-    if ((flags & SDL_initialized & SDL_INIT_AUDIO)) {
-        SDL_AudioQuit();
-        SDL_initialized &= ~SDL_INIT_AUDIO;
+    if ((flags & SDL_INIT_AUDIO)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
+            SDL_AudioQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO);
     }
 #endif
+
 #if !SDL_VIDEO_DISABLED
-    if ((flags & SDL_initialized & SDL_INIT_VIDEO)) {
-        SDL_VideoQuit();
-        SDL_initialized &= ~SDL_INIT_VIDEO;
+    if ((flags & SDL_INIT_VIDEO)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
+            SDL_VideoQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO);
     }
 #endif
+
 #if !SDL_TIMERS_DISABLED
-    if ((flags & SDL_initialized & SDL_INIT_TIMER)) {
-        SDL_TimerQuit();
-        SDL_initialized &= ~SDL_INIT_TIMER;
+    if ((flags & SDL_INIT_TIMER)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
+            SDL_TimerQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER);
     }
 #endif
 }
@@ -201,30 +294,52 @@ SDL_QuitSubSystem(Uint32 flags)
 Uint32
 SDL_WasInit(Uint32 flags)
 {
+    int i;
+    int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount);
+    Uint32 initialized = 0;
+
     if (!flags) {
         flags = SDL_INIT_EVERYTHING;
     }
-    return (SDL_initialized & flags);
+
+    num_subsystems = SDL_min(num_subsystems, SDL_MostSignificantBitIndex32(flags) + 1);
+
+    /* Iterate over each bit in flags, and check the matching subsystem. */
+    for (i = 0; i < num_subsystems; ++i) {
+        if ((flags & 1) && SDL_SubsystemRefCount[i] > 0) {
+            initialized |= (1 << i);
+        }
+
+        flags >>= 1;
+    }
+
+    return initialized;
 }
 
 void
 SDL_Quit(void)
 {
+    SDL_bInMainQuit = SDL_TRUE;
+
     /* Quit all subsystems */
-#if defined(__WIN32__)
+#if SDL_VIDEO_DRIVER_WINDOWS
     SDL_HelperWindowDestroy();
 #endif
     SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
 
-    // Urho3D: delete threading mutex now
-    SDL_ThreadsQuit();
-
     /* Uninstall any parachute signal handlers */
     SDL_UninstallParachute();
 
     SDL_ClearHints();
     SDL_AssertionsQuit();
     SDL_LogResetPriorities();
+
+    /* Now that every subsystem has been quit, we reset the subsystem refcount
+     * and the list of initialized subsystems.
+     */
+    SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) );
+
+    SDL_bInMainQuit = SDL_FALSE;
 }
 
 /* Get the library version number */
@@ -254,6 +369,8 @@ SDL_GetPlatform()
 {
 #if __AIX__
     return "AIX";
+#elif __ANDROID__
+    return "Android";
 #elif __HAIKU__
 /* Haiku must appear here before BeOS, since it also defines __BEOS__ */
     return "Haiku";
@@ -279,8 +396,6 @@ SDL_GetPlatform()
     return "Mac OS X";
 #elif __NETBSD__
     return "NetBSD";
-#elif __NDS__
-    return "Nintendo DS";
 #elif __OPENBSD__
     return "OpenBSD";
 #elif __OS2__
@@ -294,13 +409,11 @@ SDL_GetPlatform()
 #elif __SOLARIS__
     return "Solaris";
 #elif __WIN32__
-#ifdef _WIN32_WCE
-    return "Windows CE";
-#else
     return "Windows";
-#endif
 #elif __IPHONEOS__
     return "iPhone OS";
+#elif __PSP__
+    return "PlayStation Portable";
 #else
     return "Unknown (see SDL_platform.h)";
 #endif
@@ -329,4 +442,4 @@ _DllMainCRTStartup(HANDLE hModule,
 
 #endif /* __WIN32__ */
 
-/* vi: set ts=4 sw=4 expandtab: */
+/* vi: set sts=4 ts=4 sw=4 expandtab: */

+ 83 - 191
ThirdParty/SDL/src/SDL_assert.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -22,6 +22,8 @@
 
 #include "SDL.h"
 #include "SDL_atomic.h"
+#include "SDL_messagebox.h"
+#include "SDL_video.h"
 #include "SDL_assert.h"
 #include "SDL_assert_c.h"
 #include "video/SDL_sysvideo.h"
@@ -59,160 +61,13 @@ debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
 static void
 debug_print(const char *fmt, ...)
 {
-#ifdef __WIN32__
-    /* Format into a buffer for OutputDebugStringA(). */
-    char buf[1024];
-    char *startptr;
-    char *ptr;
-    LPTSTR tstr;
-    int len;
     va_list ap;
     va_start(ap, fmt);
-    len = (int) SDL_vsnprintf(buf, sizeof (buf), fmt, ap);
+    SDL_LogMessageV(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_WARN, fmt, ap);
     va_end(ap);
-
-    /* Visual C's vsnprintf() may not null-terminate the buffer. */
-    if ((len >= sizeof (buf)) || (len < 0)) {
-        buf[sizeof (buf) - 1] = '\0';
-    }
-
-    /* Write it, sorting out the Unix newlines... */
-    startptr = buf;
-    for (ptr = startptr; *ptr; ptr++) {
-        if (*ptr == '\n') {
-            *ptr = '\0';
-            tstr = WIN_UTF8ToString(startptr);
-            OutputDebugString(tstr);
-            SDL_free(tstr);
-            OutputDebugString(TEXT("\r\n"));
-            startptr = ptr+1;
-        }
-    }
-
-    /* catch that last piece if it didn't have a newline... */
-    if (startptr != ptr) {
-        tstr = WIN_UTF8ToString(startptr);
-        OutputDebugString(tstr);
-        SDL_free(tstr);
-    }
-#else
-    /* Unix has it easy. Just dump it to stderr. */
-    va_list ap;
-    va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-    fflush(stderr);
-#endif
 }
 
 
-#ifdef __WIN32__
-static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
-static const SDL_assert_data *SDL_Windows_AssertData = NULL;
-
-static LRESULT CALLBACK
-SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (msg)
-    {
-        case WM_CREATE:
-        {
-            /* !!! FIXME: all this code stinks. */
-            const SDL_assert_data *data = SDL_Windows_AssertData;
-            char buf[1024];
-            LPTSTR tstr;
-            const int w = 100;
-            const int h = 25;
-            const int gap = 10;
-            int x = gap;
-            int y = 50;
-            int len;
-            int i;
-            static const struct { 
-                LPCTSTR name;
-                SDL_assert_state state;
-            } buttons[] = {
-                {TEXT("Abort"), SDL_ASSERTION_ABORT },
-                {TEXT("Break"), SDL_ASSERTION_BREAK },
-                {TEXT("Retry"), SDL_ASSERTION_RETRY },
-                {TEXT("Ignore"), SDL_ASSERTION_IGNORE },
-                {TEXT("Always Ignore"), SDL_ASSERTION_ALWAYS_IGNORE },
-            };
-
-            len = (int) SDL_snprintf(buf, sizeof (buf), 
-                         "Assertion failure at %s (%s:%d), triggered %u time%s:\r\n  '%s'",
-                         data->function, data->filename, data->linenum,
-                         data->trigger_count, (data->trigger_count == 1) ? "" : "s",
-                         data->condition);
-            if ((len < 0) || (len >= sizeof (buf))) {
-                buf[sizeof (buf) - 1] = '\0';
-            }
-
-            tstr = WIN_UTF8ToString(buf);
-            CreateWindow(TEXT("STATIC"), tstr,
-                         WS_VISIBLE | WS_CHILD | SS_LEFT,
-                         x, y, 550, 100,
-                         hwnd, (HMENU) 1, NULL, NULL);
-            SDL_free(tstr);
-            y += 110;
-
-            for (i = 0; i < (sizeof (buttons) / sizeof (buttons[0])); i++) {
-                CreateWindow(TEXT("BUTTON"), buttons[i].name,
-                         WS_VISIBLE | WS_CHILD,
-                         x, y, w, h,
-                         hwnd, (HMENU) buttons[i].state, NULL, NULL);
-                x += w + gap;
-            }
-            break;
-        }
-
-        case WM_COMMAND:
-            SDL_Windows_AssertChoice = ((SDL_assert_state) (LOWORD(wParam)));
-            SDL_Windows_AssertData = NULL;
-            break;
-
-        case WM_DESTROY:
-            SDL_Windows_AssertData = NULL;
-            break;
-    }
-
-    return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-static SDL_assert_state
-SDL_PromptAssertion_windows(const SDL_assert_data *data)
-{
-    HINSTANCE hInstance = 0;  /* !!! FIXME? */
-    HWND hwnd;
-    MSG msg;
-    WNDCLASS wc = {0};
-
-    SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
-    SDL_Windows_AssertData = data;
-
-    wc.lpszClassName = TEXT("SDL_assert");
-    wc.hInstance = hInstance ;
-    wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
-    wc.lpfnWndProc = SDL_Assertion_WndProc;
-    wc.hCursor = LoadCursor(0, IDC_ARROW);
-  
-    RegisterClass(&wc);
-    hwnd = CreateWindow(wc.lpszClassName, TEXT("SDL assertion failure"),
-                 WS_OVERLAPPEDWINDOW | WS_VISIBLE,
-                 150, 150, 570, 260, 0, 0, hInstance, 0);  
-
-    while (GetMessage(&msg, NULL, 0, 0) && (SDL_Windows_AssertData != NULL)) {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-    }
-
-    DestroyWindow(hwnd);
-    UnregisterClass(wc.lpszClassName, hInstance);
-    return SDL_Windows_AssertChoice;
-}
-#endif
-
-
 static void SDL_AddAssertionToReport(SDL_assert_data *data)
 {
     /* (data) is always a static struct defined with the assert macros, so
@@ -271,23 +126,49 @@ static void SDL_AbortAssertion(void)
 static SDL_assert_state
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 {
+#ifdef __WIN32__
+    #define ENDLINE "\r\n"
+#else
+    #define ENDLINE "\n"
+#endif
+
     const char *envr;
     SDL_assert_state state = SDL_ASSERTION_ABORT;
     SDL_Window *window;
+    SDL_MessageBoxData messagebox;
+    SDL_MessageBoxButtonData buttons[] = {
+        {   0,  SDL_ASSERTION_RETRY,            "Retry" },
+        {   0,  SDL_ASSERTION_BREAK,            "Break" },
+        {   0,  SDL_ASSERTION_ABORT,            "Abort" },
+        {   SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,
+                SDL_ASSERTION_IGNORE,           "Ignore" },
+        {   SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,
+                SDL_ASSERTION_ALWAYS_IGNORE,    "Always Ignore" }
+    };
+    char *message;
+    int selected;
 
     (void) userdata;  /* unused in default handler. */
 
-    debug_print("\n\n"
-                "Assertion failure at %s (%s:%d), triggered %u time%s:\n"
-                "  '%s'\n"
-                "\n",
-                data->function, data->filename, data->linenum,
-                data->trigger_count, (data->trigger_count == 1) ? "" : "s",
-                data->condition);
+    message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+    if (!message) {
+        /* Uh oh, we're in real trouble now... */
+        return SDL_ASSERTION_ABORT;
+    }
+    SDL_snprintf(message, SDL_MAX_LOG_MESSAGE,
+                 "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE
+                    "  '%s'",
+                 data->function, data->filename, data->linenum,
+                 data->trigger_count, (data->trigger_count == 1) ? "time" : "times",
+                 data->condition);
+
+    debug_print("\n\n%s\n\n", message);
 
     /* let env. variable override, so unit tests won't block in a GUI. */
     envr = SDL_getenv("SDL_ASSERT");
     if (envr != NULL) {
+        SDL_stack_free(message);
+
         if (SDL_strcmp(envr, "abort") == 0) {
             return SDL_ASSERTION_ABORT;
         } else if (SDL_strcmp(envr, "break") == 0) {
@@ -311,54 +192,65 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
         } else {
             /* !!! FIXME: ungrab the input if we're not fullscreen? */
             /* No need to mess with the window */
-            window = 0;
+            window = NULL;
         }
     }
 
-    /* platform-specific UI... */
-
-#ifdef __WIN32__
-    state = SDL_PromptAssertion_windows(data);
-
-#elif defined __MACOSX__ && defined SDL_VIDEO_DRIVER_COCOA
-    /* This has to be done in an Objective-C (*.m) file, so we call out. */
-    extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
-    state = SDL_PromptAssertion_cocoa(data);
-
-#else
-    /* this is a little hacky. */
-    for ( ; ; ) {
-        char buf[32];
-        fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
-        fflush(stderr);
-        if (fgets(buf, sizeof (buf), stdin) == NULL) {
-            break;
+    /* Show a messagebox if we can, otherwise fall back to stdio */
+    SDL_zero(messagebox);
+    messagebox.flags = SDL_MESSAGEBOX_WARNING;
+    messagebox.window = window;
+    messagebox.title = "Assertion Failed";
+    messagebox.message = message;
+    messagebox.numbuttons = SDL_arraysize(buttons);
+    messagebox.buttons = buttons;
+
+    if (SDL_ShowMessageBox(&messagebox, &selected) == 0) {
+        if (selected == -1) {
+            state = SDL_ASSERTION_IGNORE;
+        } else {
+            state = (SDL_assert_state)selected;
         }
+    }
+#ifdef HAVE_STDIO_H
+    else
+    {
+        /* this is a little hacky. */
+        for ( ; ; ) {
+            char buf[32];
+            fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
+            fflush(stderr);
+            if (fgets(buf, sizeof (buf), stdin) == NULL) {
+                break;
+            }
 
-        if (SDL_strcmp(buf, "a") == 0) {
-            state = SDL_ASSERTION_ABORT;
-            break;
-        } else if (SDL_strcmp(buf, "b") == 0) {
-            state = SDL_ASSERTION_BREAK;
-            break;
-        } else if (SDL_strcmp(buf, "r") == 0) {
-            state = SDL_ASSERTION_RETRY;
-            break;
-        } else if (SDL_strcmp(buf, "i") == 0) {
-            state = SDL_ASSERTION_IGNORE;
-            break;
-        } else if (SDL_strcmp(buf, "A") == 0) {
-            state = SDL_ASSERTION_ALWAYS_IGNORE;
-            break;
+            if (SDL_strcmp(buf, "a") == 0) {
+                state = SDL_ASSERTION_ABORT;
+                break;
+            } else if (SDL_strcmp(buf, "b") == 0) {
+                state = SDL_ASSERTION_BREAK;
+                break;
+            } else if (SDL_strcmp(buf, "r") == 0) {
+                state = SDL_ASSERTION_RETRY;
+                break;
+            } else if (SDL_strcmp(buf, "i") == 0) {
+                state = SDL_ASSERTION_IGNORE;
+                break;
+            } else if (SDL_strcmp(buf, "A") == 0) {
+                state = SDL_ASSERTION_ALWAYS_IGNORE;
+                break;
+            }
         }
     }
-#endif
+#endif /* HAVE_STDIO_H */
 
     /* Re-enter fullscreen mode */
     if (window) {
         SDL_RestoreWindow(window);
     }
 
+    SDL_stack_free(message);
+
     return state;
 }
 

+ 1 - 1
ThirdParty/SDL/src/SDL_assert_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 15 - 19
ThirdParty/SDL/src/SDL_error.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -31,12 +31,12 @@
 #if SDL_THREADS_DISABLED
 /* The default (non-thread-safe) global error variable */
 static SDL_error SDL_global_error;
-#define SDL_GetErrBuf()	(&SDL_global_error)
+#define SDL_GetErrBuf() (&SDL_global_error)
 #else
 extern SDL_error *SDL_GetErrBuf(void);
 #endif /* SDL_THREADS_DISABLED */
 
-#define SDL_ERRBUFIZE	1024
+#define SDL_ERRBUFIZE   1024
 
 /* Private functions */
 
@@ -49,15 +49,15 @@ SDL_LookupString(const char *key)
 
 /* Public functions */
 
-void
+int
 SDL_SetError(const char *fmt, ...)
 {
     va_list ap;
     SDL_error *error;
 
     /* Ignore call if invalid format pointer was passed */
-    if (fmt == NULL) return;
-    
+    if (fmt == NULL) return -1;
+
     /* Copy in the key, mark error as valid */
     error = SDL_GetErrBuf();
     error->error = 1;
@@ -112,6 +112,8 @@ SDL_SetError(const char *fmt, ...)
 
     /* If we are in debug mode, print out an error message */
     SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
+
+    return -1;
 }
 
 /* This function has a bit more overhead than most error functions
@@ -216,28 +218,22 @@ SDL_ClearError(void)
 }
 
 /* Very common errors go here */
-void
+int
 SDL_Error(SDL_errorcode code)
 {
     switch (code) {
     case SDL_ENOMEM:
-        SDL_SetError("Out of memory");
-        break;
+        return SDL_SetError("Out of memory");
     case SDL_EFREAD:
-        SDL_SetError("Error reading from datastream");
-        break;
+        return SDL_SetError("Error reading from datastream");
     case SDL_EFWRITE:
-        SDL_SetError("Error writing to datastream");
-        break;
+        return SDL_SetError("Error writing to datastream");
     case SDL_EFSEEK:
-        SDL_SetError("Error seeking in datastream");
-        break;
+        return SDL_SetError("Error seeking in datastream");
     case SDL_UNSUPPORTED:
-        SDL_SetError("That operation is not supported");
-        break;
+        return SDL_SetError("That operation is not supported");
     default:
-        SDL_SetError("Unknown SDL error");
-        break;
+        return SDL_SetError("Unknown SDL error");
     }
 }
 

+ 3 - 3
ThirdParty/SDL/src/SDL_error_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -27,8 +27,8 @@
 #ifndef _SDL_error_c_h
 #define _SDL_error_c_h
 
-#define ERR_MAX_STRLEN	128
-#define ERR_MAX_ARGS	5
+#define ERR_MAX_STRLEN  128
+#define ERR_MAX_ARGS    5
 
 typedef struct SDL_error
 {

+ 1 - 104
ThirdParty/SDL/src/SDL_fatal.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -20,108 +20,6 @@
 */
 #include "SDL_config.h"
 
-/* General fatal signal handling code for SDL */
-
-#ifdef HAVE_SIGNAL_H
-
-#include <signal.h>
-
-#include "SDL.h"
-#include "SDL_fatal.h"
-
-/* This installs some signal handlers for the more common fatal signals,
-   so that if the programmer is lazy, the app doesn't die so horribly if
-   the program crashes.
-*/
-
-static void
-SDL_Parachute(int sig)
-{
-    signal(sig, SIG_DFL);
-    SDL_Quit();
-    raise(sig);
-}
-
-static const int SDL_fatal_signals[] = {
-    SIGSEGV,
-#ifdef SIGBUS
-    SIGBUS,
-#endif
-#ifdef SIGFPE
-    SIGFPE,
-#endif
-#ifdef SIGQUIT
-    SIGQUIT,
-#endif
-    0
-};
-
-void
-SDL_InstallParachute(void)
-{
-    /* Set a handler for any fatal signal not already handled */
-    int i;
-#ifdef HAVE_SIGACTION
-    struct sigaction action;
-
-    for (i = 0; SDL_fatal_signals[i]; ++i) {
-        sigaction(SDL_fatal_signals[i], NULL, &action);
-        if (action.sa_handler == SIG_DFL) {
-            action.sa_handler = SDL_Parachute;
-            sigaction(SDL_fatal_signals[i], &action, NULL);
-        }
-    }
-#ifdef SIGALRM
-    /* Set SIGALRM to be ignored -- necessary on Solaris */
-    sigaction(SIGALRM, NULL, &action);
-    if (action.sa_handler == SIG_DFL) {
-        action.sa_handler = SIG_IGN;
-        sigaction(SIGALRM, &action, NULL);
-    }
-#endif
-#else
-    void (*ohandler) (int);
-
-    for (i = 0; SDL_fatal_signals[i]; ++i) {
-        ohandler = signal(SDL_fatal_signals[i], SDL_Parachute);
-        if (ohandler != SIG_DFL) {
-            signal(SDL_fatal_signals[i], ohandler);
-        }
-    }
-#endif /* HAVE_SIGACTION */
-    return;
-}
-
-void
-SDL_UninstallParachute(void)
-{
-    /* Remove a handler for any fatal signal handled */
-    int i;
-#ifdef HAVE_SIGACTION
-    struct sigaction action;
-
-    for (i = 0; SDL_fatal_signals[i]; ++i) {
-        sigaction(SDL_fatal_signals[i], NULL, &action);
-        if (action.sa_handler == SDL_Parachute) {
-            action.sa_handler = SIG_DFL;
-            sigaction(SDL_fatal_signals[i], &action, NULL);
-        }
-    }
-#else
-    void (*ohandler) (int);
-
-    for (i = 0; SDL_fatal_signals[i]; ++i) {
-        ohandler = signal(SDL_fatal_signals[i], SIG_DFL);
-        if (ohandler != SDL_Parachute) {
-            signal(SDL_fatal_signals[i], ohandler);
-        }
-    }
-#endif /* HAVE_SIGACTION */
-}
-
-#else
-
-/* No signals on this platform, nothing to do.. */
 
 void
 SDL_InstallParachute(void)
@@ -135,5 +33,4 @@ SDL_UninstallParachute(void)
     return;
 }
 
-#endif /* HAVE_SIGNAL_H */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
ThirdParty/SDL/src/SDL_fatal.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 5 - 6
ThirdParty/SDL/src/SDL_hints.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -41,14 +41,14 @@ SDL_bool
 SDL_RegisterHintChangedCb(const char *name, SDL_HintChangedCb hintCb)
 {
     SDL_Hint *hint;
-	
+
     for (hint = SDL_hints; hint; hint = hint->next) {
         if (SDL_strcmp(name, hint->name) == 0) {
             hint->callback = hintCb;
             return SDL_TRUE;
         }
     }
-	
+
     return SDL_FALSE;
 }
 
@@ -57,7 +57,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
                         SDL_HintPriority priority)
 {
     const char *env;
-    SDL_Hint *prev, *hint;
+    SDL_Hint *hint;
 
     if (!name || !value) {
         return SDL_FALSE;
@@ -68,8 +68,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
         return SDL_FALSE;
     }
 
-    prev = NULL;
-    for (hint = SDL_hints; hint; prev = hint, hint = hint->next) {
+    for (hint = SDL_hints; hint; hint = hint->next) {
         if (SDL_strcmp(name, hint->name) == 0) {
             if (priority < hint->priority) {
                 return SDL_FALSE;

+ 4 - 4
ThirdParty/SDL/src/SDL_hints_c.h

@@ -1,15 +1,15 @@
 /*
  Simple DirectMedia Layer
- Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
- 
+ Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
+
  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.
- 
+
  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:
- 
+
  1. The origin of this software must not be misrepresented; you must not
  claim that you wrote the original software. If you use this software
  in a product, an acknowledgment in the product documentation would be

+ 102 - 7
ThirdParty/SDL/src/SDL_log.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -35,7 +35,12 @@
 #endif
 
 #define DEFAULT_PRIORITY                SDL_LOG_PRIORITY_CRITICAL
+#define DEFAULT_ASSERT_PRIORITY         SDL_LOG_PRIORITY_WARN
 #define DEFAULT_APPLICATION_PRIORITY    SDL_LOG_PRIORITY_INFO
+#define DEFAULT_TEST_PRIORITY           SDL_LOG_PRIORITY_VERBOSE
+
+/* Forward definition of error function */
+extern int SDL_SetError(const char *fmt, ...);
 
 typedef struct SDL_LogLevel
 {
@@ -50,8 +55,10 @@ static void SDL_LogOutput(void *userdata,
                           const char *message);
 
 static SDL_LogLevel *SDL_loglevels;
-static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
 static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
+static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
+static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY;
 static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
 static void *SDL_log_userdata = NULL;
 
@@ -95,7 +102,9 @@ SDL_LogSetAllPriority(SDL_LogPriority priority)
     for (entry = SDL_loglevels; entry; entry = entry->next) {
         entry->priority = priority;
     }
-    SDL_application_priority = SDL_default_priority = priority;
+    SDL_default_priority = priority;
+    SDL_assert_priority = priority;
+    SDL_application_priority = priority;
 }
 
 void
@@ -131,8 +140,12 @@ SDL_LogGetPriority(int category)
         }
     }
 
-    if (category == SDL_LOG_CATEGORY_APPLICATION) {
+    if (category == SDL_LOG_CATEGORY_TEST) {
+        return SDL_test_priority;
+    } else if (category == SDL_LOG_CATEGORY_APPLICATION) {
         return SDL_application_priority;
+    } else if (category == SDL_LOG_CATEGORY_ASSERT) {
+        return SDL_assert_priority;
     } else {
         return SDL_default_priority;
     }
@@ -149,8 +162,10 @@ SDL_LogResetPriorities(void)
         SDL_free(entry);
     }
 
-    SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
     SDL_default_priority = DEFAULT_PRIORITY;
+    SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
+    SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+    SDL_test_priority = DEFAULT_TEST_PRIORITY;
 }
 
 void
@@ -276,6 +291,14 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
     SDL_stack_free(message);
 }
 
+#if defined(__WIN32__)
+/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
+static int consoleAttached = 0;
+
+/* Handle to stderr output of console. */
+static HANDLE stderrHandle = NULL;
+#endif
+
 static void
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
               const char *message)
@@ -286,12 +309,56 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         char *output;
         size_t length;
         LPTSTR tstr;
+        BOOL attachResult;
+        DWORD attachError;
+        unsigned long charsWritten; 
+
+        /* Maybe attach console and get stderr handle */
+        if (consoleAttached == 0) {
+            attachResult = AttachConsole(ATTACH_PARENT_PROCESS);
+            if (!attachResult) {
+                    attachError = GetLastError();
+                    if (attachError == ERROR_INVALID_HANDLE) {
+                        SDL_SetError("Parent process has no console");
+                        consoleAttached = -1;
+                    } else if (attachError == ERROR_GEN_FAILURE) {
+                         SDL_SetError("Could not attach to console of parent process");
+                         consoleAttached = -1;
+                    } else if (attachError == ERROR_ACCESS_DENIED) {  
+                         /* Already attached */
+                        consoleAttached = 1;
+                    } else {
+                        SDL_SetError("Error %d attaching console", attachError);
+                        consoleAttached = -1;
+                    }
+                } else {
+                    /* Newly attached */
+                    consoleAttached = 1;
+                }
+			
+                if (consoleAttached == 1) {
+                        stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
+                }
+        }
 
-        length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
+        length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1;
         output = SDL_stack_alloc(char, length);
-        SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
+        SDL_snprintf(output, length, "%s: %s\n", SDL_priority_prefixes[priority], message);
         tstr = WIN_UTF8ToString(output);
+        
+        /* Output to debugger */
         OutputDebugString(tstr);
+       
+        /* Screen output to stderr, if console was attached. */
+        if (consoleAttached == 1) {
+                if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
+                    SDL_SetError("Error %d calling WriteConsole", GetLastError());
+                }
+                if (charsWritten == ERROR_NOT_ENOUGH_MEMORY) {
+                    SDL_SetError("Insufficient heap memory to write message of size %d", length);
+                }
+        }
+
         SDL_free(tstr);
         SDL_stack_free(output);
     }
@@ -302,6 +369,34 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
         __android_log_write(SDL_android_priority[priority], tag, message);
     }
+#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
+    /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
+    */
+    extern void SDL_NSLog(const char *text);
+    {
+        char *text;
+
+        text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+        if (text) {
+            SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message);
+            SDL_NSLog(text);
+            SDL_stack_free(text);
+            return;
+        }
+    }
+#elif defined(__PSP__)
+    {
+        unsigned int length;
+        char*        output;
+        FILE*        pFile;
+        length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
+        output = SDL_stack_alloc(char, length);
+        SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
+        pFile = fopen ("SDL_Log.txt", "a");
+        fwrite (output, strlen (output), 1, pFile);
+        SDL_stack_free(output);
+        fclose (pFile);
+    }
 #endif
 #if HAVE_STDIO_H
     fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);

+ 10 - 8
ThirdParty/SDL/src/atomic/SDL_atomic.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -27,8 +27,10 @@
    doesn't have that compiler.  That way we always have a working set of
    atomic operations built into the library.
 */
- 
-/* 
+#undef SDL_AtomicCAS
+#undef SDL_AtomicCASPtr
+
+/*
   If any of the operations are not provided then we must emulate some
   of them. That means we need a nice implementation of spin locks
   that avoids the "one big lock" problem. We use a vector of spin
@@ -38,7 +40,7 @@
   To generate the index of the lock we first shift by 3 bits to get
   rid on the zero bits that result from 32 and 64 bit allignment of
   data. We then mask off all but 5 bits and use those 5 bits as an
-  index into the table. 
+  index into the table.
 
   Picking the lock this way insures that accesses to the same data at
   the same time will go to the same lock. OTOH, accesses to different
@@ -69,8 +71,8 @@ leaveLock(void *a)
     SDL_AtomicUnlock(&locks[index]);
 }
 
-SDL_bool
-SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
+DECLSPEC SDL_bool SDLCALL
+SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
 {
     SDL_bool retval = SDL_FALSE;
 
@@ -84,8 +86,8 @@ SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
     return retval;
 }
 
-SDL_bool
-SDL_AtomicCASPtr_(void **a, void *oldval, void *newval)
+DECLSPEC SDL_bool SDLCALL
+SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
 {
     SDL_bool retval = SDL_FALSE;
 

+ 9 - 9
ThirdParty/SDL/src/atomic/SDL_spinlock.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -41,13 +41,13 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
         /* Race condition on first lock... */
         _spinlock_mutex = SDL_CreateMutex();
     }
-    SDL_mutexP(_spinlock_mutex);
+    SDL_LockMutex(_spinlock_mutex);
     if (*lock == 0) {
         *lock = 1;
-        SDL_mutexV(_spinlock_mutex);
+        SDL_UnlockMutex(_spinlock_mutex);
         return SDL_TRUE;
     } else {
-        SDL_mutexV(_spinlock_mutex);
+        SDL_UnlockMutex(_spinlock_mutex);
         return SDL_FALSE;
     }
 
@@ -76,11 +76,11 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
     return (result == 0);
 
 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-	int result;
-	__asm__ __volatile__(
+    int result;
+    __asm__ __volatile__(
         "lock ; xchgl %0, (%1)\n"
         : "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
-	return (result == 0);
+    return (result == 0);
 
 #elif defined(__MACOSX__) || defined(__IPHONEOS__)
     /* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
@@ -114,10 +114,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
 
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
     __sync_lock_release(lock);
-    
+
 #elif HAVE_PTHREAD_SPINLOCK
     pthread_spin_unlock(lock);
-	
+
 #else
     *lock = 0;
 #endif

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.