engine/Templates/SalmonWallpaperTemplate/jni/android_api.cpp

39 lines
996 B
C++
Raw Normal View History

2013-01-19 20:02:34 +00:00
#include "android_api.h"
#include "main_code.h"
2013-02-10 12:47:51 +00:00
#include "boost/thread.hpp"
2013-01-19 20:02:34 +00:00
2013-02-10 12:47:51 +00:00
TAndroidApplication* Application = NULL;
2013-01-19 20:02:34 +00:00
float lastOffsetX = 0.5f;
bool OffsetChanged = false;
bool RedBkgPref = false;
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height)
{
2013-02-10 15:34:32 +00:00
Application = JniInitApp<TAndroidApplication>(width, height, width, height);
2013-02-10 12:47:51 +00:00
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
2013-02-10 15:34:32 +00:00
2013-01-19 20:02:34 +00:00
}
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY)
{
if (Renderer != NULL)
{
OffsetChanged = true;
lastOffsetX = offsetX;
2013-02-10 15:34:32 +00:00
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
2013-01-19 20:02:34 +00:00
}
}
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetRedBkgPref(JNIEnv * env, jobject obj, jboolean r)
{
RedBkgPref = r;
}