Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merged with Kees Bakker's repo at https://bitbucket.org/keestux/sdl ...

  • Loading branch information
icculus committed Oct 18, 2011
2 parents 54c49f0 + 88852ca commit ee1323a08d001c92027f65bcb8b08adc5feec5d2
@@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-4
target=android-5
@@ -1,6 +1,8 @@
package org.libsdl.app;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.egl.*;

@@ -93,7 +95,8 @@ void sendCommand(int command, Object data) {
public static native void onNativeResize(int x, int y, int format);
public static native void onNativeKeyDown(int keycode);
public static native void onNativeKeyUp(int keycode);
public static native void onNativeTouch(int action, float x,
public static native void onNativeTouch(int touchDevId, int pointerFingerId,
int action, float x,
float y, float p);
public static native void onNativeAccel(float x, float y, float z);
public static native void nativeRunAudioThread();
@@ -387,7 +390,13 @@ public boolean initEGL(int majorVersion, int minorVersion) {
}
EGLConfig config = configs[0];

EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);
int EGL_CONTEXT_CLIENT_VERSION=0x3098;
int contextAttrs[] = new int[]
{
EGL_CONTEXT_CLIENT_VERSION, majorVersion,
EGL10.EGL_NONE
};
EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, contextAttrs);
if (ctx == EGL10.EGL_NO_CONTEXT) {
Log.e("SDL", "Couldn't create context");
return false;
@@ -423,7 +432,7 @@ public void flipEGL() {
try {
EGL10 egl = (EGL10)EGLContext.getEGL();

egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);

// drawing here

@@ -459,16 +468,34 @@ else if (event.getAction() == KeyEvent.ACTION_UP) {

// Touch events
public boolean onTouch(View v, MotionEvent event) {

int action = event.getAction();
float x = event.getX();
float y = event.getY();
float p = event.getPressure();

// TODO: Anything else we need to pass?
SDLActivity.onNativeTouch(action, x, y, p);
return true;
}
{
final int touchDevId = event.getDeviceId();
final int pointerCount = event.getPointerCount();
// touchId, pointerId, action, x, y, pressure
int actionPointerIndex = event.getActionIndex();
int pointerFingerId = event.getPointerId(actionPointerIndex);
int action = event.getActionMasked();

float x = event.getX(actionPointerIndex);
float y = event.getY(actionPointerIndex);
float p = event.getPressure(actionPointerIndex);

if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
// TODO send motion to every pointer if its position has
// changed since prev event.
for (int i = 0; i < pointerCount; i++) {
pointerFingerId = event.getPointerId(i);
x = event.getX(i);
y = event.getY(i);
p = event.getPressure(i);
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
}
} else {
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
}
}
return true;
}

// Sensor events
public void enableSensor(int sensortype, boolean enabled) {
@@ -939,6 +939,41 @@ CheckVisibilityHidden()
fi
}

dnl See if GCC's -Wall is supported.
CheckWarnAll()
{
AC_MSG_CHECKING(for GCC -Wall option)
have_gcc_Wall=no

save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -Wall"
AC_TRY_COMPILE([
int x = 0;
],[
],[
have_gcc_Wall=yes
])
AC_MSG_RESULT($have_gcc_Wall)
CFLAGS="$save_CFLAGS"

if test x$have_gcc_Wall = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"

dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
need_gcc_Wno_multichar=no
case "$host" in
*-*-beos* | *-*-haiku*)
need_gcc_Wno_multichar=yes
;;
esac
AC_MSG_RESULT($need_gcc_Wno_multichar)
if test x$need_gcc_Wno_multichar = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
fi
fi
}


dnl Find the X11 include and library directories
CheckX11()
@@ -2356,6 +2391,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
;;
esac

dnl Do this on all platforms, after everything else.
CheckWarnAll

# Verify that we have all the platform specific files we need

if test x$have_joystick != xyes; then
@@ -140,6 +140,9 @@
/* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD 1

/* enable joystick subsystem */
#define SDL_JOYSTICK_DISABLED 0

/* Set max recognized G-force from accelerometer
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
*/
@@ -89,7 +89,6 @@ typedef struct SDL_RWops
void *fileNameRef;
void *inputStream;
void *inputStreamRef;
void *skipMethod;
void *readableByteChannel;
void *readableByteChannelRef;
void *readMethod;
@@ -60,7 +60,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)

#elif defined(__GNUC__) && defined(__arm__) && \
(defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__))
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
defined(__ARM_ARCH_5TEJ__))
int result;
__asm__ __volatile__ (
"swp %0, %1, [%2]\n"
@@ -81,7 +82,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
return (result == 0);

#elif defined(__MACOSX__)
#elif defined(__MACOSX__) || defined(__IPHONEOS__)
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
return OSAtomicCompareAndSwap32Barrier(0, 1, lock);

0 comments on commit ee1323a

Please sign in to comment.