From 41e066641618a5fd0d24f331548ffdb1ab8986ca Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 10 Mar 2013 09:03:38 -0700 Subject: [PATCH] Fixed bug 1748 - Patch for errors and mistakes in SDL 2 README files. Philipp Wiesemann SDL's README files seem to contain multiple errors and mistakes. I attached a patch with changes and updates. README: * removed Windows CE because no more supported README-SDL.txt: * corrected spelling mistake README.DirectFB: * corrected spelling mistakes README.MacOSX: * corrected spelling mistakes README.Platforms: * changed Android version to match AndroidManifest.xml README.Porting: * added missing directories from list * removed cdrom directories from list README.android: * updated required NDK revision * add project.properties to list * changed lower limit for to android-10 and removed upper * added a statement why older devices not supported * added correct dates to statements about OpenGL ES * added info about Google's device numbers and date * corrected spelling mistakes README.gesture: * corrected spelling mistakes README.pandora: * corrected spelling mistake README.touch: * changed that values are no in range 0..1 * updated the names of some functions * updated the notes about usage * corrected spelling mistakes * added info that API changed near original author contact --- README | 2 +- README-SDL.txt | 2 +- README.DirectFB | 6 ++--- README.MacOSX | 14 +++++----- README.Platforms | 2 +- README.Porting | 8 ++++-- README.android | 27 +++++++++++-------- README.gesture | 12 ++++----- README.pandora | 2 +- README.touch | 69 ++++++++++++++++++------------------------------ 10 files changed, 68 insertions(+), 76 deletions(-) diff --git a/README b/README index ad4a364d8..65a07551a 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ 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, +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. diff --git a/README-SDL.txt b/README-SDL.txt index 1a9feff5c..fade0b958 100644 --- a/README-SDL.txt +++ b/README-SDL.txt @@ -1,7 +1,7 @@ Please distribute this file with the SDL runtime environment: -The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library +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. diff --git a/README.DirectFB b/README.DirectFB index 68988136b..9c16a7b67 100644 --- a/README.DirectFB +++ b/README.DirectFB @@ -53,7 +53,7 @@ Simple Window Manager ===================== The driver has support for a very, very basic window manager you may -want to use when runnning with "wm=default". Use +want to use when running with "wm=default". Use export SDL_DIRECTFB_WM=1 @@ -62,10 +62,10 @@ you need to have the following font installed: /usr/share/fonts/truetype/freefont/FreeSans.ttf -OPENGL Support +OpenGL Support ============== -The following instructions will give you *software* opengl. However this +The following instructions will give you *software* OpenGL. However this works at least on all directfb supported platforms. As of this writing 20100802 you need to pull Mesa from git and do the following: diff --git a/README.MacOSX b/README.MacOSX index 3bc421371..572a86b19 100644 --- a/README.MacOSX +++ b/README.MacOSX @@ -56,7 +56,7 @@ usually is "TestGame". You might also want to use @PACKAGE@ to use the package name as specified in your configure.in file. If your project builds more than one application, you will have to do a bit -more. For each of your target applications, you need a seperate rule. +more. For each of your target applications, you need a separate rule. If you want the created bundles to be installed, you may want to add this rule to your Makefile.am: @@ -75,13 +75,13 @@ the make rule accordingly. But beware! That is only part of the story! With the above, you end up with a bare bone .app bundle, which is double clickable from the Finder. But -there are some more things you should do before shipping yor product... +there are some more things you should do before shipping your product... 1) The bundle right now probably is dynamically linked against SDL. That means that when you copy it to another computer, *it will not run*, unless you also install SDL on that other computer. A good solution for this dilemma is to static link against SDL. On OS X, you can - achieve that by linkinag against the libraries listed by + achieve that by linking against the libraries listed by sdl-config --static-libs instead of those listed by sdl-config --libs @@ -120,7 +120,7 @@ normally from the Finder. - Building the Framework The SDL Library is packaged as a framework bundle, an organized -relocatable folder heirarchy of executible code, interface headers, +relocatable folder hierarchy of executable code, interface headers, and additional resources. For practical purposes, you can think of a framework as a more user and system-friendly shared library, whose library file behaves more or less like a standard UNIX shared library. @@ -162,11 +162,11 @@ following locations: - Building from command line Use pbxbuild in the same directory as your .pbproj file - + - Running your app You can send command line args to your app by either invoking it from the command line (in *.app/Contents/MacOS) or by entering them in the - "Executibles" panel of the target settings. + "Executables" panel of the target settings. - Implementation Notes Some things that may be of interest about how it all works... @@ -181,6 +181,6 @@ following locations: You are free to modify your Cocoa app with generally no consequence to SDL. You cannot, however, easily change the SDL window itself. Functionality may be added in the future to help this. - + Known bugs are listed in the file "BUGS" diff --git a/README.Platforms b/README.Platforms index 32fb0d083..5009d7152 100644 --- a/README.Platforms +++ b/README.Platforms @@ -11,7 +11,7 @@ Windows 7 Mac OS X 10.4+ Linux 2.6+ iOS 3.1.3+ -Android 2.1+ +Android 2.3.3+ Unofficially supported platforms ================================ diff --git a/README.Porting b/README.Porting index 9bb4613e0..f8540b600 100644 --- a/README.Porting +++ b/README.Porting @@ -26,12 +26,15 @@ There are two basic ways of building SDL at the moment: Add the top level include directory to the header search path, and then add the following sources to the project: src/*.c + src/atomic/*.c src/audio/*.c - src/cdrom/*.c src/cpuinfo/*.c src/events/*.c src/file/*.c + src/haptic/*.c src/joystick/*.c + src/power/*.c + src/render/*.c src/stdlib/*.c src/thread/*.c src/timer/*.c @@ -39,8 +42,9 @@ There are two basic ways of building SDL at the moment: src/audio/disk/*.c src/audio/dummy/*.c src/video/dummy/*.c + src/haptic/dummy/*.c src/joystick/dummy/*.c - src/cdrom/dummy/*.c + src/main/dummy/*.c src/thread/generic/*.c src/timer/dummy/*.c src/loadso/dummy/*.c diff --git a/README.android b/README.android index 15738c960..29d8ca5dd 100644 --- a/README.android +++ b/README.android @@ -7,10 +7,10 @@ Requirements: Android SDK (version 10 or later) http://developer.android.com/sdk/index.html -Android NDK r4 or later +Android NDK r7 or later http://developer.android.com/sdk/ndk/index.html -Minimum API Level supported by SDL: 10 (Android 2.3.3) +Minimum API level supported by SDL: 10 (Android 2.3.3) ================================================================================ How the port works @@ -19,7 +19,7 @@ Minimum API Level supported by SDL: 10 (Android 2.3.3) - Android applications are Java-based, optionally with parts written in C - As SDL apps are C-based, we use a small Java shim that uses JNI to talk to the SDL library -- This means that your application C code must be placed inside an android +- This means that your application C code must be placed inside an Android Java project, along with some C support code that communicates with Java - This eventually produces a standard Android .apk package @@ -60,8 +60,8 @@ android-project/ build.properties - empty build.xml - build description file, used by ant. The actual application name is specified here. - default.properties - holds the target ABI for the application, can range between - android-5 and android-16 + default.properties - holds the target ABI for the application, android-10 and up + project.properties - holds the target ABI for the application, android-10 and up 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 can call recursively the Android.mk files @@ -172,10 +172,10 @@ manually or quit the app (which is actually the kind of behaviour you'll see under iOS, if the OS can not restore your GL context it will just kill your app) ================================================================================ - Threads and the JAVA VM + Threads and the Java VM ================================================================================ -For a quick tour on how Linux native threads interoperate with the JAVA VM, take +For a quick tour on how Linux native threads interoperate with the Java VM, take a look here: http://developer.android.com/guide/practices/jni.html If you want to use threads in your SDL app, it's strongly recommended that you do so by creating them using SDL functions. This way, the required attach/detach @@ -347,11 +347,16 @@ When you're done instrumenting with valgrind, you can disable the wrapper: Why is API level 10 the minimum required? ================================================================================ -Support for OpenGL ES/ES2 applications was introduced in the NDK for API level 9, -which has since then been obsoleted, with the recommendation to developers to -bump the required level to 10. +API level 10 is required because SDL requires some functionality for running not +available on older devices and some for building which is not in older NDK/SDKs. + +Support for native OpenGL ES and ES2 applications was introduced in the NDK for +API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which +has since then been obsoleted, with the recommendation to developers to bump the +required API level to 10. As of this writing, according to http://developer.android.com/about/dashboards/index.html -about 90% of the existing Android devices support an API level 10 or higher. +about 90% of the Android devices accessing Google Play support API level 10 or +higher (March 2013). ================================================================================ A note regarding the use of the "dirty rectangles" rendering technique diff --git a/README.gesture b/README.gesture index 187a598b1..d52c4c5a2 100644 --- a/README.gesture +++ b/README.gesture @@ -16,7 +16,7 @@ Recording terminates as soon as a finger comes up. Recording is acknowledged by A SDL_DOLLARRECORD event is a dgesture with the following fields: event.dgesture.touchId - the Id of the touch used to record the gesture. -event.dgesture.gestureId - the unique id of the recoreded gesture. +event.dgesture.gestureId - the unique id of the recorded gesture. Performing: @@ -28,7 +28,7 @@ event.dgesture.gestureId - the unique id of the closest gesture to the performe event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match. event.dgesture.numFingers - the number of fingers used to draw the stroke. -Most programs will want to define an appropriate error threshold and check to be sure taht the error of a gesture is not abnormally high (an indicator that no gesture was performed). +Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed). @@ -38,14 +38,14 @@ To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored. -Both functions return the number of gestures sucessfully saved. +Both functions return the number of gestures successfully saved. Loading: -------- To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file. -SDL_LoadDollarTemplates returns the number of templates sucessfully loaded. +SDL_LoadDollarTemplates returns the number of templates successfully loaded. @@ -56,8 +56,8 @@ SDL provides simple support for pinch/rotate/swipe gestures. Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields: event.mgesture.touchId - the Id of the touch on which the gesture was performed. -event.mgesture.x - the normalized x cooridinate of the gesture. (0..1) -event.mgesture.y - the normalized y cooridinate of the gesture. (0..1) +event.mgesture.x - the normalized x coordinate of the gesture. (0..1) +event.mgesture.y - the normalized y coordinate of the gesture. (0..1) event.mgesture.dTheta - the amount that the fingers rotated during this motion. event.mgesture.dDist - the amount that the fingers pinched during this motion. event.mgesture.numFingers - the number of fingers used in the gesture. diff --git a/README.pandora b/README.pandora index d360f84f3..d522bc77a 100644 --- a/README.pandora +++ b/README.pandora @@ -1,7 +1,7 @@ SDL 2.0 with open pandora console support ( http://openpandora.org/ ) ===================================================================== -- A pandora specific video driver was writed to allow SDL 2.0 with OpenGL ES +- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES support to work on the pandora under the framebuffer. This driver do not have input support for now, so if you use it you will have to add your own control code. The video driver name is "pandora" so if you have problem running it from diff --git a/README.touch b/README.touch index 68b97c1be..9e688330f 100644 --- a/README.touch +++ b/README.touch @@ -5,7 +5,7 @@ Linux: The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it. Mac: -The Mac and Iphone API's are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do. +The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do. iPhone: Works out of box. @@ -21,18 +21,18 @@ Sent when a finger (or stylus) is placed on a touch device. Fields: event.tfinger.touchId - the Id of the touch device. event.tfinger.fingerId - the Id of the finger which just went down. -event.tfinger.x - the x coordinate of the touch (0..touch.xres) -event.tfinger.y - the y coordinate of the touch (0..touch.yres) -event.tfinger.pressure - the pressure of the touch (0..touch.pressureres) +event.tfinger.x - the x coordinate of the touch (0..1) +event.tfinger.y - the y coordinate of the touch (0..1) +event.tfinger.pressure - the pressure of the touch (0..1) SDL_FINGERMOTION: Sent when a finger (or stylus) is moved on the touch device. Fields: Same as FINGERDOWN but with additional: -event.tfginer.dx - change in x coordinate during this motion event. -event.tfginer.dy - change in y coordinate during this motion event. +event.tfinger.dx - change in x coordinate during this motion event. +event.tfinger.dy - change in y coordinate during this motion event. -SDL_FINGERMOTION: +SDL_FINGERUP: Sent when a finger (or stylus) is lifted from the touch device. Fields: Same as FINGERDOWN. @@ -41,56 +41,38 @@ Same as FINGERDOWN. =========================================================================== Functions =========================================================================== -SDL provides the ability to access the underlying Touch and Finger structures. +SDL provides the ability to access the underlying Finger structures. These structures should _never_ be modified. -The following functions are included from SDL_Touch.h - -To get a SDL_Touch device call SDL_GetTouch(touchId). -This returns an SDL_Touch*. -IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouch will return null. Be sure to check for this! - -An SDL_Touch has the following fields: ->xres,yres,pressures: - The resolution at which x,y, and pressure values are reported. Currently these will always be equal to 2^15, but this may not always be the case. - ->pressure_max, pressure_min, x_max, x_min, y_max, y_min - Which give, respectively, the maximum and minumum values that the touch digitizer can return for pressure, x coordiniate, and y coordinate AS REPORTED BY THE OPERATING SYSTEM. -On Mac/iPhone systems _max will always be 0, and _min will always be 1. - ->native_xres,native_yres,native_pressureres: - The native resolution of the touch device AS REPORTED BY THE OPERATING SYSTEM. -On Mac/iPhone systems these will always be 1. +The following functions are included from SDL_touch.h ->num_fingers: - The number of fingers currently down on the device. +To get a SDL_TouchID call SDL_GetTouchDevice(index). +This returns a SDL_TouchID. +IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this! ->fingers: - An array of pointers to the fingers which are on the device. +The number of touch devices can be queried with SDL_GetNumTouchDevices(). +A SDL_Touch may be used to get pointers to SDL_Finger. -The most common reason to access a touch device is to normalize inputs. This would be accomplished by code like the following: +SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device. - SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId); - if(inTouch == NULL) continue; //The touch has been removed +The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following: - float x = ((float)event.tfinger.x)/inTouch->xres; - float y = ((float)event.tfinger.y)/inTouch->yres; + float x = event.tfinger.x; + float y = event.tfinger.y; -To get an SDL_Finger, call SDL_GetFinger(touch,fingerId), where touch is a pointer to an SDL_Touch device, and fingerId is the id of the requested finger. -This returns an SDL_Finger*, or null if the finger does not exist, or has been removed. -An SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the FINGERUP event is polled. -As a result, be very careful to check for null return values. +To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger. +This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed. +A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the FINGERUP event is polled. +As a result, be very careful to check for NULL return values. -An SDL_Finger has the following fields: +A SDL_Finger has the following fields: >x,y,pressure: The current coordinates of the touch. ->xdelta,ydelta: - The change in position resulting from the last finger motion. ->last_x, last_y, last_pressure: - The previous coordinates of the touch. +>pressure: + The pressure of the touch. =========================================================================== Notes @@ -99,3 +81,4 @@ For a complete example see test/testgesture.c Please direct questions/comments to: jim.tla+sdl_touch@gmail.com + (original author, API was changed since)