Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merged Eli's Google Summer of Code work from SDL-gsoc2010-shaped_windows
  • Loading branch information
slouken committed Aug 22, 2010
2 parents 7bfa18c + 70ec6d3 commit 7de0704
Show file tree
Hide file tree
Showing 242 changed files with 20,725 additions and 6,749 deletions.
55 changes: 34 additions & 21 deletions .hgignore
Expand Up @@ -14,7 +14,19 @@ build
build-deps
VisualC
VisualCE
Xcode
# for Xcode
*.orig
*.swp
*.tmp
*.rej
*~
*.o
*.mode1*
*.model*
*.perspective*
*.perspective*
*.pbxuser
(^|/)build($|/)
.DS_Store
sdl.pc
include/SDL_config.h
Expand All @@ -32,52 +44,53 @@ test/stderr.txt
test/checkkeys
test/graywin
test/loopwave
test/testpower
test/testalpha
test/testatomic
test/testaudioinfo
test/testbitmap
test/testblitspeed
test/testcdrom
test/testcursor
test/testdraw2
test/testdyngl
test/testdyngles
test/testerror
test/testeyes
test/testfile
test/testfill
test/testgamma
test/testgesture
test/testgl
test/testgl2
test/testgles
test/testhaptic
test/testhread
test/testiconv
test/testime
test/testintersections
test/testjoystick
test/testkeys
test/testloadso
test/testlock
test/testmmousetablet
test/testmultiaudio
test/testoverlay
test/testoverlay2
test/testpalette
test/testplatform
test/testpower
test/testresample
test/testsem
test/testsprite
test/testsprite2
test/testspriteminimal
test/testtimer
test/testver
test/testvidinfo
test/testwin
test/testwm
test/testwm2
test/threadwin
test/torturethread
test/testloadso
test/testgl2
test/testcursor
test/testwm2
test/testmultiaudio
test/testresample
test/testdraw2
test/testmmousetablet
test/testdyngles
test/testaudioinfo
test/testgles
test/testsprite2
test/testintersections
test/testhaptic
test/testime
test/testatomic
test/testspriteminimal
test/testfill
test/testeyes
test/*.exe
test/*.dSYM
52 changes: 52 additions & 0 deletions Makefile.android
@@ -0,0 +1,52 @@
# Makefile to build the SDL library

include ./android/config.cfg #get ANDROID_NDK

TOOLS_PATH=$(ANDROID_NDK)/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin
ANDROID_INCLUDES = -I$(ANDROID_NDK)/build/platforms/android-4/common/include \
-I$(ANDROID_NDK)/build/platforms/android-4/arch-arm/usr/include
INCLUDE = -I./include
CFLAGS = -g -O2 $(INCLUDE) $(ANDROID_INCLUDES) -DANDROID -DANDROID_NDK -static

AR = $(TOOLS_PATH)/arm-eabi-ar
RANLIB = $(TOOLS_PATH)/arm-eabi-ranlib
CC = $(TOOLS_PATH)/arm-eabi-gcc


CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES = \
src/*.c \
src/audio/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/haptic/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
src/power/*.c \
src/audio/android/*.c \
src/video/android/*.c \
src/joystick/android/*.c \
src/haptic/dummy/*.c \
src/atomic/dummy/*.c \
src/thread/pthread/*.c \
src/timer/unix/*.c \
src/loadso/dummy/*.c \

OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')

all: $(TARGET)

$(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@

$(CONFIG_H):
cp $(CONFIG_H).default $(CONFIG_H)

clean:
rm -f $(TARGET) $(OBJECTS)
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@

DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS

HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_shape.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_clipboard.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_gesture.h SDL_haptic.h SDL_input.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_shape.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_touch.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
7 changes: 4 additions & 3 deletions Makefile.pandora
Expand Up @@ -12,14 +12,15 @@ CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp

TARGET = libSDL.a

SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c \
SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/joystick/*.c ./src/haptic/*.c ./src/power/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c ./src/audio/dma/*.c \
./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c ./src/cdrom/dummy/*.c \
./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c
./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \
./src/atomic/linux/*.c \
./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c


OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
Expand Down
19 changes: 18 additions & 1 deletion README.DirectFB
Expand Up @@ -65,10 +65,26 @@ you need to have the following font installed:
OPENGL Support
==============

As of this writing 20070810 you need to pull Mesa from git and do the following:
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:

------------------------
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
cd mesa
git clone git://anongit.freedesktop.org/git/mesa/mesa
------------------------

Edit configs/linux-directfb so that the Directories-section looks like
------------------------
# Directories
SRC_DIRS = mesa glu
GLU_DIRS = sgi
DRIVER_DIRS = directfb
PROGRAM_DIRS =
------------------------

make linux-directfb
make

Expand All @@ -87,3 +103,4 @@ export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7

./testgl

45 changes: 45 additions & 0 deletions README.android
@@ -0,0 +1,45 @@
================================================================================
Simple DirectMedia Layer for Android
================================================================================

Requirements: Android NDK r4 or later

================================================================================
How the port works
================================================================================

- 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
Java project, along with some C support code that communicates with Java
- This eventually produces a standard Android .apk package






================================================================================
Building an app
================================================================================

Instructions:
1. Edit android/config.cfg to point to the location of the NDK
2. Run 'make -f Makefile.android'. If all goes well, libsdl.a should be created
3. Place your application source files in android/project/jni
4. Edit the Android.mk to include your source files
5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
6. Run 'ant' in android/testproject. This compiles the .java and eventually
creates a .apk with the C source embedded
7. 'ant install' will push the apk to the device or emulator (if connected)




================================================================================
Known issues
================================================================================

- SDL audio (although it's mostly written, just not working properly yet)
- TODO. I'm sure there's a bunch more stuff I haven't thought of
72 changes: 72 additions & 0 deletions README.gesture
@@ -0,0 +1,72 @@
===========================================================================
Dollar Gestures
===========================================================================
SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.

Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.

Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.

Recording:
----------
To begin recording on a touch device call:
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.

Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
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.


Performing:
-----------
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:

event.dgesture.touchId - the Id of the touch which performed the gesture.
event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
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).



Saving:
-------
To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId is the id of the gesture you want to save, and src is an SDL_RWops pointer to the file where the gesture will be stored.

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.


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.



===========================================================================
Multi Gestures
===========================================================================
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.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.


===========================================================================
Notes
===========================================================================
For a complete example see test/testgesture.c

Please direct questions/comments to:
jim.tla+sdl_touch@gmail.com
10 changes: 1 addition & 9 deletions README.iphoneos
Expand Up @@ -33,14 +33,6 @@ Here is a more manual method:
4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically.
5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.

==============================================================================
Notes -- Touch Input
==============================================================================

Touch input in SDL for iPhone OS is presently exposed through SDL's mouse input API. Multi-touch input is reported as multiple mice, with each touch associated with a specific mouse. This association stays coherent from the time the touch starts to the time a touch ends.

By default, multi-touch is turned ON. This requires some care, because if you simply respond to mouse events without checking which mouse caused the event, you may end up fetching data from the wrong mouse, ie, from an incorrect or invalid touch. To turn multi-touch OFF, you can recompile SDL for iPhone with the macro SDL_IPHONE_MULTIPLE_MICE (found in SDL_config_iphoneos.h) set to 0.

==============================================================================
Notes -- Accelerometer as Joystick
==============================================================================
Expand All @@ -55,7 +47,7 @@ Notes -- OpenGL ES

Your SDL application for iPhone uses OpenGL ES for video by default.

OpenGL ES for iPhone supports two display pixel formats, RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute.
OpenGL ES for iPhone supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute.

If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.

Expand Down

0 comments on commit 7de0704

Please sign in to comment.