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 12:47:51 +00:00
|
|
|
Application = JniInitApp<TAndroidApplication>(width, height, 800.f, 480.f);
|
|
|
|
|
|
|
|
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
|
2013-01-19 20:02:34 +00:00
|
|
|
|
2013-02-10 12:47:51 +00:00
|
|
|
/*
|
2013-01-19 20:02:34 +00:00
|
|
|
RenderMutex.lock();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
|
2013-02-10 12:47:51 +00:00
|
|
|
if (Application->IsInited())
|
2013-01-19 20:02:34 +00:00
|
|
|
{
|
|
|
|
App->OuterDeinit(); //Clean up what is left at previous launch (if applicable)
|
|
|
|
}
|
|
|
|
|
|
|
|
App->Width = width;
|
|
|
|
App->Height = height;
|
|
|
|
|
|
|
|
if (width > height)
|
|
|
|
{
|
|
|
|
App->OuterInit(width, height, 800.f, 480.f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
App->OuterInit(width, height, 480.f, 800.f);
|
|
|
|
}
|
|
|
|
|
|
|
|
Renderer->SetAlpha((lastOffsetX) * pi / 180.f);
|
|
|
|
|
|
|
|
App->Inited = true;
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
|
2013-02-10 12:47:51 +00:00
|
|
|
RenderMutex.unlock();*/
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetRedBkgPref(JNIEnv * env, jobject obj, jboolean r)
|
|
|
|
{
|
|
|
|
RedBkgPref = r;
|
|
|
|
}
|