catch up
This commit is contained in:
1 parent
287ab26da1
commit
b3eb112ae3
7 files changed
+44
-86
No files matched your search
@@ -1,11 +1,9 @@
|
||||
#include "android_api.h"
|
||||
|
||||
#include "main_code.h"
|
||||
#include "boost\thread.hpp"
|
||||
#include "boost/thread.hpp"
|
||||
|
||||
std::shared_ptr<TAndroidApplication> App(new TAndroidApplication);
|
||||
|
||||
boost::mutex RenderMutex;
|
||||
TAndroidApplication* Application = NULL;
|
||||
|
||||
float lastOffsetX = 0.5f;
|
||||
|
||||
@@ -16,13 +14,17 @@ bool RedBkgPref = false;
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height)
|
||||
{
|
||||
|
||||
Application = JniInitApp<TAndroidApplication>(width, height, 800.f, 480.f);
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
|
||||
|
||||
/*
|
||||
RenderMutex.lock();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (App->IsInited())
|
||||
if (Application->IsInited())
|
||||
{
|
||||
App->OuterDeinit(); //Clean up what is left at previous launch (if applicable)
|
||||
}
|
||||
@@ -48,57 +50,11 @@ JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Init(JNIEn
|
||||
throw;
|
||||
}
|
||||
|
||||
RenderMutex.unlock();
|
||||
RenderMutex.unlock();*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Update(JNIEnv * env, jobject obj, long dt)
|
||||
{
|
||||
RenderMutex.unlock();
|
||||
|
||||
try
|
||||
{
|
||||
if (App->IsInited())
|
||||
{
|
||||
App->OuterDraw();
|
||||
App->OuterUpdate(dt);
|
||||
|
||||
if (OffsetChanged)
|
||||
{
|
||||
Renderer->SetAlpha((lastOffsetX) * pi / 180.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
RenderMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_OnTapMove(JNIEnv * env, jobject obj, jfloat x, jfloat y)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (App->IsInited())
|
||||
{
|
||||
|
||||
vec2 offset = vec2(x*Renderer->GetMatrixWidth()/static_cast<float>(App->Width), y*Renderer->GetMatrixHeight()/static_cast<float>(App->Height));
|
||||
|
||||
App->OuterOnMove(offset);
|
||||
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY)
|
||||
{
|
||||
|
||||
@@ -109,10 +65,6 @@ JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOffset(
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOrientation(JNIEnv * env, jobject obj, int isLandscape)
|
||||
{
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetRedBkgPref(JNIEnv * env, jobject obj, jboolean r)
|
||||
{
|
||||
RedBkgPref = r;
|
||||
|
||||
@@ -16,14 +16,8 @@ extern "C" {
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_Update(JNIEnv * env, jobject obj, long dt);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_OnTapMove(JNIEnv * env, jobject obj, jfloat x, jfloat y);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetOrientation(JNIEnv * env, jobject obj, int isLandscape);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_wallpapertemplate_JniWrapper_SetRedBkgPref(JNIEnv * env, jobject obj, jboolean r);
|
||||
};
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void TAndroidApplication::InnerInit()
|
||||
|
||||
CheckGlError();
|
||||
|
||||
Renderer->MovePhi(pi/32);
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi/32);
|
||||
|
||||
//ResourceManager->ModelManager.AddLiteModel("bt_box_yellow.lm1");
|
||||
|
||||
@@ -119,19 +119,21 @@ void TAndroidApplication::InnerInit()
|
||||
|
||||
LoadModels();
|
||||
|
||||
if (Width > Height)
|
||||
if (Renderer->GetScreenWidth() > Renderer->GetScreenHeight())
|
||||
{
|
||||
Renderer->MoveDist(30.f);
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(30.f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Renderer->MoveDist(45.f);
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(45.f);
|
||||
}
|
||||
|
||||
CheckGlError();
|
||||
|
||||
Renderer->SetPerspectiveFullScreenViewport();
|
||||
glViewport(0, 0, Renderer->GetScreenWidth(), Renderer->GetScreenHeight());
|
||||
|
||||
Renderer->SetPerspectiveProjection(pi / 6.f, 1.0f, 100.0f);
|
||||
|
||||
*Console<<"Inner init end!\n";
|
||||
|
||||
@@ -174,7 +176,7 @@ void TAndroidApplication::InnerUpdate(cardinal dt)
|
||||
|
||||
void TAndroidApplication::InnerOnMove(vec2 shift)
|
||||
{
|
||||
Renderer->MoveAlpha(-pi*shift.v[0]*0.1f);
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveAlpha(-pi*shift.v[0]*0.1f);
|
||||
}
|
||||
|
||||
void TAndroidApplication::OnMouseDown(TMouseState& mouseState)
|
||||
|
||||
Reference in new issue
Block a user