mirror of
https://github.com/izzy2lost/Shipwright-Android.git
synced 2026-07-05 15:19:26 -07:00
Touch Controls
This commit is contained in:
+1
-1
Submodule app/jni/src/libultraship updated: 43adc0d5a0...03e683e1d1
@@ -36,6 +36,24 @@ s32 Camera_UpdateWater(Camera* camera);
|
||||
|
||||
#include "z_camera_data.inc"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "jni.h"
|
||||
|
||||
float touchCameraYaw=0;
|
||||
float touchCameraPitch=0;
|
||||
|
||||
extern void JNICALL Java_com_dishii_soh_MainActivity_setCameraState(JNIEnv *env, jobject jobj, jint axis, jfloat value) {
|
||||
switch(axis){
|
||||
case 0:
|
||||
touchCameraYaw=value;
|
||||
break;
|
||||
case 1:
|
||||
touchCameraPitch=value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===============================================================*/
|
||||
|
||||
/**
|
||||
@@ -1422,6 +1440,11 @@ s32 SetCameraManual(Camera* camera) {
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
newCamX += -touchCameraYaw*10.0f;
|
||||
newCamY += touchCameraPitch*10.0f;
|
||||
#endif
|
||||
|
||||
if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->play->manualCamera == false) {
|
||||
camera->play->manualCamera = true;
|
||||
|
||||
@@ -1489,6 +1512,11 @@ s32 Camera_Free(Camera* camera) {
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivityY", 1.0f));
|
||||
bool invertXAxis = (CVarGetInteger("gInvertXAxis", 0) && !CVarGetInteger("gMirroredWorld", 0)) || (!CVarGetInteger("gInvertXAxis", 0) && CVarGetInteger("gMirroredWorld", 0));
|
||||
|
||||
#ifdef __ANDROID__
|
||||
newCamX += -touchCameraYaw*10.0f;
|
||||
newCamY += touchCameraPitch*10.0f;
|
||||
#endif
|
||||
|
||||
camera->play->camX += newCamX * (invertXAxis ? -1 : 1);
|
||||
camera->play->camY += newCamY * (CVarGetInteger("gInvertYAxis", 1) ? 1 : -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user