Merged with latest SDL2 sources

This commit is contained in:
DavidLudwig
2012-09-01 07:19:49 -04:00
56 changed files with 2765 additions and 2548 deletions

View File

@@ -58,7 +58,7 @@ android-project/
AndroidManifest.xml - package manifest, do not modify
build.properties - empty
build.xml - build description file, used by ant
default.properties - holds the ABI for the application, currently android-4 which corresponds to the Android 1.6 system image
default.properties - holds the ABI for the application, currently android-5 which corresponds to the Android 2.0 system image
local.properties - holds the SDK path, you should change this to the path to your SDK
jni/ - directory holding native code
jni/Android.mk - Android makefile that includes all subdirectories
@@ -126,7 +126,7 @@ Once you've copied the SDL android project and customized it, you can create an
* Select the Android -> Android Project wizard and click Next
* Enter the name you'd like your project to have
* Select "Create project from existing source" and browse for your project directory
* Make sure the Build Target is set to Android 1.6
* Make sure the Build Target is set to Android 2.0
* Click Finish

View File

@@ -79,15 +79,15 @@ Finally, if your application completely redraws the screen each frame, you may f
Notes -- Keyboard
==============================================================================
SDL for iPhone contains several additional functions related to keyboard visibility. These functions are not part of the SDL standard API, but are necessary for revealing and hiding the iPhone's virtual onscreen keyboard.
The SDL keyboard API has been extended to support on-screen keyboards:
int SDL_iPhoneKeyboardShow(SDL_Window * window)
int SDL_ShowScreenKeyboard(SDL_Window * window)
-- reveals the onscreen keyboard. Returns 0 on success and -1 on error.
int SDL_iPhoneKeyboardHide(SDL_Window * window)
int SDL_HideScreenKeyboard(SDL_Window * window)
-- hides the onscreen keyboard. Returns 0 on success and -1 on error.
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window * window)
-- returns whether or not the onscreen keyboard is currently visible.
int SDL_iPhoneKeyboardToggle(SDL_Window * window)
int SDL_ToggleScreenKeyboard(SDL_Window * window)
-- toggles the visibility of the onscreen keyboard. Returns 0 on success and -1 on error.
==============================================================================

View File

@@ -15,12 +15,12 @@
FD15FD6B0E086911003BDF25 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
FD15FD6C0E086911003BDF25 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96ED30DEFC9C700FAF19F /* OpenGLES.framework */; };
FD15FD6D0E086911003BDF25 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */; };
FD1B48DD0E313255007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B49980E313261007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B499C0E313269007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B499E0E31326C007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B49A00E313270007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B49A20E313273007AB34E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FD5F9CE80E0E0741008E885B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
FD5F9CE90E0E0741008E885B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
FD5F9CEA0E0E0741008E885B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
@@ -56,7 +56,7 @@
FDB651FA0E43D1F300F688B5 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD925B180E0F276600E92347 /* Icon.png */; };
FDB651FB0E43D1F300F688B5 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD787AA00E22A5CC003E8E36 /* Default.png */; };
FDB651FD0E43D1F300F688B5 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; };
FDB652000E43D1F300F688B5 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL.a */; };
FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B489E0E313154007AB34E /* libSDL2.a */; };
FDB652020E43D1F300F688B5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
FDB652040E43D1F300F688B5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
@@ -215,7 +215,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B48DD0E313255007AB34E /* libSDL.a in Frameworks */,
FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */,
FDF0D7AB0E12D53800247964 /* CoreAudio.framework in Frameworks */,
FDF0D7AC0E12D53800247964 /* AudioToolbox.framework in Frameworks */,
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
@@ -230,7 +230,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B49980E313261007AB34E /* libSDL.a in Frameworks */,
FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */,
FDF0D7A90E12D53500247964 /* CoreAudio.framework in Frameworks */,
FDF0D7AA0E12D53500247964 /* AudioToolbox.framework in Frameworks */,
FD15FD690E086911003BDF25 /* Foundation.framework in Frameworks */,
@@ -245,7 +245,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B499C0E313269007AB34E /* libSDL.a in Frameworks */,
FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */,
FDF0D7A70E12D53200247964 /* CoreAudio.framework in Frameworks */,
FDF0D7A80E12D53200247964 /* AudioToolbox.framework in Frameworks */,
FD5F9CEB0E0E0741008E885B /* OpenGLES.framework in Frameworks */,
@@ -260,7 +260,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDB652000E43D1F300F688B5 /* libSDL.a in Frameworks */,
FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */,
FDB652020E43D1F300F688B5 /* Foundation.framework in Frameworks */,
FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */,
FDB652040E43D1F300F688B5 /* CoreGraphics.framework in Frameworks */,
@@ -275,7 +275,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B499E0E31326C007AB34E /* libSDL.a in Frameworks */,
FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */,
FDF0D7950E12D52900247964 /* CoreAudio.framework in Frameworks */,
FDF0D7960E12D52900247964 /* AudioToolbox.framework in Frameworks */,
FDC202E60E107B1200ABAC90 /* Foundation.framework in Frameworks */,
@@ -290,7 +290,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B49A20E313273007AB34E /* libSDL.a in Frameworks */,
FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */,
FDC52ED40E2843D6008D768C /* Foundation.framework in Frameworks */,
FDC52ED50E2843D6008D768C /* UIKit.framework in Frameworks */,
FDC52ED60E2843D6008D768C /* CoreGraphics.framework in Frameworks */,
@@ -305,7 +305,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FD1B49A00E313270007AB34E /* libSDL.a in Frameworks */,
FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */,
FDF0D69C0E12D05400247964 /* Foundation.framework in Frameworks */,
FDF0D69D0E12D05400247964 /* UIKit.framework in Frameworks */,
FDF0D69E0E12D05400247964 /* CoreGraphics.framework in Frameworks */,
@@ -607,7 +607,7 @@
FD1B489E0E313154007AB34E /* libSDL.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSDL.a;
path = libSDL2.a;
remoteRef = FD1B489D0E313154007AB34E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};

View File

@@ -12,13 +12,6 @@
static SDL_Texture *texture; /* texture where we'll hold our font */
/* iPhone SDL addition keyboard related function definitions */
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window);
extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window *
window);
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window);
/* function declarations */
void cleanup(void);
void drawBlank(int x, int y);
@@ -296,14 +289,10 @@ main(int argc, char *argv[])
/* draw our updates to the screen */
SDL_RenderPresent(renderer);
break;
#ifdef __IPHONEOS__
case SDL_MOUSEBUTTONUP:
/* mouse up toggles onscreen keyboard visibility
this function is available ONLY on iPhone OS
*/
SDL_iPhoneKeyboardToggle(window);
/* mouse up toggles onscreen keyboard visibility */
SDL_ToggleScreenKeyboard(window);
break;
#endif
}
}
cleanup();

View File

@@ -8,7 +8,7 @@
/* Begin PBXBuildFile section */
046CEF7713254F23007AD51D /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
046CEF7B13254F23007AD51D /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
046CEF7C13254F23007AD51D /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
046CEF7D13254F23007AD51D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
046CEF7E13254F23007AD51D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -17,7 +17,7 @@
046CEF8113254F23007AD51D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
046CEF8213254F23007AD51D /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
046CEF8A13254F63007AD51D /* testgesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 046CEF8913254F63007AD51D /* testgesture.c */; };
047A63E213285C3200CD7973 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -27,7 +27,7 @@
047A63E913285C3200CD7973 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
047A63F113285CD100CD7973 /* checkkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 047A63F013285CD100CD7973 /* checkkeys.c */; };
56ED04FE118A8FE400A56AA6 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
56ED0502118A8FE400A56AA6 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
56ED0504118A8FE400A56AA6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
56ED0505118A8FE400A56AA6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -38,7 +38,7 @@
56ED0511118A904200A56AA6 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED0510118A904200A56AA6 /* testpower.c */; };
AAE7DEDC14CBB1E100DF1A0E /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
AAE7DEDE14CBB1E100DF1A0E /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A7840E2D0F1F00EA573E /* common.c */; };
AAE7DEE114CBB1E100DF1A0E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
AAE7DEE314CBB1E100DF1A0E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
AAE7DEE414CBB1E100DF1A0E /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -51,7 +51,7 @@
AAE7DFA014CBB54E00DF1A0E /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
AAE7DFA114CBB54E00DF1A0E /* sample.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AADE0E2D33C100EA573E /* sample.bmp */; };
AAE7DFA314CBB54E00DF1A0E /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A7840E2D0F1F00EA573E /* common.c */; };
AAE7DFA614CBB54E00DF1A0E /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
AAE7DFA714CBB54E00DF1A0E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
AAE7DFA814CBB54E00DF1A0E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
AAE7DFA914CBB54E00DF1A0E /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -112,24 +112,24 @@
FDAAC62A0E2D5960001DB1D8 /* testgles.c in Sources */ = {isa = PBXBuildFile; fileRef = FDAAC6290E2D5960001DB1D8 /* testgles.c */; };
FDAAC6390E2D59BE001DB1D8 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
FDAAC7780E2D7024001DB1D8 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A7840E2D0F1F00EA573E /* common.c */; };
FDBDE57C0E313445006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5810E313465006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5850E313495006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE58C0E3134F3006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE59B0E31356A006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE59F0E31358D006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5A90E3135C0006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5AE0E3135E6006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5B60E3135FE006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5BC0E31364D006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5C20E313663006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5C60E3136F1006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5C80E313702006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5CA0E313712006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5CC0E31372B006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5CE0E31373E006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE5D40E313789006BAC0B /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDC42FF40F0D866D009C87E1 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
FDC42FF60F0D866D009C87E1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
FDC42FF70F0D866D009C87E1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
FDC42FF80F0D866D009C87E1 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -322,7 +322,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
046CEF7B13254F23007AD51D /* libSDL.a in Frameworks */,
046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */,
046CEF7C13254F23007AD51D /* AudioToolbox.framework in Frameworks */,
046CEF7D13254F23007AD51D /* QuartzCore.framework in Frameworks */,
046CEF7E13254F23007AD51D /* OpenGLES.framework in Frameworks */,
@@ -337,7 +337,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
047A63E213285C3200CD7973 /* libSDL.a in Frameworks */,
047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */,
047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */,
047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */,
047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */,
@@ -352,7 +352,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5810E313465006BAC0B /* libSDL.a in Frameworks */,
FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */,
FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */,
FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */,
FDA8A8A10E2D111A00EA573E /* OpenGLES.framework in Frameworks */,
@@ -367,7 +367,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
56ED0502118A8FE400A56AA6 /* libSDL.a in Frameworks */,
56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */,
56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */,
56ED0504118A8FE400A56AA6 /* QuartzCore.framework in Frameworks */,
56ED0505118A8FE400A56AA6 /* OpenGLES.framework in Frameworks */,
@@ -382,7 +382,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AAE7DEE114CBB1E100DF1A0E /* libSDL.a in Frameworks */,
AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */,
AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */,
AAE7DEE314CBB1E100DF1A0E /* QuartzCore.framework in Frameworks */,
AAE7DEE414CBB1E100DF1A0E /* OpenGLES.framework in Frameworks */,
@@ -397,7 +397,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AAE7DFA614CBB54E00DF1A0E /* libSDL.a in Frameworks */,
AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */,
AAE7DFA714CBB54E00DF1A0E /* AudioToolbox.framework in Frameworks */,
AAE7DFA814CBB54E00DF1A0E /* QuartzCore.framework in Frameworks */,
AAE7DFA914CBB54E00DF1A0E /* OpenGLES.framework in Frameworks */,
@@ -412,7 +412,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5850E313495006BAC0B /* libSDL.a in Frameworks */,
FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */,
FDA8AAB10E2D330F00EA573E /* AudioToolbox.framework in Frameworks */,
FDA8AAB20E2D330F00EA573E /* QuartzCore.framework in Frameworks */,
FDA8AAB30E2D330F00EA573E /* OpenGLES.framework in Frameworks */,
@@ -427,7 +427,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE58C0E3134F3006BAC0B /* libSDL.a in Frameworks */,
FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */,
FDAAC3C30E2D47E6001DB1D8 /* AudioToolbox.framework in Frameworks */,
FDAAC3C40E2D47E6001DB1D8 /* QuartzCore.framework in Frameworks */,
FDAAC3C50E2D47E6001DB1D8 /* OpenGLES.framework in Frameworks */,
@@ -442,7 +442,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE59B0E31356A006BAC0B /* libSDL.a in Frameworks */,
FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */,
FDAAC5910E2D5429001DB1D8 /* AudioToolbox.framework in Frameworks */,
FDAAC5920E2D5429001DB1D8 /* QuartzCore.framework in Frameworks */,
FDAAC5930E2D5429001DB1D8 /* OpenGLES.framework in Frameworks */,
@@ -457,7 +457,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE59F0E31358D006BAC0B /* libSDL.a in Frameworks */,
FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */,
FDAAC5BF0E2D55B5001DB1D8 /* AudioToolbox.framework in Frameworks */,
FDAAC5C00E2D55B5001DB1D8 /* QuartzCore.framework in Frameworks */,
FDAAC5C10E2D55B5001DB1D8 /* OpenGLES.framework in Frameworks */,
@@ -472,7 +472,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE57C0E313445006BAC0B /* libSDL.a in Frameworks */,
FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */,
FDAAC61C0E2D5914001DB1D8 /* AudioToolbox.framework in Frameworks */,
FDAAC61D0E2D5914001DB1D8 /* QuartzCore.framework in Frameworks */,
FDAAC61E0E2D5914001DB1D8 /* OpenGLES.framework in Frameworks */,
@@ -487,7 +487,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDC42FF40F0D866D009C87E1 /* libSDL.a in Frameworks */,
FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */,
FDC42FF60F0D866D009C87E1 /* AudioToolbox.framework in Frameworks */,
FDC42FF70F0D866D009C87E1 /* QuartzCore.framework in Frameworks */,
FDC42FF80F0D866D009C87E1 /* OpenGLES.framework in Frameworks */,
@@ -502,7 +502,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5A90E3135C0006BAC0B /* libSDL.a in Frameworks */,
FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */,
FDD2C1000E2E4F4B00B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C1010E2E4F4B00B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C1020E2E4F4B00B7A85F /* OpenGLES.framework in Frameworks */,
@@ -517,7 +517,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5AE0E3135E6006BAC0B /* libSDL.a in Frameworks */,
FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */,
FDD2C1770E2E52C000B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C1780E2E52C000B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C1790E2E52C000B7A85F /* OpenGLES.framework in Frameworks */,
@@ -532,7 +532,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5B60E3135FE006BAC0B /* libSDL.a in Frameworks */,
FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */,
FDD2C19B0E2E534F00B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C19C0E2E534F00B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C19D0E2E534F00B7A85F /* OpenGLES.framework in Frameworks */,
@@ -547,7 +547,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5BC0E31364D006BAC0B /* libSDL.a in Frameworks */,
FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */,
FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C4560E2E773800B7A85F /* OpenGLES.framework in Frameworks */,
@@ -562,7 +562,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5C20E313663006BAC0B /* libSDL.a in Frameworks */,
FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */,
FDD2C4720E2E77D700B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C4730E2E77D700B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C4740E2E77D700B7A85F /* OpenGLES.framework in Frameworks */,
@@ -577,7 +577,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5C60E3136F1006BAC0B /* libSDL.a in Frameworks */,
FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */,
FDD2C5010E2E7F4800B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C5020E2E7F4800B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C5030E2E7F4800B7A85F /* OpenGLES.framework in Frameworks */,
@@ -592,7 +592,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5C80E313702006BAC0B /* libSDL.a in Frameworks */,
FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */,
FDD2C51F0E2E807600B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C5200E2E807600B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C5210E2E807600B7A85F /* OpenGLES.framework in Frameworks */,
@@ -607,7 +607,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5CA0E313712006BAC0B /* libSDL.a in Frameworks */,
FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */,
FDD2C5440E2E80E400B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C5450E2E80E400B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C5460E2E80E400B7A85F /* OpenGLES.framework in Frameworks */,
@@ -622,7 +622,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5CC0E31372B006BAC0B /* libSDL.a in Frameworks */,
FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */,
FDD2C57D0E2E8C7400B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C57E0E2E8C7400B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C57F0E2E8C7400B7A85F /* OpenGLES.framework in Frameworks */,
@@ -637,7 +637,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5CE0E31373E006BAC0B /* libSDL.a in Frameworks */,
FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */,
FDD2C5BB0E2E8CFC00B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C5BC0E2E8CFC00B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C5BD0E2E8CFC00B7A85F /* OpenGLES.framework in Frameworks */,
@@ -652,7 +652,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FDBDE5D40E313789006BAC0B /* libSDL.a in Frameworks */,
FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */,
FDD2C6EA0E2E959E00B7A85F /* AudioToolbox.framework in Frameworks */,
FDD2C6EB0E2E959E00B7A85F /* QuartzCore.framework in Frameworks */,
FDD2C6EC0E2E959E00B7A85F /* OpenGLES.framework in Frameworks */,
@@ -711,7 +711,7 @@
FD1B48AD0E3131CA007AB34E /* Products */ = {
isa = PBXGroup;
children = (
FD1B48B80E3131CA007AB34E /* libSDL.a */,
FD1B48B80E3131CA007AB34E /* libSDL2.a */,
0466EE7011E565E4000198A4 /* testsdl.app */,
);
name = Products;
@@ -1234,10 +1234,10 @@
remoteRef = 0466EE6F11E565E4000198A4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FD1B48B80E3131CA007AB34E /* libSDL.a */ = {
FD1B48B80E3131CA007AB34E /* libSDL2.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSDL.a;
path = libSDL2.a;
remoteRef = FD1B48B70E3131CA007AB34E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};

View File

@@ -3,6 +3,9 @@
package="org.libsdl.app"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="5" />
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="SDLActivity"
android:label="@string/app_name">

View File

@@ -9,6 +9,7 @@ import javax.microedition.khronos.egl.*;
import android.app.*;
import android.content.*;
import android.view.*;
import android.view.inputmethod.InputMethodManager;
import android.os.*;
import android.util.Log;
import android.graphics.*;
@@ -106,13 +107,33 @@ public class SDLActivity extends Activity {
}
// Messages from the SDLMain thread
static int COMMAND_CHANGE_TITLE = 1;
static final int COMMAND_CHANGE_TITLE = 1;
static final int COMMAND_KEYBOARD_SHOW = 2;
// Handler for the messages
Handler commandHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.arg1 == COMMAND_CHANGE_TITLE) {
switch (msg.arg1) {
case COMMAND_CHANGE_TITLE:
setTitle((String)msg.obj);
break;
case COMMAND_KEYBOARD_SHOW:
InputMethodManager manager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (manager != null) {
switch (((Integer)msg.obj).intValue()) {
case 0:
manager.hideSoftInputFromWindow(mSurface.getWindowToken(), 0);
break;
case 1:
manager.showSoftInput(mSurface, 0);
break;
case 2:
manager.toggleSoftInputFromWindow(mSurface.getWindowToken(), 0, 0);
break;
}
}
break;
}
}
};
@@ -155,6 +176,10 @@ public class SDLActivity extends Activity {
mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
}
public static void sendMessage(int command, int param) {
mSingleton.sendCommand(command, Integer.valueOf(param));
}
public static Context getContext() {
return mSingleton;
}
@@ -424,6 +449,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// Sensors
private static SensorManager mSensorManager;
// Keep track of the surface size to normalize touch events
private static float mWidth, mHeight;
// Startup
public SDLSurface(Context context) {
super(context);
@@ -435,7 +463,11 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
setOnKeyListener(this);
setOnTouchListener(this);
mSensorManager = (SensorManager)context.getSystemService("sensor");
mSensorManager = (SensorManager)context.getSystemService("sensor");
// Some arbitrary defaults to avoid a potential division by zero
mWidth = 1.0f;
mHeight = 1.0f;
}
// Called when we have a valid drawing surface
@@ -504,6 +536,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
Log.v("SDL", "pixel format unknown " + format);
break;
}
mWidth = (float) width;
mHeight = (float) height;
SDLActivity.onNativeResize(width, height, sdlFormat);
Log.v("SDL", "Window size:" + width + "x"+height);
@@ -539,12 +574,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
final int touchDevId = event.getDeviceId();
final int pointerCount = event.getPointerCount();
// touchId, pointerId, action, x, y, pressure
int actionPointerIndex = event.getActionIndex();
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.getActionMasked();
int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */
float x = event.getX(actionPointerIndex);
float y = event.getY(actionPointerIndex);
float x = event.getX(actionPointerIndex) / mWidth;
float y = event.getY(actionPointerIndex) / mHeight;
float p = event.getPressure(actionPointerIndex);
if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
@@ -552,8 +587,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// 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);
}
@@ -590,4 +625,3 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}

View File

@@ -1,7 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)
AC_CONFIG_HEADER(include/SDL_config.h)
AC_GNU_SOURCE
AC_CONFIG_AUX_DIR(build-scripts)
AC_CONFIG_MACRO_DIR([acinclude])
@@ -1045,8 +1044,13 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
*-*-openbsd*)
x11_lib='libX11.so'
x11ext_lib='libXext.so'
xrender_lib='libXrender.so'
xcursor_lib='libXcursor.so'
xinerama_lib='libXinerama.so'
xinput_lib='libXi.so'
xrandr_lib='libXrandr.so'
xrender_lib='libXrender.so'
xss_lib='libXss.so'
xvidmode_lib='libXxf86vm.so'
;;
*)
x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]

View File

@@ -139,17 +139,23 @@
#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
/*
not included with Mac OS X at the moment...
#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 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

View File

@@ -171,6 +171,78 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
/**
* \brief Returns whether the platform has some screen keyboard support.
*
* \param window The window for which screen keyboard should be checked.
*
* \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_ShowScreenKeyboard()
* \sa SDL_HideScreenKeyboard()
* \sa SDL_IsScreenKeyboardShown()
* \sa SDL_ToggleScreenKeyboard()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(SDL_Window *window);
/**
* \brief Requests to show a screen keyboard for given window.
*
* \param window The window for which screen keyboard should be shown.
*
* \return 0 if request will be processed or -1 on error (e.g. no support).
*
* \note Showing screen keyboards is asynchronous on some platforms.
*
* \sa SDL_HasScreenKeyboardSupport()
* \sa SDL_HideScreenKeyboard()
*/
extern DECLSPEC int SDLCALL SDL_ShowScreenKeyboard(SDL_Window *window);
/**
* \brief Requests to hide a screen keyboard for given window.
*
* \param window The window for which screen keyboard should be shown.
*
* \return 0 if request will be processed or -1 on error (e.g. no support).
*
* \note Hiding screen keyboards is asynchronous on some platforms.
*
* \sa SDL_HasScreenKeyboardSupport()
* \sa SDL_ShowScreenKeyboard()
*/
extern DECLSPEC int SDLCALL SDL_HideScreenKeyboard(SDL_Window *window);
/**
* \brief Requests to toggle a screen keyboard for given window.
*
* \param window The window for which screen keyboard should be toggled.
*
* \return 0 if request will be processed or -1 on error (e.g. no support).
*
* \note Showing and hiding screen keyboards is asynchronous on some platforms.
*
* \sa SDL_HasScreenKeyboardSupport()
* \sa SDL_IsScreenKeyboardShown()
*/
extern DECLSPEC int SDLCALL SDL_ToggleScreenKeyboard(SDL_Window * window);
/**
* \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.
*
* \note May always return SDL_FALSE on some platforms (not implemented there).
*
* \sa SDL_HasScreenKeyboardSupport()
* \sa SDL_ShowScreenKeyboard()
* \sa SDL_HideScreenKeyboard()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@@ -30,6 +30,11 @@
#include "SDL_stdinc.h"
#if __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
@@ -40,15 +45,13 @@ extern "C" {
#if __IPHONEOS__
#include "SDL_video.h"
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);
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardHide(SDL_Window * window);
extern DECLSPEC SDL_bool SDLCALL SDL_iPhoneKeyboardIsShown(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window);
#define SDL_iPhoneKeyboardShow SDL_ShowScreenKeyboard
#define SDL_iPhoneKeyboardHide SDL_HideScreenKeyboard
#define SDL_iPhoneKeyboardToggle SDL_ToggleScreenKeyboard
#define SDL_iPhoneKeyboardIsShown SDL_IsScreenKeyboardShown
#endif

View File

@@ -185,21 +185,23 @@ typedef enum
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;
@@ -789,7 +791,9 @@ 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.
*
@@ -801,8 +805,10 @@ 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.
* 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()
*/

View File

@@ -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;

View File

@@ -314,7 +314,6 @@ SDL_RunAudio(void *devicep)
int stream_len;
void *udata;
void (SDLCALL * fill) (void *userdata, Uint8 * stream, int len);
int silence;
Uint32 delay;
/* For streaming when the buffer sizes don't match up */
Uint8 *istream;
@@ -335,12 +334,6 @@ SDL_RunAudio(void *devicep)
device->use_streamer = 0;
if (device->convert.needed) {
if (device->convert.src_format == AUDIO_U8) {
silence = 0x80;
} else {
silence = 0;
}
#if 0 /* !!! FIXME: I took len_div out of the structure. Use rate_incr instead? */
/* If the result of the conversion alters the length, i.e. resampling is being used, use the streamer */
if (device->convert.len_mult != 1 || device->convert.len_div != 1) {
@@ -367,7 +360,6 @@ SDL_RunAudio(void *devicep)
/* stream_len = device->convert.len; */
stream_len = device->spec.size;
} else {
silence = device->spec.silence;
stream_len = device->spec.size;
}

View File

@@ -49,7 +49,6 @@ static int
InitMS_ADPCM(WaveFMT * format)
{
Uint8 *rogue_feel;
Uint16 extra_info;
int i;
/* Set the rogue pointer to the MS_ADPCM specific data */
@@ -62,7 +61,7 @@ InitMS_ADPCM(WaveFMT * format)
SDL_SwapLE16(format->bitspersample);
rogue_feel = (Uint8 *) format + sizeof(*format);
if (sizeof(*format) == 16) {
extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
/*const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);*/
rogue_feel += sizeof(Uint16);
}
MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
@@ -233,7 +232,6 @@ static int
InitIMA_ADPCM(WaveFMT * format)
{
Uint8 *rogue_feel;
Uint16 extra_info;
/* Set the rogue pointer to the IMA_ADPCM specific data */
IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
@@ -245,7 +243,7 @@ InitIMA_ADPCM(WaveFMT * format)
SDL_SwapLE16(format->bitspersample);
rogue_feel = (Uint8 *) format + sizeof(*format);
if (sizeof(*format) == 16) {
extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
/*const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);*/
rogue_feel += sizeof(Uint16);
}
IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
@@ -424,6 +422,8 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
/* FMT chunk */
WaveFMT *format = NULL;
SDL_zero(chunk);
/* Make sure we are passed a valid data source */
was_error = 0;
if (src == NULL) {

View File

@@ -735,6 +735,21 @@ extern "C" int Android_JNI_FileClose(SDL_RWops* ctx)
return Android_JNI_FileClose(ctx, true);
}
// sends message to be handled on the UI event dispatch thread
extern "C" int Android_JNI_SendMessage(int command, int param)
{
JNIEnv *env = Android_JNI_GetEnv();
if (!env) {
return -1;
}
jmethodID mid = env->GetStaticMethodID(mActivityClass, "sendMessage", "(II)V");
if (!mid) {
return -1;
}
env->CallStaticVoidMethod(mActivityClass, mid, command, param);
return 0;
}
#endif /* __ANDROID__ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -53,6 +53,9 @@ static void Android_JNI_ThreadDestroyed(void*);
JNIEnv *Android_JNI_GetEnv(void);
int Android_JNI_SetupThread(void);
// Generic messages
int Android_JNI_SendMessage(int command, int param);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */

View File

@@ -766,7 +766,6 @@ SDL_HapticRumbleInit(SDL_Haptic * haptic)
int
SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length)
{
int ret;
SDL_HapticPeriodic *efx;
if (!ValidHaptic(haptic)) {
@@ -790,7 +789,7 @@ SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length)
efx = &haptic->rumble_effect.periodic;
efx->magnitude = (Sint16)(32767.0f*strength);
efx->length = length;
ret = SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect);
SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect);
return SDL_HapticRunEffect(haptic, haptic->rumble_id, 1);
}

View File

@@ -120,12 +120,7 @@ DI_SetError(const char *str, HRESULT err)
static int
DI_GUIDIsSame(const GUID * a, const GUID * b)
{
if (((a)->Data1 == (b)->Data1) &&
((a)->Data2 == (b)->Data2) &&
((a)->Data3 == (b)->Data3) &&
(SDL_strcmp((a)->Data4, (b)->Data4) == 0))
return 1;
return 0;
return (SDL_memcmp(a, b, sizeof (GUID)) == 0);
}

View File

@@ -76,7 +76,7 @@
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
#define MAX_UHID_JOYS 4
#define MAX_UHID_JOYS 16
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)

View File

@@ -582,7 +582,7 @@ JS_ConfigJoystick(SDL_Joystick * joystick, int fd)
{
SDL_bool handled;
unsigned char n;
int old_axes, tmp_naxes, tmp_nhats, tmp_nballs;
int tmp_naxes, tmp_nhats, tmp_nballs;
const char *name;
char *env, env_name[128];
int i;
@@ -602,7 +602,6 @@ JS_ConfigJoystick(SDL_Joystick * joystick, int fd)
}
name = SDL_SYS_JoystickName(joystick->index);
old_axes = joystick->naxes;
/* Generic analog joystick support */
if (SDL_strstr(name, "Analog") == name && SDL_strstr(name, "-hat")) {

View File

@@ -65,7 +65,6 @@ extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion,
static DIDEVICEINSTANCE SYS_Joystick[MAX_JOYSTICKS]; /* array to hold joystick ID values */
static char *SYS_JoystickNames[MAX_JOYSTICKS];
static int SYS_NumJoysticks;
static HINSTANCE DInputDLL = NULL;
/* local prototypes */

View File

@@ -546,11 +546,8 @@ int
SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g,
Uint8 * b)
{
SDL_Renderer *renderer;
CHECK_TEXTURE_MAGIC(texture, -1);
renderer = texture->renderer;
if (r) {
*r = texture->r;
}
@@ -1173,7 +1170,6 @@ int
SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect)
{
SDL_Window *window;
SDL_Rect real_srcrect;
SDL_Rect real_dstrect;
@@ -1184,7 +1180,6 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
SDL_SetError("Texture was not created with this renderer");
return -1;
}
window = renderer->window;
real_srcrect.x = 0;
real_srcrect.y = 0;
@@ -1237,7 +1232,6 @@ 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)
{
SDL_Window *window;
SDL_Rect real_srcrect, real_dstrect;
SDL_Point real_center;
@@ -1253,8 +1247,6 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
return -1;
}
window = renderer->window;
real_srcrect.x = 0;
real_srcrect.y = 0;
real_srcrect.w = texture->w;
@@ -1268,10 +1260,10 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
/* We don't intersect the dstrect with the viewport as RenderCopy does because of potential rotation clipping issues... TODO: should we? */
if (dstrect) real_dstrect = *dstrect;
else {
real_srcrect.x = 0;
real_srcrect.y = 0;
real_srcrect.w = renderer->viewport.w;
real_srcrect.h = renderer->viewport.h;
real_dstrect.x = 0;
real_dstrect.y = 0;
real_dstrect.w = renderer->viewport.w;
real_dstrect.h = renderer->viewport.h;
}
if (texture->native) {
@@ -1291,7 +1283,6 @@ int
SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch)
{
SDL_Window *window;
SDL_Rect real_rect;
CHECK_RENDERER_MAGIC(renderer, -1);
@@ -1300,10 +1291,9 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
SDL_Unsupported();
return -1;
}
window = renderer->window;
if (!format) {
format = SDL_GetWindowPixelFormat(window);
format = SDL_GetWindowPixelFormat(renderer->window);
}
real_rect.x = renderer->viewport.x;

View File

@@ -682,8 +682,6 @@ static int
D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
SDL_Window *window = renderer->window;
D3DFORMAT display_format = renderdata->pparams.BackBufferFormat;
D3D_TextureData *data;
D3DPOOL pool;
DWORD usage;
@@ -731,7 +729,6 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
RECT d3drect;
D3DLOCKED_RECT locked;
const Uint8 *src;

View File

@@ -272,7 +272,7 @@ Assumes dst surface was allocated with the correct dimensions.
*/
void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
{
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
tColorY *pc, *sp;
int gap;
@@ -283,8 +283,6 @@ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int
yd = ((src->h - dst->h) << 15);
ax = (cx << 16) - (icos * cx);
ay = (cy << 16) - (isin * cx);
sw = src->w - 1;
sh = src->h - 1;
pc = (tColorY*) dst->pixels;
gap = dst->pitch - dst->w;
/*

View File

@@ -1270,9 +1270,8 @@ RLEColorkeySurface(SDL_Surface * surface)
Uint8 *rlebuf, *dst;
int maxn;
int y;
Uint8 *srcbuf, *curbuf, *lastline;
Uint8 *srcbuf, *lastline;
int maxsize = 0;
int skip, run;
int bpp = surface->format->BytesPerPixel;
getpix_func getpix;
Uint32 ckey, rgbmask;
@@ -1306,9 +1305,7 @@ RLEColorkeySurface(SDL_Surface * surface)
/* Set up the conversion */
srcbuf = (Uint8 *) surface->pixels;
curbuf = srcbuf;
maxn = bpp == 4 ? 65535 : 255;
skip = run = 0;
dst = rlebuf;
rgbmask = ~surface->format->Amask;
ckey = surface->map->info.colorkey & rgbmask;

View File

@@ -67,23 +67,23 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
/* The Win32 BMP file header (14 bytes) */
char magic[2];
Uint32 bfSize;
Uint16 bfReserved1;
Uint16 bfReserved2;
Uint32 bfOffBits;
/*Uint32 bfSize = 0;*/
/*Uint16 bfReserved1 = 0;*/
/*Uint16 bfReserved2 = 0;*/
Uint32 bfOffBits = 0;
/* The Win32 BITMAPINFOHEADER struct (40 bytes) */
Uint32 biSize;
Sint32 biWidth;
Sint32 biHeight;
Uint16 biPlanes;
Uint16 biBitCount;
Uint32 biCompression;
Uint32 biSizeImage;
Sint32 biXPelsPerMeter;
Sint32 biYPelsPerMeter;
Uint32 biClrUsed;
Uint32 biClrImportant;
Uint32 biSize = 0;
Sint32 biWidth = 0;
Sint32 biHeight = 0;
/*Uint16 biPlanes = 0;*/
Uint16 biBitCount = 0;
Uint32 biCompression = 0;
/*Uint32 biSizeImage = 0;*/
/*Sint32 biXPelsPerMeter = 0;*/
/*Sint32 biYPelsPerMeter = 0;*/
Uint32 biClrUsed = 0;
/*Uint32 biClrImportant = 0;*/
/* Make sure we are passed a valid data source */
surface = NULL;
@@ -106,9 +106,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
was_error = SDL_TRUE;
goto done;
}
bfSize = SDL_ReadLE32(src);
bfReserved1 = SDL_ReadLE16(src);
bfReserved2 = SDL_ReadLE16(src);
/*bfSize =*/ SDL_ReadLE32(src);
/*bfReserved1 =*/ SDL_ReadLE16(src);
/*bfReserved2 =*/ SDL_ReadLE16(src);
bfOffBits = SDL_ReadLE32(src);
/* Read the Win32 BITMAPINFOHEADER */
@@ -116,25 +116,20 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
if (biSize == 12) {
biWidth = (Uint32) SDL_ReadLE16(src);
biHeight = (Uint32) SDL_ReadLE16(src);
biPlanes = SDL_ReadLE16(src);
/*biPlanes =*/ SDL_ReadLE16(src);
biBitCount = SDL_ReadLE16(src);
biCompression = BI_RGB;
biSizeImage = 0;
biXPelsPerMeter = 0;
biYPelsPerMeter = 0;
biClrUsed = 0;
biClrImportant = 0;
} else {
biWidth = SDL_ReadLE32(src);
biHeight = SDL_ReadLE32(src);
biPlanes = SDL_ReadLE16(src);
/*biPlanes =*/ SDL_ReadLE16(src);
biBitCount = SDL_ReadLE16(src);
biCompression = SDL_ReadLE32(src);
biSizeImage = SDL_ReadLE32(src);
biXPelsPerMeter = SDL_ReadLE32(src);
biYPelsPerMeter = SDL_ReadLE32(src);
/*biSizeImage =*/ SDL_ReadLE32(src);
/*biXPelsPerMeter =*/ SDL_ReadLE32(src);
/*biYPelsPerMeter =*/ SDL_ReadLE32(src);
biClrUsed = SDL_ReadLE32(src);
biClrImportant = SDL_ReadLE32(src);
/*biClrImportant =*/ SDL_ReadLE32(src);
}
if (biHeight < 0) {
topDown = SDL_TRUE;

View File

@@ -209,7 +209,6 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect,
int src_locked;
int dst_locked;
int pos, inc;
int dst_width;
int dst_maxrow;
int src_row, dst_row;
Uint8 *srcp = NULL;
@@ -286,7 +285,6 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect,
inc = (srcrect->h << 16) / dstrect->h;
src_row = srcrect->y;
dst_row = dstrect->y;
dst_width = dstrect->w * bpp;
#ifdef USE_ASM_STRETCH
/* Write the opcodes for this stretch */

View File

@@ -912,6 +912,7 @@ int SDL_ConvertPixels(int width, int height,
SDL_PixelFormat src_fmt, dst_fmt;
SDL_BlitMap src_blitmap, dst_blitmap;
SDL_Rect rect;
void *nonconst_src = (void *) src;
/* Fast path for same format copy */
if (src_format == dst_format) {
@@ -942,7 +943,7 @@ int SDL_ConvertPixels(int width, int height,
return 0;
}
if (!SDL_CreateSurfaceOnStack(width, height, src_format, (void*)src,
if (!SDL_CreateSurfaceOnStack(width, height, src_format, nonconst_src,
src_pitch,
&src_surface, &src_fmt, &src_blitmap)) {
return -1;

View File

@@ -233,6 +233,13 @@ struct SDL_VideoDevice
void (*StopTextInput) (_THIS);
void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
/* Screen keyboard */
SDL_bool (*SDL_HasScreenKeyboardSupport) (_THIS, SDL_Window *window);
int (*SDL_ShowScreenKeyboard) (_THIS, SDL_Window *window);
int (*SDL_HideScreenKeyboard) (_THIS, SDL_Window *window);
int (*SDL_ToggleScreenKeyboard) (_THIS, SDL_Window *window);
SDL_bool (*SDL_IsScreenKeyboardShown) (_THIS, SDL_Window *window);
/* Clipboard */
int (*SetClipboardText) (_THIS, const char *text);
char * (*GetClipboardText) (_THIS);
@@ -273,6 +280,7 @@ struct SDL_VideoDevice
int flags;
int profile_mask;
int use_egl;
int share_with_current_context;
int retained_backing;
int driver_loaded;
char driver_path[256];

View File

@@ -505,6 +505,7 @@ SDL_VideoInit(const char *driver_name)
#endif
_this->gl_config.flags = 0;
_this->gl_config.profile_mask = 0;
_this->gl_config.share_with_current_context = 0;
/* Initialize the video subsystem */
if (_this->VideoInit(_this) < 0) {
@@ -2309,11 +2310,30 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
_this->gl_config.use_egl = value;
break;
case SDL_GL_CONTEXT_FLAGS:
if( value & ~(SDL_GL_CONTEXT_DEBUG_FLAG |
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG) ) {
SDL_SetError("Unknown OpenGL context flag %d", value);
retval = -1;
break;
}
_this->gl_config.flags = value;
break;
case SDL_GL_CONTEXT_PROFILE_MASK:
if( value != 0 &&
value != SDL_GL_CONTEXT_PROFILE_CORE &&
value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
value != SDL_GL_CONTEXT_PROFILE_ES ) {
SDL_SetError("Unknown OpenGL context profile %d", value);
retval = -1;
break;
}
_this->gl_config.profile_mask = value;
break;
case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
_this->gl_config.share_with_current_context = value;
break;
default:
SDL_SetError("Unknown OpenGL attribute");
retval = -1;
@@ -2475,6 +2495,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
*value = _this->gl_config.profile_mask;
return 0;
}
case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
{
*value = _this->gl_config.share_with_current_context;
return 0;
}
default:
SDL_SetError("Unknown OpenGL attribute");
return -1;
@@ -2578,16 +2603,13 @@ int
SDL_GL_GetSwapInterval(void)
{
if (!_this) {
SDL_UninitializedVideo();
return -1;
return 0;
} else if (_this->current_glctx == NULL) {
SDL_SetError("No OpenGL context has been made current");
return -1;
return 0;
} else if (_this->GL_GetSwapInterval) {
return _this->GL_GetSwapInterval(_this);
} else {
SDL_SetError("Getting the swap interval is not supported");
return -1;
return 0;
}
}
@@ -2756,4 +2778,49 @@ SDL_SetTextInputRect(SDL_Rect *rect)
}
}
SDL_bool
SDL_HasScreenKeyboardSupport(SDL_Window *window)
{
if (window && _this && _this->SDL_HasScreenKeyboardSupport) {
return _this->SDL_HasScreenKeyboardSupport(_this, window);
}
return SDL_FALSE;
}
int
SDL_ShowScreenKeyboard(SDL_Window *window)
{
if (window && _this && _this->SDL_ShowScreenKeyboard) {
return _this->SDL_ShowScreenKeyboard(_this, window);
}
return -1;
}
int
SDL_HideScreenKeyboard(SDL_Window *window)
{
if (window && _this && _this->SDL_HideScreenKeyboard) {
return _this->SDL_HideScreenKeyboard(_this, window);
}
return -1;
}
int
SDL_ToggleScreenKeyboard(SDL_Window *window)
{
if (window && _this && _this->SDL_ToggleScreenKeyboard) {
return _this->SDL_ToggleScreenKeyboard(_this, window);
}
return -1;
}
SDL_bool
SDL_IsScreenKeyboardShown(SDL_Window *window)
{
if (window && _this && _this->SDL_IsScreenKeyboardShown) {
return _this->SDL_IsScreenKeyboardShown(_this, window);
}
return SDL_FALSE;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -178,6 +178,40 @@ Android_OnKeyUp(int keycode)
return SDL_SendKeyboardKey(SDL_RELEASED, TranslateKeycode(keycode));
}
// has to fit Activity constant
#define COMMAND_KEYBOARD_SHOW 2
SDL_bool
Android_HasScreenKeyboardSupport(_THIS, SDL_Window * window)
{
return Android_Window ? SDL_TRUE : SDL_FALSE;
}
int
Android_ShowScreenKeyboard(_THIS, SDL_Window * window)
{
return Android_Window ? Android_JNI_SendMessage(COMMAND_KEYBOARD_SHOW, 1) : -1;
}
int
Android_HideScreenKeyboard(_THIS, SDL_Window * window)
{
return Android_Window ? Android_JNI_SendMessage(COMMAND_KEYBOARD_SHOW, 0) : -1;
}
int
Android_ToggleScreenKeyboard(_THIS, SDL_Window * window)
{
return Android_Window ? Android_JNI_SendMessage(COMMAND_KEYBOARD_SHOW, 2) : -1;
}
SDL_bool
Android_IsScreenKeyboardShown(_THIS, SDL_Window * window)
{
return SDL_FALSE;
}
#endif /* SDL_VIDEO_DRIVER_ANDROID */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -26,4 +26,10 @@ extern void Android_InitKeyboard();
extern int Android_OnKeyDown(int keycode);
extern int Android_OnKeyUp(int keycode);
extern SDL_bool Android_HasScreenKeyboardSupport(_THIS, SDL_Window * window);
extern int Android_ShowScreenKeyboard(_THIS, SDL_Window * window);
extern int Android_HideScreenKeyboard(_THIS, SDL_Window * window);
extern int Android_ToggleScreenKeyboard(_THIS, SDL_Window * window);
extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window);
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -55,10 +55,10 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio
memset( &touch, 0, sizeof(touch) );
touch.id = touchDeviceId;
touch.x_min = 0.0f;
touch.x_max = (float)Android_ScreenWidth;
touch.x_max = 1.0f;
touch.native_xres = touch.x_max - touch.x_min;
touch.y_min = 0.0f;
touch.y_max = (float)Android_ScreenHeight;
touch.y_max = 1.0f;
touch.native_yres = touch.y_max - touch.y_min;
touch.pressure_min = 0.0f;
touch.pressure_max = 1.0f;

View File

@@ -119,6 +119,13 @@ Android_CreateDevice(int devindex)
device->GL_SwapWindow = Android_GL_SwapWindow;
device->GL_DeleteContext = Android_GL_DeleteContext;
/* Screen keyboard */
device->SDL_HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport;
device->SDL_ShowScreenKeyboard = Android_ShowScreenKeyboard;
device->SDL_HideScreenKeyboard = Android_HideScreenKeyboard;
device->SDL_ToggleScreenKeyboard = Android_ToggleScreenKeyboard;
device->SDL_IsScreenKeyboardShown = Android_IsScreenKeyboardShown;
return device;
}

View File

@@ -102,9 +102,6 @@ CG_SetError(const char *prefix, CGDisplayErr result)
case kCGErrorCannotComplete:
error = "kCGErrorCannotComplete";
break;
case kCGErrorNameTooLong:
error = "kCGErrorNameTooLong";
break;
case kCGErrorNotImplemented:
error = "kCGErrorNotImplemented";
break;
@@ -114,9 +111,6 @@ CG_SetError(const char *prefix, CGDisplayErr result)
case kCGErrorTypeCheck:
error = "kCGErrorTypeCheck";
break;
case kCGErrorNoCurrentPoint:
error = "kCGErrorNoCurrentPoint";
break;
case kCGErrorInvalidOperation:
error = "kCGErrorInvalidOperation";
break;

View File

@@ -250,7 +250,7 @@ Cocoa_GL_GetSwapInterval(_THIS)
NSAutoreleasePool *pool;
NSOpenGLContext *nscontext;
GLint value;
int status;
int status = 0;
pool = [[NSAutoreleasePool alloc] init];
@@ -258,9 +258,6 @@ Cocoa_GL_GetSwapInterval(_THIS)
if (nscontext != nil) {
[nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval];
status = (int)value;
} else {
SDL_SetError("No current OpenGL context");
status = -1;
}
[pool release];

View File

@@ -250,8 +250,7 @@ DirectFB_GL_SetSwapInterval(_THIS, int interval)
int
DirectFB_GL_GetSwapInterval(_THIS)
{
SDL_Unsupported();
return -1;
return 0;
}
void

View File

@@ -796,15 +796,7 @@ PND_gl_setswapinterval(_THIS, int interval)
int
PND_gl_getswapinterval(_THIS)
{
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
if (phdata->egl_initialized != SDL_TRUE) {
SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
return -1;
}
/* Return default swap interval value */
return phdata->swapinterval;
return ((SDL_VideoData *) _this->driverdata)->swapinterval;
}
void

View File

@@ -89,6 +89,11 @@ UIKit_CreateDevice(int devindex)
device->DestroyWindow = UIKit_DestroyWindow;
device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
device->SDL_HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
device->SDL_ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
device->SDL_HideScreenKeyboard = UIKit_HideScreenKeyboard;
device->SDL_ToggleScreenKeyboard = UIKit_ToggleScreenKeyboard;
device->SDL_IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
/* OpenGL (ES) functions */
device->GL_MakeCurrent = UIKit_GL_MakeCurrent;

View File

@@ -60,6 +60,13 @@
- (void)hideKeyboard;
- (void)initializeKeyboard;
@property (readonly) BOOL keyboardVisible;
SDL_bool UIKit_HasScreenKeyboardSupport(_THIS, SDL_Window *window);
int UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
int UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
int UIKit_ToggleScreenKeyboard(_THIS, SDL_Window *window);
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
#endif
@end

View File

@@ -355,7 +355,17 @@ static SDL_uikitview * getWindowView(SDL_Window * window)
return view;
}
int SDL_iPhoneKeyboardShow(SDL_Window * window)
SDL_bool UIKit_HasScreenKeyboardSupport(_THIS, SDL_Window *window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return SDL_FALSE;
}
return SDL_TRUE;
}
int UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
@@ -366,7 +376,7 @@ int SDL_iPhoneKeyboardShow(SDL_Window * window)
return 0;
}
int SDL_iPhoneKeyboardHide(SDL_Window * window)
int UIKit_HideScreenKeyboard(_THIS, SDL_Window *window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
@@ -377,7 +387,7 @@ int SDL_iPhoneKeyboardHide(SDL_Window * window)
return 0;
}
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
@@ -387,49 +397,22 @@ SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
return view.keyboardVisible;
}
int SDL_iPhoneKeyboardToggle(SDL_Window * window)
int UIKit_ToggleScreenKeyboard(_THIS, SDL_Window *window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return -1;
}
if (SDL_iPhoneKeyboardIsShown(window)) {
SDL_iPhoneKeyboardHide(window);
if (UIKit_IsScreenKeyboardShown(_this, window)) {
UIKit_HideScreenKeyboard(_this, window);
}
else {
SDL_iPhoneKeyboardShow(window);
UIKit_ShowScreenKeyboard(_this, window);
}
return 0;
}
#else
/* stubs, used if compiled without keyboard support */
int SDL_iPhoneKeyboardShow(SDL_Window * window)
{
SDL_SetError("Not compiled with keyboard support");
return -1;
}
int SDL_iPhoneKeyboardHide(SDL_Window * window)
{
SDL_SetError("Not compiled with keyboard support");
return -1;
}
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
{
return 0;
}
int SDL_iPhoneKeyboardToggle(SDL_Window * window)
{
SDL_SetError("Not compiled with keyboard support");
return -1;
}
#endif /* SDL_IPHONE_KEYBOARD */
#endif /* SDL_VIDEO_DRIVER_UIKIT */

View File

@@ -95,7 +95,6 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
/* only one window on iOS, always shown */
window->flags &= ~SDL_WINDOW_HIDDEN;
window->flags |= SDL_WINDOW_SHOWN;
// SDL_WINDOW_BORDERLESS controls whether status bar is hidden.
// This is only set if the window is on the main screen. Other screens

View File

@@ -572,20 +572,20 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex)
#define pVerFixedInfo ((VS_FIXEDFILEINFO FAR*)lpVerData)
DWORD dwVer = pVerFixedInfo->dwFileVersionMS;
dwVer = (dwVer & 0x00ff0000) << 8 | (dwVer & 0x000000ff) << 16;
if (videodata->GetReadingString ||
dwLang == LANG_CHT && (
if ((videodata->GetReadingString) ||
((dwLang == LANG_CHT) && (
dwVer == MAKEIMEVERSION(4, 2) ||
dwVer == MAKEIMEVERSION(4, 3) ||
dwVer == MAKEIMEVERSION(4, 4) ||
dwVer == MAKEIMEVERSION(5, 0) ||
dwVer == MAKEIMEVERSION(5, 1) ||
dwVer == MAKEIMEVERSION(5, 2) ||
dwVer == MAKEIMEVERSION(6, 0))
dwVer == MAKEIMEVERSION(6, 0)))
||
dwLang == LANG_CHS && (
((dwLang == LANG_CHS) && (
dwVer == MAKEIMEVERSION(4, 1) ||
dwVer == MAKEIMEVERSION(4, 2) ||
dwVer == MAKEIMEVERSION(5, 3))) {
dwVer == MAKEIMEVERSION(5, 3)))) {
dwRet[0] = dwVer | dwLang;
dwRet[1] = pVerFixedInfo->dwFileVersionLS;
SDL_free(lpVerBuffer);
@@ -1050,7 +1050,6 @@ STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BO
if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
BSTR bstr;
if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) {
WCHAR *s = (WCHAR *)bstr;
SysFreeString(bstr);
}
preading->lpVtbl->Release(preading);
@@ -1133,7 +1132,7 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
{
static GUID TF_PROFILE_DAYI = {0x037B2C25, 0x480C, 0x4D7F, 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A};
static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE))

View File

@@ -61,6 +61,11 @@
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif
#ifndef WGL_EXT_create_context_es_profile
#define WGL_EXT_create_context_es_profile
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif
typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC,
HGLRC
hShareContext,
@@ -112,10 +117,8 @@ WIN_GL_LoadLibrary(_THIS, const char *path)
GetProcAddress(handle, "wglDeleteContext");
_this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
GetProcAddress(handle, "wglMakeCurrent");
_this->gl_data->wglSwapIntervalEXT = (void (WINAPI *) (int))
GetProcAddress(handle, "wglSwapIntervalEXT");
_this->gl_data->wglGetSwapIntervalEXT = (int (WINAPI *) (void))
GetProcAddress(handle, "wglGetSwapIntervalEXT");
_this->gl_data->wglShareLists = (BOOL(WINAPI *) (HGLRC, HGLRC))
GetProcAddress(handle, "wglShareLists");
if (!_this->gl_data->wglGetProcAddress ||
!_this->gl_data->wglCreateContext ||
@@ -341,7 +344,7 @@ WIN_GL_InitExtensions(_THIS, HDC hdc)
}
/* Check for WGL_ARB_pixel_format */
_this->gl_data->WGL_ARB_pixel_format = 0;
_this->gl_data->HAS_WGL_ARB_pixel_format = SDL_FALSE;
if (HasExtension("WGL_ARB_pixel_format", extensions)) {
_this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
(HDC, const int *,
@@ -354,16 +357,20 @@ WIN_GL_InitExtensions(_THIS, HDC hdc)
if ((_this->gl_data->wglChoosePixelFormatARB != NULL) &&
(_this->gl_data->wglGetPixelFormatAttribivARB != NULL)) {
_this->gl_data->WGL_ARB_pixel_format = 1;
_this->gl_data->HAS_WGL_ARB_pixel_format = SDL_TRUE;
}
}
/* Check for WGL_EXT_swap_control */
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
if (HasExtension("WGL_EXT_swap_control", extensions)) {
_this->gl_data->wglSwapIntervalEXT =
WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
_this->gl_data->wglGetSwapIntervalEXT =
WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
}
} else {
_this->gl_data->wglSwapIntervalEXT = NULL;
_this->gl_data->wglGetSwapIntervalEXT = NULL;
@@ -397,7 +404,7 @@ WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
WIN_GL_InitExtensions(_this, hdc);
if (_this->gl_data->WGL_ARB_pixel_format) {
if (_this->gl_data->HAS_WGL_ARB_pixel_format) {
_this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs,
1, &pixel_format,
&matching);
@@ -519,10 +526,22 @@ SDL_GLContext
WIN_GL_CreateContext(_THIS, SDL_Window * window)
{
HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
HGLRC context;
HGLRC context, share_context;
if (_this->gl_config.major_version < 3) {
if (_this->gl_config.share_with_current_context) {
share_context = (HGLRC)(_this->current_glctx);
} else {
share_context = 0;
}
if (_this->gl_config.major_version < 3 &&
_this->gl_config.profile_mask == 0 &&
_this->gl_config.flags == 0) {
/* Create legacy context */
context = _this->gl_data->wglCreateContext(hdc);
if( share_context != 0 ) {
_this->gl_data->wglShareLists(share_context, context);
}
} else {
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
HGLRC temp_context = _this->gl_data->wglCreateContext(hdc);
@@ -567,7 +586,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
attribs[iattr++] = 0;
/* Create the GL 3.x context */
context = wglCreateContextAttribsARB(hdc, 0, attribs);
context = wglCreateContextAttribsARB(hdc, share_context, attribs);
/* Delete the GL 2.x context */
_this->gl_data->wglDeleteContext(temp_context);
}
@@ -611,24 +630,29 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
int
WIN_GL_SetSwapInterval(_THIS, int interval)
{
if (_this->gl_data->wglSwapIntervalEXT) {
_this->gl_data->wglSwapIntervalEXT(interval);
return 0;
int retval = -1;
if ((interval < 0) && (!_this->gl_data->HAS_WGL_EXT_swap_control_tear)) {
SDL_SetError("Negative swap interval unsupported in this GL");
} else if (_this->gl_data->wglSwapIntervalEXT) {
if (_this->gl_data->wglSwapIntervalEXT(interval) == TRUE) {
retval = 0;
} else {
WIN_SetError("wglSwapIntervalEXT()");
}
} else {
SDL_Unsupported();
return -1;
}
return retval;
}
int
WIN_GL_GetSwapInterval(_THIS)
{
int retval = 0;
if (_this->gl_data->wglGetSwapIntervalEXT) {
return _this->gl_data->wglGetSwapIntervalEXT();
} else {
SDL_Unsupported();
return -1;
retval = _this->gl_data->wglGetSwapIntervalEXT();
}
return retval;
}
void

View File

@@ -27,12 +27,14 @@
struct SDL_GLDriverData
{
int WGL_ARB_pixel_format;
SDL_bool HAS_WGL_ARB_pixel_format;
SDL_bool HAS_WGL_EXT_swap_control_tear;
void *(WINAPI * wglGetProcAddress) (const char *proc);
HGLRC(WINAPI * wglCreateContext) (HDC hdc);
BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
const int *piAttribIList,
const FLOAT * pfAttribFList,
@@ -44,7 +46,7 @@ struct SDL_GLDriverData
UINT nAttributes,
const int *piAttributes,
int *piValues);
void (WINAPI * wglSwapIntervalEXT) (int interval);
BOOL (WINAPI * wglSwapIntervalEXT) (int interval);
int (WINAPI * wglGetSwapIntervalEXT) (void);
};

View File

@@ -65,11 +65,14 @@ Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
SDL_ShapeData *data;
HRGN mask_region = NULL;
if (shaper == NULL || shape == NULL)
if( (shaper == NULL) ||
(shape == NULL) ||
((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) ||
(shape->w != shaper->window->w) ||
(shape->h != shaper->window->h) ) {
return SDL_INVALID_SHAPE_ARGUMENT;
if(shape->format->Amask == 0 && shape_mode->mode != ShapeModeColorKey || shape->w != shaper->window->w || shape->h != shaper->window->h)
return SDL_INVALID_SHAPE_ARGUMENT;
}
data = (SDL_ShapeData*)shaper->driverdata;
if(data->mask_tree != NULL)
SDL_FreeShapeTree(&data->mask_tree);

View File

@@ -74,7 +74,6 @@ static int
SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
{
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_WindowData *data;
/* Allocate the window data */
@@ -193,7 +192,6 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
int
WIN_CreateWindow(_THIS, SDL_Window * window)
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
HWND hwnd;
RECT rect;
DWORD style = STYLE_BASIC;
@@ -344,7 +342,6 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
void
WIN_SetWindowPosition(_THIS, SDL_Window * window)
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
RECT rect;
DWORD style;
@@ -481,11 +478,12 @@ void
WIN_MaximizeWindow(_THIS, SDL_Window * window)
{
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
#ifdef _WIN32_WCE
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
videodata->SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
}
#endif
ShowWindow(hwnd, SW_MAXIMIZE);
@@ -495,13 +493,14 @@ void
WIN_MinimizeWindow(_THIS, SDL_Window * window)
{
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
ShowWindow(hwnd, SW_MINIMIZE);
#ifdef _WIN32_WCE
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
videodata->SHFullScreen(hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
}
#endif
}

View File

@@ -105,6 +105,10 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy,
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
#endif
#ifndef GLX_EXT_swap_control_tear
#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
#endif
#define OPENGL_REQUIRES_DLOPEN
#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#include <dlfcn.h>
@@ -318,11 +322,15 @@ X11_GL_InitExtensions(_THIS)
extensions = NULL;
}
/* Check for GLX_EXT_swap_control */
/* Check for GLX_EXT_swap_control(_tear) */
_this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_FALSE;
if (HasExtension("GLX_EXT_swap_control", extensions)) {
_this->gl_data->glXSwapIntervalEXT =
(int (*)(Display*,GLXDrawable,int))
X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT");
if (HasExtension("GLX_EXT_swap_control_tear", extensions)) {
_this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_TRUE;
}
}
/* Check for GLX_MESA_swap_control */
@@ -476,7 +484,13 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
XWindowAttributes xattr;
XVisualInfo v, *vinfo;
int n;
GLXContext context = NULL;
GLXContext context = NULL, share_context;
if (_this->gl_config.share_with_current_context) {
share_context = (GLXContext)(_this->current_glctx);
} else {
share_context = NULL;
}
/* We do this to create a clean separation between X and GLX errors. */
XSync(display, False);
@@ -485,9 +499,12 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
v.visualid = XVisualIDFromVisual(xattr.visual);
vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
if (vinfo) {
if (_this->gl_config.major_version < 3) {
if (_this->gl_config.major_version < 3 &&
_this->gl_config.profile_mask == 0 &&
_this->gl_config.flags == 0) {
/* Create legacy context */
context =
_this->gl_data->glXCreateContext(display, vinfo, NULL, True);
_this->gl_data->glXCreateContext(display, vinfo, share_context, True);
} else {
/* If we want a GL 3.0 context or later we need to get a temporary
context to grab the new context creation function */
@@ -497,7 +514,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
SDL_SetError("Could not create GL context");
return NULL;
} else {
/* max 8 attributes plus terminator */
/* max 8 attributes plus terminator */
int attribs[9] = {
GLX_CONTEXT_MAJOR_VERSION_ARB,
_this->gl_config.major_version,
@@ -505,21 +522,21 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
_this->gl_config.minor_version,
0
};
int iattr = 4;
int iattr = 4;
/* SDL profile bits match GLX profile bits */
if( _this->gl_config.profile_mask != 0 ) {
attribs[iattr++] = GLX_CONTEXT_PROFILE_MASK_ARB;
attribs[iattr++] = _this->gl_config.profile_mask;
}
/* SDL profile bits match GLX profile bits */
if( _this->gl_config.profile_mask != 0 ) {
attribs[iattr++] = GLX_CONTEXT_PROFILE_MASK_ARB;
attribs[iattr++] = _this->gl_config.profile_mask;
}
/* SDL flags match GLX flags */
if( _this->gl_config.flags != 0 ) {
attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
attribs[iattr++] = _this->gl_config.flags;
}
/* SDL flags match GLX flags */
if( _this->gl_config.flags != 0 ) {
attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
attribs[iattr++] = _this->gl_config.flags;
}
attribs[iattr++] = 0;
attribs[iattr++] = 0;
/* Get a pointer to the context creation function for GL 3.0 */
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs =
@@ -560,7 +577,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
context =
glXCreateContextAttribs(display,
framebuffer_config[0],
NULL, True, attribs);
share_context, True, attribs);
_this->gl_data->glXDestroyContext(display,
temp_context);
}
@@ -615,9 +632,11 @@ static int swapinterval = -1;
int
X11_GL_SetSwapInterval(_THIS, int interval)
{
int status;
int status = -1;
if (_this->gl_data->glXSwapIntervalEXT) {
if ((interval < 0) && (!_this->gl_data->HAS_GLX_EXT_swap_control_tear)) {
SDL_SetError("Negative swap interval unsupported in this GL");
} else if (_this->gl_data->glXSwapIntervalEXT) {
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
const SDL_WindowData *windowdata = (SDL_WindowData *)
_this->current_glwin->driverdata;
@@ -625,7 +644,6 @@ X11_GL_SetSwapInterval(_THIS, int interval)
status = _this->gl_data->glXSwapIntervalEXT(display,drawable,interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalEXT failed");
status = -1;
} else {
swapinterval = interval;
}
@@ -633,7 +651,6 @@ X11_GL_SetSwapInterval(_THIS, int interval)
status = _this->gl_data->glXSwapIntervalMESA(interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalMESA failed");
status = -1;
} else {
swapinterval = interval;
}
@@ -641,13 +658,11 @@ X11_GL_SetSwapInterval(_THIS, int interval)
status = _this->gl_data->glXSwapIntervalSGI(interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalSGI failed");
status = -1;
} else {
swapinterval = interval;
}
} else {
SDL_Unsupported();
status = -1;
}
return status;
}
@@ -660,10 +675,23 @@ X11_GL_GetSwapInterval(_THIS)
const SDL_WindowData *windowdata = (SDL_WindowData *)
_this->current_glwin->driverdata;
Window drawable = windowdata->xwindow;
unsigned int value = 0;
unsigned int allow_late_swap_tearing = 0;
unsigned int interval = 0;
if (_this->gl_data->HAS_GLX_EXT_swap_control_tear) {
_this->gl_data->glXQueryDrawable(display, drawable,
GLX_LATE_SWAPS_TEAR_EXT,
&allow_late_swap_tearing);
}
_this->gl_data->glXQueryDrawable(display, drawable,
GLX_SWAP_INTERVAL_EXT, &value);
return (int) value;
GLX_SWAP_INTERVAL_EXT, &interval);
if ((allow_late_swap_tearing) && (interval > 0)) {
return -((int) interval);
}
return (int) interval;
} else if (_this->gl_data->glXGetSwapIntervalMESA) {
return _this->gl_data->glXGetSwapIntervalMESA();
} else {

View File

@@ -30,6 +30,7 @@
struct SDL_GLDriverData
{
SDL_bool HAS_GLX_EXT_visual_rating;
SDL_bool HAS_GLX_EXT_swap_control_tear;
void *(*glXGetProcAddress) (const GLubyte*);
XVisualInfo *(*glXChooseVisual) (Display*,int,int*);

View File

@@ -121,11 +121,25 @@ testloadso$(EXE): $(srcdir)/testloadso.c
testlock$(EXE): $(srcdir)/testlock.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)
ifeq (@ISMACOSX@,true)
testnative$(EXE): $(srcdir)/testnative.c \
$(srcdir)/testnativecocoa.m \
$(srcdir)/testnativew32.c \
$(srcdir)/testnativex11.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS) -L/usr/X11/lib -lX11 -framework Cocoa
endif
ifeq (@ISWINDOWS@,true)
testnative$(EXE): $(srcdir)/testnative.c \
$(srcdir)/testnativew32.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)
endif
ifeq (@ISUNIX@,true)
testnative$(EXE): $(srcdir)/testnative.c \
$(srcdir)/testnativex11.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS) -L/usr/X11/lib -lX11
endif
testoverlay2$(EXE): $(srcdir)/testoverlay2.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)

View File

@@ -138,10 +138,6 @@ PrintText(char *text)
SDL_Log("Text: %s", text);
}
#if __IPHONEOS__
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
#endif
int
main(int argc, char *argv[])
{
@@ -168,9 +164,11 @@ main(int argc, char *argv[])
#if __IPHONEOS__
/* Creating the context creates the view, which we need to show keyboard */
SDL_GL_CreateContext(window);
SDL_iPhoneKeyboardShow(window);
#endif
if (SDL_HasScreenKeyboardSupport(window)) {
SDL_ShowScreenKeyboard(window);
}
/* Watch keystrokes */
done = 0;

4240
test/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -13,9 +13,17 @@ dnl Check for compiler environment
AC_C_CONST
dnl We only care about this for building testnative at the moment, so these
dnl values shouldn't be considered absolute truth.
dnl (BeOS, for example, sets none of these.)
ISUNIX="false"
ISWINDOWS="false"
ISMACOSX="false"
dnl Figure out which math library to use
case "$host" in
*-*-cygwin* | *-*-mingw32*)
ISWINDOWS="true"
EXE=".exe"
MATHLIB=""
SYS_GL_LIBS="-lopengl32"
@@ -26,11 +34,13 @@ case "$host" in
SYS_GL_LIBS="-lGL"
;;
*-*-darwin* )
ISMACOSX="true"
EXE=""
MATHLIB=""
SYS_GL_LIBS="-Wl,-framework,OpenGL"
;;
*-*-aix*)
ISUNIX="true"
EXE=""
if test x$ac_cv_prog_gcc = xyes; then
CFLAGS="-mthreads"
@@ -56,6 +66,8 @@ case "$host" in
SYS_GL_LIBS="-lGLES_CM"
;;
*)
dnl Oh well, call it Unix...
ISUNIX="true"
EXE=""
MATHLIB="-lm"
SYS_GL_LIBS="-lGL"
@@ -63,6 +75,9 @@ case "$host" in
esac
AC_SUBST(EXE)
AC_SUBST(MATHLIB)
AC_SUBST(ISMACOSX)
AC_SUBST(ISWINDOWS)
AC_SUBST(ISUNIX)
dnl Check for SDL
SDL_VERSION=2.0.0

View File

@@ -240,18 +240,21 @@ main(int argc, char *argv[])
}
if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) {
SDL_GL_SetSwapInterval(1);
/* try late-swap-tearing first. If not supported, try normal vsync. */
if (SDL_GL_SetSwapInterval(-1) == -1) {
SDL_GL_SetSwapInterval(1);
}
} else {
SDL_GL_SetSwapInterval(0);
SDL_GL_SetSwapInterval(0); /* disable vsync. */
}
SDL_GetCurrentDisplayMode(0, &mode);
printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
printf("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format));
printf("Swap Interval : %d\n", SDL_GL_GetSwapInterval());
printf("\n");
printf("Vendor : %s\n", glGetString(GL_VENDOR));
printf("Renderer : %s\n", glGetString(GL_RENDERER));
printf("Version : %s\n", glGetString(GL_VERSION));
printf("Extensions : %s\n", glGetString(GL_EXTENSIONS));
printf("Vendor : %s\n", glGetString(GL_VENDOR));
printf("Renderer : %s\n", glGetString(GL_RENDERER));
printf("Version : %s\n", glGetString(GL_VERSION));
printf("\n");
status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);

View File

@@ -12,15 +12,6 @@
/* Simple program to test the SDL joystick routines */
#if 1 /* FIXME: Rework this using the 2.0 API */
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("FIXME\n");
return 0;
}
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -35,23 +26,46 @@ int main(int argc, char *argv[])
#define SCREEN_HEIGHT 480
#endif
#define MAX_NUM_AXES 6
#define MAX_NUM_HATS 2
static void
DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)
{
const SDL_Rect area = { x, y, w, h };
SDL_RenderFillRect(r, &area);
}
void
WatchJoystick(SDL_Joystick * joystick)
{
SDL_Surface *screen;
const char *name;
int i, done;
SDL_Window *window = NULL;
SDL_Renderer *screen = NULL;
const char *name = NULL;
int done = 0;
SDL_Event event;
int x, y, draw;
SDL_Rect axis_area[6][2];
int i;
/* Set a video mode to display joystick axis position */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, 0);
if (screen == NULL) {
fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
/* Create a window to display joystick axis position */
window = SDL_CreateWindow("Joystick Test", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (window == NULL) {
fprintf(stderr, "Couldn't create window: %s\n", SDL_GetError());
return;
}
screen = SDL_CreateRenderer(window, -1, 0);
if (screen == NULL) {
fprintf(stderr, "Couldn't create renderer: %s\n", SDL_GetError());
SDL_DestroyWindow(window);
return;
}
SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
SDL_RenderClear(screen);
SDL_RenderPresent(screen);
/* Print info about the joystick we are watching */
name = SDL_JoystickName(SDL_JoystickIndex(joystick));
printf("Watching joystick %d: (%s)\n", SDL_JoystickIndex(joystick),
@@ -60,13 +74,12 @@ WatchJoystick(SDL_Joystick * joystick)
SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick),
SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));
/* Initialize drawing rectangles */
memset(axis_area, 0, (sizeof axis_area));
draw = 0;
/* Loop, getting joystick events! */
done = 0;
while (!done) {
/* blank screen, set up for drawing this frame. */
SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
SDL_RenderClear(screen);
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_JOYAXISMOTION:
@@ -115,29 +128,17 @@ WatchJoystick(SDL_Joystick * joystick)
}
}
/* Update visual joystick state */
SDL_SetRenderDrawColor(screen, 0x00, 0xFF, 0x00, SDL_ALPHA_OPAQUE);
for (i = 0; i < SDL_JoystickNumButtons(joystick); ++i) {
SDL_Rect area;
area.x = i * 34;
area.y = SCREEN_HEIGHT - 34;
area.w = 32;
area.h = 32;
if (SDL_JoystickGetButton(joystick, i) == SDL_PRESSED) {
SDL_FillRect(screen, &area, 0xFFFF);
} else {
SDL_FillRect(screen, &area, 0x0000);
DrawRect(screen, i * 34, SCREEN_HEIGHT - 34, 32, 32);
}
SDL_UpdateRects(screen, 1, &area);
}
for (i = 0;
i < SDL_JoystickNumAxes(joystick) / 2
&& i < SDL_arraysize(axis_area); ++i) {
/* Erase previous axes */
SDL_FillRect(screen, &axis_area[i][draw], 0x0000);
SDL_SetRenderDrawColor(screen, 0xFF, 0x00, 0x00, SDL_ALPHA_OPAQUE);
for (i = 0; i < SDL_JoystickNumAxes(joystick) / 2; ++i) {
/* Draw the X/Y axis */
draw = !draw;
int x, y;
x = (((int) SDL_JoystickGetAxis(joystick, i * 2 + 0)) + 32768);
x *= SCREEN_WIDTH;
x /= 65535;
@@ -155,15 +156,36 @@ WatchJoystick(SDL_Joystick * joystick)
y = SCREEN_HEIGHT - 16;
}
axis_area[i][draw].x = (Sint16) x;
axis_area[i][draw].y = (Sint16) y;
axis_area[i][draw].w = 16;
axis_area[i][draw].h = 16;
SDL_FillRect(screen, &axis_area[i][draw], 0xFFFF);
SDL_UpdateRects(screen, 2, axis_area[i]);
DrawRect(screen, x, y, 16, 16);
}
SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0xFF, SDL_ALPHA_OPAQUE);
for (i = 0; i < SDL_JoystickNumHats(joystick); ++i) {
/* Derive the new position */
int x = SCREEN_WIDTH/2;
int y = SCREEN_HEIGHT/2;
const Uint8 hat_pos = SDL_JoystickGetHat(joystick, i);
if (hat_pos & SDL_HAT_UP) {
y = 0;
} else if (hat_pos & SDL_HAT_DOWN) {
y = SCREEN_HEIGHT-8;
}
if (hat_pos & SDL_HAT_LEFT) {
x = 0;
} else if (hat_pos & SDL_HAT_RIGHT) {
x = SCREEN_WIDTH-8;
}
DrawRect(screen, x, y, 8, 8);
}
SDL_RenderPresent(screen);
}
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
}
int
@@ -211,4 +233,3 @@ main(int argc, char *argv[])
return (0);
}
#endif