Merge pull request #11214 from abextm/invert-camera-external
camera: add option to invert camera mouse controls
This commit is contained in:
@@ -1184,6 +1184,16 @@ public interface Client extends GameEngine
|
|||||||
*/
|
*/
|
||||||
void setCameraPitchRelaxerEnabled(boolean enabled);
|
void setCameraPitchRelaxerEnabled(boolean enabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the moving the camera horizontally should be backwards
|
||||||
|
*/
|
||||||
|
void setInvertYaw(boolean invertYaw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the moving the camera vertically should be backwards
|
||||||
|
*/
|
||||||
|
void setInvertPitch(boolean invertPitch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the world map overview.
|
* Gets the world map overview.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -158,4 +158,26 @@ public interface CameraConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "invertYaw",
|
||||||
|
name = "Invert Yaw",
|
||||||
|
description = "Makes moving the camera horizontally with the mouse backwards",
|
||||||
|
position = 11
|
||||||
|
)
|
||||||
|
default boolean invertYaw()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "invertPitch",
|
||||||
|
name = "Invert Pitch",
|
||||||
|
description = "Makes moving the camera vertically with the mouse backwards",
|
||||||
|
position = 12
|
||||||
|
)
|
||||||
|
default boolean invertPitch()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
|||||||
rightClick = false;
|
rightClick = false;
|
||||||
middleClick = false;
|
middleClick = false;
|
||||||
menuHasEntries = false;
|
menuHasEntries = false;
|
||||||
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
copyConfigs();
|
||||||
keyManager.registerKeyListener(this);
|
keyManager.registerKeyListener(this);
|
||||||
mouseManager.registerMouseListener(this);
|
mouseManager.registerMouseListener(this);
|
||||||
overlayManager.add(cameraOverlay);
|
overlayManager.add(cameraOverlay);
|
||||||
@@ -124,11 +124,20 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
|||||||
{
|
{
|
||||||
overlayManager.remove(cameraOverlay);
|
overlayManager.remove(cameraOverlay);
|
||||||
client.setCameraPitchRelaxerEnabled(false);
|
client.setCameraPitchRelaxerEnabled(false);
|
||||||
|
client.setInvertYaw(false);
|
||||||
|
client.setInvertPitch(false);
|
||||||
keyManager.unregisterKeyListener(this);
|
keyManager.unregisterKeyListener(this);
|
||||||
mouseManager.unregisterMouseListener(this);
|
mouseManager.unregisterMouseListener(this);
|
||||||
controlDown = false;
|
controlDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void copyConfigs()
|
||||||
|
{
|
||||||
|
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
||||||
|
client.setInvertYaw(config.invertYaw());
|
||||||
|
client.setInvertPitch(config.invertPitch());
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||||
{
|
{
|
||||||
@@ -238,7 +247,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onConfigChanged(ConfigChanged ev)
|
public void onConfigChanged(ConfigChanged ev)
|
||||||
{
|
{
|
||||||
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
copyConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user