Code refactoring.
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / gui / humaninput / WorldNavigationTracker.java
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java
deleted file mode 100644 (file)
index 28d485c..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
- */
-
-package eu.svjatoslav.sixth.e3d.gui.humaninput;
-
-import eu.svjatoslav.sixth.e3d.gui.Avatar;
-import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
-import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.KeyboardHelper;
-
-import java.awt.event.KeyEvent;
-
-public class WorldNavigationTracker implements UserInputHandler {
-
-    @Override
-    public boolean beforeRender(final ViewPanel viewPanel,
-                                final int millisecondsSinceLastFrame) {
-
-        trackKeys(millisecondsSinceLastFrame, viewPanel);
-        return false;
-    }
-
-    @Override
-    public boolean focusLost(final ViewPanel viewPanel) {
-        return false;
-    }
-
-    @Override
-    public boolean focusReceived(final ViewPanel viewContext) {
-        return false;
-    }
-
-    @Override
-    public boolean keyPressed(final KeyEvent event, final ViewPanel viewContext) {
-        return true;
-    }
-
-    @Override
-    public boolean keyReleased(final KeyEvent event, final ViewPanel viewContext) {
-        return true;
-    }
-
-    /**
-     * interpret currently pressed keys
-     */
-    public void trackKeys(final long millisecondsSinceLastFrame,
-                          final ViewPanel viewContext) {
-
-        final UserInputTracker inputTracker = viewContext.getUserInputTracker();
-
-        final Avatar avatar = viewContext.getAvatar();
-
-        final double actualAcceleration = millisecondsSinceLastFrame
-                * avatar.avatarAcceleration
-                * (1 + (avatar.getMovementSpeed() / 10));
-
-        if (inputTracker.isKeyPressed(KeyboardHelper.UP))
-            avatar.getMovementVector().z += actualAcceleration;
-
-        if (inputTracker.isKeyPressed(KeyboardHelper.DOWN))
-            avatar.getMovementVector().z -= actualAcceleration;
-
-        if (inputTracker.isKeyPressed(KeyboardHelper.RIGHT))
-            avatar.getMovementVector().x += actualAcceleration;
-
-        if (inputTracker.isKeyPressed(KeyboardHelper.LEFT))
-            avatar.getMovementVector().x -= actualAcceleration;
-
-        avatar.enforceSpeedLimit();
-    }
-}