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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
@@ -158,4 +158,26 @@ public interface CameraConfig extends Config
|
||||
{
|
||||
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;
|
||||
middleClick = false;
|
||||
menuHasEntries = false;
|
||||
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
||||
copyConfigs();
|
||||
keyManager.registerKeyListener(this);
|
||||
mouseManager.registerMouseListener(this);
|
||||
overlayManager.add(cameraOverlay);
|
||||
@@ -124,11 +124,20 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
{
|
||||
overlayManager.remove(cameraOverlay);
|
||||
client.setCameraPitchRelaxerEnabled(false);
|
||||
client.setInvertYaw(false);
|
||||
client.setInvertPitch(false);
|
||||
keyManager.unregisterKeyListener(this);
|
||||
mouseManager.unregisterMouseListener(this);
|
||||
controlDown = false;
|
||||
}
|
||||
|
||||
void copyConfigs()
|
||||
{
|
||||
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
||||
client.setInvertYaw(config.invertYaw());
|
||||
client.setInvertPitch(config.invertPitch());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
@@ -238,7 +247,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged ev)
|
||||
{
|
||||
client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
|
||||
copyConfigs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user