Added 'p' shortcut to Play/Pause the Replay

This commit is contained in:
CrushedPixel
2015-05-11 23:35:32 +02:00
parent 29c1d4d6dc
commit 4e3b05840e
4 changed files with 17 additions and 7 deletions

View File

@@ -176,13 +176,7 @@ public class GuiReplayOverlay extends Gui {
if(!mouseDown) {
mouseDown = true;
if(hover) {
boolean paused = !ReplayMod.replaySender.paused();
if(paused) {
ReplayMod.replaySender.setReplaySpeed(0);
} else {
ReplayMod.replaySender.setReplaySpeed(speedSlider.getSliderValue());
}
playOrPause();
} else if(mouseX >= exportButtonX && mouseX <= exportButtonX + 20 && mouseY >= exportButtonY && exportButtonY <= exportButtonY + 20) {
ReplayHandler.startPath(true);
}
@@ -728,4 +722,13 @@ public class GuiReplayOverlay extends Gui {
return small_min;
}
}
public void playOrPause() {
boolean paused = !ReplayMod.replaySender.paused();
if(paused) {
ReplayMod.replaySender.setReplaySpeed(0);
} else {
ReplayMod.replaySender.setReplaySpeed(speedSlider.getSliderValue());
}
}
}

View File

@@ -104,6 +104,10 @@ public class KeyInputHandler {
public void handleCustomKeybindings(KeyBinding kb, boolean found, int keyCode) {
//Custom registered handlers
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_PLAY_PAUSE) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !ReplayHandler.isInPath()) {
ReplayMod.overlay.playOrPause();
}
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_ROTATE_CLOCKWISE) && (kb.isKeyDown() || kb.getKeyCode() == keyCode) && !ReplayHandler.isInPath()) {
ReplayHandler.addCameraTilt(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ? 1 : 5);
}

View File

@@ -19,6 +19,7 @@ public class KeybindRegistry {
public static final String KEY_ROTATE_CLOCKWISE = "replaymod.input.rotateclockwise";
public static final String KEY_ROTATE_COUNTERCLOCKWISE = "replaymod.input.rotatecounterclockwise";
public static final String KEY_RESET_TILT = "replaymod.input.resettilt";
public static final String KEY_PLAY_PAUSE = "replaymod.input.playpause";
private static Minecraft mc = Minecraft.getMinecraft();
public static void initialize() {
@@ -33,6 +34,7 @@ public class KeybindRegistry {
bindings.add(new KeyBinding(KEY_ROTATE_CLOCKWISE, Keyboard.KEY_L, "replaymod.title"));
bindings.add(new KeyBinding(KEY_RESET_TILT, Keyboard.KEY_K, "replaymod.title"));
bindings.add(new KeyBinding(KEY_ROTATE_COUNTERCLOCKWISE, Keyboard.KEY_J, "replaymod.title"));
bindings.add(new KeyBinding(KEY_PLAY_PAUSE, Keyboard.KEY_P, "replaymod.title"));
mc.gameSettings.keyBindings = bindings.toArray(new KeyBinding[bindings.size()]);

View File

@@ -196,6 +196,7 @@ replaymod.input.keyframerepository=Open Keyframe Presets
replaymod.input.rotateclockwise=Rotate Clockwise
replaymod.input.rotatecounterclockwise=Rotate Counterclockwise
replaymod.input.resettilt=Reset Camera Tilt
replaymod.input.playpause=Play/Pause Replay
#Keyframe Presets GUI
replaymod.gui.keyframerepository.title=Keyframe Repository