X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2Fhumaninput%2FWorldNavigationTracker.java;h=44e09d2b70cb7c2431e71e73693268f0c907cc46;hp=34fd37e42dd5f45fa76ceb61e82fbf37959fa2a4;hb=8bceefbdb7316557ee77902cc6ac216f5c1ff160;hpb=6213716671ccab6b7256de41838e1f5401ce173c 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 index 34fd37e..44e09d2 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java @@ -1,16 +1,16 @@ /* - * Sixth - System for data storage, computation, exploration and interaction. - * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * + * 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.ViewContext; +import eu.svjatoslav.sixth.e3d.gui.ViewPanel; import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.KeyboardHelper; import java.awt.event.KeyEvent; @@ -18,34 +18,34 @@ import java.awt.event.KeyEvent; public class WorldNavigationTracker implements UserInputHandler { @Override - public boolean beforeViewUpdate(final ViewContext viewContext, - final int millisecondsSinceLastFrame) { + public boolean beforeRender(final ViewPanel viewPanel, + final int millisecondsSinceLastFrame) { - trackKeys(millisecondsSinceLastFrame, viewContext); + trackKeys(millisecondsSinceLastFrame, viewPanel); return false; } @Override - public void focusLost(final ViewContext viewContext) { + public void focusLost(final ViewPanel viewPanel) { } @Override - public void focusReceived(final ViewContext viewContext) { + public void focusReceived(final ViewPanel viewContext) { } @Override - public void keyPressed(final KeyEvent event, final ViewContext viewContext) { + public void keyPressed(final KeyEvent event, final ViewPanel viewContext) { } @Override - public void keyReleased(final KeyEvent event, final ViewContext viewContext) { + public void keyReleased(final KeyEvent event, final ViewPanel viewContext) { } /** * interpret currently pressed keys */ public void trackKeys(final long millisecondsSinceLastFrame, - final ViewContext viewContext) { + final ViewPanel viewContext) { final UserInputTracker inputTracker = viewContext.getUserInputTracker(); @@ -56,16 +56,16 @@ public class WorldNavigationTracker implements UserInputHandler { * (1 + (avatar.getMovementSpeed() / 10)); if (inputTracker.isKeyPressed(KeyboardHelper.UP)) - avatar.getMovementDirection().z += actualAcceleration; + avatar.getMovementVector().z += actualAcceleration; if (inputTracker.isKeyPressed(KeyboardHelper.DOWN)) - avatar.getMovementDirection().z -= actualAcceleration; + avatar.getMovementVector().z -= actualAcceleration; if (inputTracker.isKeyPressed(KeyboardHelper.RIGHT)) - avatar.getMovementDirection().x += actualAcceleration; + avatar.getMovementVector().x += actualAcceleration; if (inputTracker.isKeyPressed(KeyboardHelper.LEFT)) - avatar.getMovementDirection().x -= actualAcceleration; + avatar.getMovementVector().x -= actualAcceleration; avatar.enforceSpeedLimit(); }