More stuff starting to work but no video yet. App needs some adaptations I guess

This commit is contained in:
Gerhard Stein
2013-10-15 18:37:46 +02:00
parent 16404b2e2f
commit ca228357aa
7 changed files with 89 additions and 16 deletions

View File

@@ -258,7 +258,9 @@ public class MainActivity extends SDLActivity
public void initSDL()
{
(new Thread(new Runnable()
Settings.Apply(this);
super.nativeInit();
/*(new Thread(new Runnable()
{
public void run()
{
@@ -268,7 +270,7 @@ public class MainActivity extends SDLActivity
Log.i("SDL", "libSDL: Waiting for screen orientation to change - the device is probably in the lockscreen mode");
try {
Thread.sleep(500);
} catch( Exception e ) {}
} catch( Exception e ) {}*/
/*
tries--;
if( tries <= 0 )
@@ -277,7 +279,7 @@ public class MainActivity extends SDLActivity
break;
}
*/
if( _isPaused )
/* if( _isPaused )
{
Log.i("SDL", "libSDL: Application paused, cancelling SDL initialization until it will be brought to foreground");
return;
@@ -291,7 +293,7 @@ public class MainActivity extends SDLActivity
}
});
}
})).start();
})).start();*/
}
private void initSDLInternal()
@@ -312,12 +314,12 @@ public class MainActivity extends SDLActivity
_videoLayout = new FrameLayout(this);
SetLayerType.get().setLayerType(_videoLayout);
setContentView(_videoLayout);
mGLView = new DemoGLSurfaceView(this);
SetLayerType.get().setLayerType(mGLView);
_videoLayout.addView(mGLView);
mGLView.setFocusableInTouchMode(true);
mGLView.setFocusable(true);
mGLView.requestFocus();
//mGLView = new DemoGLSurfaceView(this);
//SetLayerType.get().setLayerType(mGLView);
//_videoLayout.addView(mGLView);
//mGLView.setFocusableInTouchMode(true);
//mGLView.setFocusable(true);
//mGLView.requestFocus();
if( _ad.getView() != null )
{
_videoLayout.addView(_ad.getView());
@@ -325,7 +327,7 @@ public class MainActivity extends SDLActivity
}
// Receive keyboard events
DimSystemStatusBar.get().dim(_videoLayout);
DimSystemStatusBar.get().dim(mGLView);
//DimSystemStatusBar.get().dim(mGLView);
}
@Override

View File

@@ -472,7 +472,7 @@ class Settings
static void Apply(MainActivity p)
{
nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0);
/*nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0);
if(Globals.VideoLinearFilter)
nativeSetVideoLinearFilter();
if( Globals.CompatibilityHacksVideo )
@@ -552,7 +552,7 @@ class Settings
nativeSetMultitouchGestureSensitivity(Globals.MultitouchGestureSensitivity);
if( Globals.TouchscreenCalibration[2] > Globals.TouchscreenCalibration[0] )
nativeSetTouchscreenCalibration(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);*/
String lang = new String(Locale.getDefault().getLanguage());
if( Locale.getDefault().getCountry().length() > 0 )

View File

@@ -471,7 +471,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
mWidth = w;
mHeight = h;
mGl = gl;
nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
}
public void onSurfaceDestroyed() {

View File

@@ -432,6 +432,8 @@ int SDLCALL SDL_ANDROID_RequestNewAdvertisement(void)
return 1;
}
/*
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetEnv) ( JNIEnv* env, jobject thiz, jstring j_name, jstring j_value )
{
@@ -460,4 +462,4 @@ JAVA_EXPORT_NAME(Settings_nativeChdir) ( JNIEnv* env, jobject thiz, jstring j_d
const char *dirname = (*env)->GetStringUTFChars(env, j_dir, &iscopy);
chdir(dirname);
(*env)->ReleaseStringUTFChars(env, j_dir, dirname);
}
}*/

View File

@@ -13,7 +13,7 @@ LOCAL_CFLAGS := -DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) -DSDL_CURDIR_PA
LOCAL_CPP_EXTENSION := .cpp
LOCAL_SRC_FILES := sdl_main.c SDL_android_main.cpp
LOCAL_SRC_FILES := sdl_main.c SDL_android_main.cpp repoNatives.c
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) application
LOCAL_LDLIBS := -llog

View File

@@ -0,0 +1,13 @@
/* JNI-C++ wrapper stuff */
#ifndef _JNI_WRAPPER_STUFF_H_
#define _JNI_WRAPPER_STUFF_H_
#ifndef SDL_JAVA_PACKAGE_PATH
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
#endif
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
#endif

View File

@@ -0,0 +1,56 @@
#include <jni.h>
#include <android/log.h>
//#include <GLES/gl.h>
//#include <GLES/glext.h>
#include <sys/time.h>
#include <time.h>
#include <stdint.h>
#include <math.h>
#include <string.h> // for memset()
/*#include "SDL_config.h"
#include "SDL_version.h"
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "SDL_mutex.h"
#include "SDL_thread.h"
#include "SDL_android.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "../SDL_sysvideo.h"
#include "SDL_androidvideo.h"*/
#include "jniwrapperstuff.h"
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetEnv) ( JNIEnv* env, jobject thiz, jstring j_name, jstring j_value )
{
jboolean iscopy;
const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy);
const char *value = (*env)->GetStringUTFChars(env, j_value, &iscopy);
setenv(name, value, 1);
(*env)->ReleaseStringUTFChars(env, j_name, name);
(*env)->ReleaseStringUTFChars(env, j_value, value);
}
JNIEXPORT jint JNICALL
JAVA_EXPORT_NAME(Settings_nativeChmod) ( JNIEnv* env, jobject thiz, jstring j_name, jint mode )
{
jboolean iscopy;
const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy);
int ret = chmod(name, mode);
(*env)->ReleaseStringUTFChars(env, j_name, name);
return (ret == 0);
}
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeChdir) ( JNIEnv* env, jobject thiz, jstring j_dir )
{
jboolean iscopy;
const char *dirname = (*env)->GetStringUTFChars(env, j_dir, &iscopy);
chdir(dirname);
(*env)->ReleaseStringUTFChars(env, j_dir, dirname);
}