This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.imageio.ImageIO; | |
| import javax.imageio.ImageTypeSpecifier; | |
| import javax.swing.*; | |
| import java.awt.*; | |
| import java.awt.geom.AffineTransform; | |
| import java.awt.image.BufferedImage; | |
| import java.io.File; | |
| import java.io.IOException; | |
| public class ImagePanel extends JPanel { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.swing.*; | |
| import javax.swing.event.ChangeEvent; | |
| import javax.swing.event.ChangeListener; | |
| import java.awt.*; | |
| import java.awt.event.ActionEvent; | |
| import java.awt.event.ActionListener; | |
| public class ImageZoom implements ActionListener, ChangeListener { | |
| private JFrame windowFrame; | |
| private JFileChooser fileChooser; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void update(float tpf) { | |
| for(Queue<MoveAction> actionQueue : movementActions.values()) { | |
| if(actionQueue.isEmpty()) continue; | |
| MoveAction action = actionQueue.peek(); | |
| Character entity = action.getSource(); | |
| if(action.getStartPosition().equals(Vector3f.ZERO)) { | |
| action.setStartPosition(new Vector3f(entity.getPosition()).setY(0)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void update(float tpf) { | |
| Vector3f camDirection = new Vector3f(camera.getDirection()); | |
| Vector3f camLeft = new Vector3f(camera.getLeft()); | |
| camDirection.setY(0); camLeft.setY(0); | |
| targetPosition.zero(); | |
| // Fire move action to send to server. | |
| if(lastUpdatePosition.distance(playerCharacter.getPosition()) >= MOVEMENT_UPDATE_FREQUENCY) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void update(float tpf) { | |
| for(Queue<MoveAction> actionQueue : movementActions.values()) { | |
| if(actionQueue.isEmpty()) continue; | |
| MoveAction action = actionQueue.peek(); | |
| Entity entity = action.getSource(); | |
| if(action.getStartPosition() == Vector3f.ZERO) { | |
| action.setStartPosition(entity.getPosition()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void update(float tpf) { | |
| if(action.getSource() instanceof PlayerCharacter) { | |
| PlayerCharacter character = (PlayerCharacter) action.getSource(); | |
| Vector3f direction = action.getTargetPosition().divide(action.getTargetPosition()).setY(0); | |
| character.getControl().setWalkDirection(direction.multLocal(character.getVelocity())); | |
| } | |
| if(action.getTargetPosition() == action.getSource().getPosition()) { | |
| actionHandler.onFinished(action); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void update(float tpf) { | |
| camDirection = camera.getDirection().clone().multLocal((playerCharacter.getVelocity())); | |
| camLeft = camera.getLeft().clone().multLocal((playerCharacter.getVelocity())); | |
| camDirection.setY(0); camLeft.setY(0); | |
| walkDirection.set(0, 0, 0); | |
| for(Direction direction : inputDirection) { | |
| switch(direction) { | |
| case Left: | |
| walkDirection.addLocal(camLeft); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void onAnalog(String name, float value, float tpf) { | |
| walkDirection.set(0, 0, 0); | |
| Camera cam = client.getCamera(); | |
| Vector3f camDirection = cam.getDirection().clone().multLocal((playerCharacter.getVelocity()*10)/tpf); | |
| Vector3f camLeft = cam.getLeft().clone().multLocal((playerCharacter.getVelocity()*10)/tpf); | |
| switch(name) { | |
| case "Left": | |
| walkDirection.addLocal(camLeft.mult(value)); | |
| break; |