mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Fix free look not working with controllers
This commit is contained in:
@@ -200,6 +200,7 @@ public class MainActivity extends SDLActivity{
|
||||
|
||||
|
||||
public native void attachController();
|
||||
public native void detachController();
|
||||
// Native method for setting button state
|
||||
public native void setButton(int button, boolean value);
|
||||
public native void setCameraState(int axis, float value);
|
||||
@@ -290,14 +291,19 @@ public class MainActivity extends SDLActivity{
|
||||
private void setupToggleButton(Button button, ViewGroup uiGroup){
|
||||
boolean isHidden = preferences.getBoolean("controlsVisible", false); // Default to 'false' (visible)
|
||||
uiGroup.setVisibility(isHidden ? View.INVISIBLE : View.VISIBLE); // Set the initial visibility based on the saved state
|
||||
/*if(isHidden){
|
||||
detachController();
|
||||
}*/
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
boolean isHidden = false;
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isHidden) {
|
||||
uiGroup.setVisibility(View.VISIBLE); // Show UI elements
|
||||
//attachController();
|
||||
} else {
|
||||
uiGroup.setVisibility(View.INVISIBLE); // Hide UI elements
|
||||
//detachController();
|
||||
}
|
||||
preferences.edit().putBoolean("controlsVisible", !isHidden).apply();
|
||||
isHidden = !isHidden; // Toggle state
|
||||
|
||||
+1
-1
Submodule libultraship updated: 2860d3df9c...e823c0fa72
@@ -101,8 +101,8 @@ bool Camera_FreeLook(Camera* camera) {
|
||||
|
||||
#ifdef __ANDROID__
|
||||
if(Ship::Mobile::IsUsingTouchscreenControls()) {
|
||||
yawDiff = -Ship::Mobile::GetCameraYaw()*10.0f;
|
||||
pitchDiff = Ship::Mobile::GetCameraPitch()*10.0f;
|
||||
yawDiff += -Ship::Mobile::GetCameraYaw()*10.0f;
|
||||
pitchDiff += Ship::Mobile::GetCameraPitch()*10.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user