Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
TODO: UI documentation
  • Loading branch information
plajdo committed May 19, 2022
1 parent d057f3a commit 8c87672
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
25 changes: 0 additions & 25 deletions src/sk/bytecode/bludisko/rt/game/math/MathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,4 @@ public static int clamp(int value, int min, int max) {
return Math.min(Math.max(value, min), max);
}

/**
* Clamps a value between two values, rounding them to min/max if they exceed
* the interval, or returning the same value if it's inside the interval.
* @param value Value to clamp
* @param min Lower bound of the interval
* @param max Upper bound of the interval
* @return Clamped number
*/
public static float clamp(float value, float min, float max) {
return Math.min(Math.max(value, min), max);
}

/**
* Re-maps a number from one range to another.
* @param x The number to map
* @param fromLowest Smallest value of the input range
* @param fromHighest Highest value of the input range
* @param toLowest Smallest value of the output range
* @param toHighest Highest value of the output range
* @return Value scaled from one range to another one
*/
public static float map(float x, float fromLowest, float fromHighest, float toLowest, float toHighest) {
return (x - fromLowest) * (toHighest - toLowest) / (fromHighest - fromLowest) + toLowest;
}

}
15 changes: 11 additions & 4 deletions src/sk/bytecode/bludisko/rt/game/window/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
import sk.bytecode.bludisko.rt.game.util.NullSafe;
import sk.bytecode.bludisko.rt.game.window.screens.Screen;

import javax.swing.*;
import java.awt.*;
import javax.swing.JFrame;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.util.ArrayDeque;
import java.util.Queue;

/**
* Main application window containing a {@link Canvas} to be drawn on.
Expand All @@ -38,8 +45,8 @@ public final class Window {
private final Canvas canvas;
private final JFrame frame;

private final ArrayDeque<Screen> screenQueue;
private Screen screen;
private ArrayDeque<Screen> screenQueue;

private InputManager inputManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ private void setupPlayer() {
camera = new Camera();
overlay = new Overlay();

// camera.setMap(currentWorld.getMap());
// camera.move(player.getPosition().cpy().add(2, 1));
// camera.rotate(270, 100);
// camera.move(500);

player.setCamera(camera);

overlay.connectPlayer(player);
Expand Down

0 comments on commit 8c87672

Please sign in to comment.