cleanup, util packages reorganized, removed some sysouts
This commit is contained in:
@@ -28,7 +28,7 @@ import mightypork.rogue.world.level.Level;
|
||||
import mightypork.rogue.world.tile.Tile;
|
||||
import mightypork.util.control.eventbus.BusEvent;
|
||||
import mightypork.util.control.eventbus.EventBus;
|
||||
import mightypork.util.ion.Ion;
|
||||
import mightypork.util.files.ion.Ion;
|
||||
import mightypork.util.logging.Log;
|
||||
import mightypork.util.logging.writers.LogWriter;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue;
|
||||
|
||||
|
||||
import mightypork.util.config.PropertyManager;
|
||||
import mightypork.util.files.config.PropertyManager;
|
||||
import mightypork.util.logging.Log;
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.rogue.events;
|
||||
|
||||
|
||||
import mightypork.util.control.eventbus.BusEvent;
|
||||
import mightypork.util.control.eventbus.events.flags.SingleReceiverEvent;
|
||||
import mightypork.util.control.eventbus.event_flags.SingleReceiverEvent;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,10 +7,10 @@ import mightypork.gamecore.gui.components.painters.QuadPainter;
|
||||
import mightypork.gamecore.gui.screens.Overlay;
|
||||
import mightypork.rogue.events.ActionRequest;
|
||||
import mightypork.rogue.events.ActionRequest.RequestType;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.control.timing.TimedTask;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.timing.TimedTask;
|
||||
|
||||
|
||||
public class CrossfadeOverlay extends Overlay implements CrossfadeRequest.Listener {
|
||||
|
||||
@@ -9,11 +9,11 @@ import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.control.Action;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.string.StringProvider;
|
||||
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.rogue.screens.gamescreen.gui.HeartBar;
|
||||
import mightypork.rogue.screens.gamescreen.gui.NavItemSlot;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class HudLayer extends ScreenLayer {
|
||||
|
||||
@@ -10,12 +10,13 @@ import mightypork.gamecore.gui.screens.LayeredScreen;
|
||||
import mightypork.rogue.Paths;
|
||||
import mightypork.rogue.world.MapGenerator;
|
||||
import mightypork.rogue.world.World;
|
||||
import mightypork.util.ion.Ion;
|
||||
import mightypork.util.files.ion.Ion;
|
||||
|
||||
|
||||
public class ScreenGame extends LayeredScreen {
|
||||
|
||||
public ScreenGame(AppAccess app) {
|
||||
public ScreenGame(AppAccess app)
|
||||
{
|
||||
super(app);
|
||||
|
||||
addLayer(new WorldLayer(this, obtainWorld())); //TODO with provided world
|
||||
@@ -33,7 +34,7 @@ public class ScreenGame extends LayeredScreen {
|
||||
|
||||
// SAVE
|
||||
|
||||
World world = MapGenerator.createWorld(rand.nextLong());
|
||||
final World world = MapGenerator.createWorld(rand.nextLong());
|
||||
addChildClient(world);
|
||||
|
||||
try {
|
||||
|
||||
@@ -7,16 +7,17 @@ import mightypork.rogue.screens.gamescreen.world.MIPKeyWalk;
|
||||
import mightypork.rogue.screens.gamescreen.world.MIPMouseWalk;
|
||||
import mightypork.rogue.screens.gamescreen.world.MapView;
|
||||
import mightypork.rogue.world.World;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
|
||||
|
||||
public class WorldLayer extends ScreenLayer {
|
||||
|
||||
private MapView worldView;
|
||||
private final MapView worldView;
|
||||
|
||||
|
||||
public WorldLayer(Screen screen, World world) {
|
||||
super(screen);
|
||||
public WorldLayer(Screen screen, World world)
|
||||
{
|
||||
super(screen);
|
||||
|
||||
// render component
|
||||
|
||||
@@ -26,7 +27,6 @@ public class WorldLayer extends ScreenLayer {
|
||||
worldView.addPlugin(new MIPKeyWalk());
|
||||
worldView.addPlugin(new MIPMouseWalk());
|
||||
|
||||
|
||||
// size of lower navbar
|
||||
final Num lownav = root.width().min(root.height()).max(700).perc(7);
|
||||
worldView.setRect(root.shrinkBottom(lownav));
|
||||
|
||||
@@ -5,9 +5,9 @@ import mightypork.gamecore.gui.AlignX;
|
||||
import mightypork.gamecore.gui.components.VisualComponent;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.gamecore.render.textures.TxQuad;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.num.mutable.NumVar;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.num.mutable.NumVar;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class HeartBar extends VisualComponent {
|
||||
|
||||
@@ -7,13 +7,13 @@ import mightypork.gamecore.gui.components.ClickableComponent;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.gamecore.render.textures.TxQuad;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.control.timing.Updateable;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.timing.Updateable;
|
||||
|
||||
|
||||
public class NavItemSlot extends ClickableComponent implements MouseMotionListener, Updateable {
|
||||
|
||||
@@ -4,7 +4,7 @@ package mightypork.rogue.screens.gamescreen.world;
|
||||
import mightypork.gamecore.input.InputSystem;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.rogue.world.PlayerControl;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
public class MIPKeyWalk implements MapInteractionPlugin {
|
||||
|
||||
@@ -4,9 +4,9 @@ package mightypork.rogue.screens.gamescreen.world;
|
||||
import mightypork.gamecore.input.InputSystem;
|
||||
import mightypork.rogue.world.PlayerControl;
|
||||
import mightypork.rogue.world.WorldPos;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.math.Polar;
|
||||
import mightypork.util.math.Calc.Deg;
|
||||
import mightypork.util.math.Polar;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
public class MIPMouseWalk implements MapInteractionPlugin {
|
||||
@@ -24,12 +24,12 @@ public class MIPMouseWalk implements MapInteractionPlugin {
|
||||
@Override
|
||||
public void onClick(MapView wv, PlayerControl player, Vect mouse)
|
||||
{
|
||||
WorldPos plpos = player.getPos();
|
||||
WorldPos clicked = wv.toWorldPos(mouse);
|
||||
final WorldPos plpos = player.getPos();
|
||||
final WorldPos clicked = wv.toWorldPos(mouse);
|
||||
|
||||
Polar p = Polar.fromCoord(clicked.x - plpos.x, clicked.y - plpos.y);
|
||||
final Polar p = Polar.fromCoord(clicked.x - plpos.x, clicked.y - plpos.y);
|
||||
|
||||
int dir = Deg.round90(p.getAngleDeg()) / 90;
|
||||
final int dir = Deg.round90(p.getAngleDeg()) / 90;
|
||||
|
||||
switch (dir) {
|
||||
case 0:
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.rogue.screens.gamescreen.world;
|
||||
|
||||
|
||||
import mightypork.rogue.world.PlayerControl;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
public interface MapInteractionPlugin {
|
||||
|
||||
@@ -16,7 +16,7 @@ import mightypork.rogue.world.WorldRenderer;
|
||||
import mightypork.rogue.world.entity.Entity;
|
||||
import mightypork.rogue.world.entity.models.EntityMoveListener;
|
||||
import mightypork.rogue.world.level.Level;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
public class MapView extends InputComponent implements KeyListener, MouseButtonListener, EntityMoveListener {
|
||||
@@ -28,7 +28,8 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
private final Set<MapInteractionPlugin> plugins = new HashSet<>();
|
||||
|
||||
|
||||
public MapView(World world) {
|
||||
public MapView(World world)
|
||||
{
|
||||
this.world = world;
|
||||
this.worldRenderer = new WorldRenderer(world, this, 8, 6, 72);
|
||||
pc = world.getPlayerControl();
|
||||
@@ -65,7 +66,7 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
@Override
|
||||
public void onStepFinished(Entity entity, World world, Level level)
|
||||
{
|
||||
for (MapInteractionPlugin p : plugins) {
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onStepEnd(this, pc);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +75,7 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
@Override
|
||||
public void onPathFinished(Entity entity, World world, Level level)
|
||||
{
|
||||
for (MapInteractionPlugin p : plugins) {
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onStepEnd(this, pc);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +84,7 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
@Override
|
||||
public void onPathInterrupted(Entity entity, World world, Level level)
|
||||
{
|
||||
for (MapInteractionPlugin p : plugins) {
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onStepEnd(this, pc);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +97,7 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
|
||||
if (!event.isUp()) return; // only btn-release evt
|
||||
|
||||
for (MapInteractionPlugin p : plugins) {
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onClick(this, pc, event.getPos());
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
{
|
||||
if (!event.isDown()) return;
|
||||
|
||||
for (MapInteractionPlugin p : plugins) {
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onKey(this, pc, event.getKey());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import mightypork.gamecore.gui.components.ClickableComponent;
|
||||
import mightypork.gamecore.gui.components.painters.TextPainter;
|
||||
import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.constraints.vect.mutable.VectVar;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.mutable.VectVar;
|
||||
|
||||
|
||||
class MenuButton extends ClickableComponent {
|
||||
|
||||
@@ -9,11 +9,11 @@ import mightypork.gamecore.gui.screens.BaseScreen;
|
||||
import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.rogue.screens.CrossfadeRequest;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.control.Action;
|
||||
import mightypork.util.math.color.COMMODORE;
|
||||
import mightypork.util.math.color.PAL16;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
class MenuLayer extends ScreenLayer {
|
||||
|
||||
@@ -5,13 +5,13 @@ import java.util.Random;
|
||||
|
||||
import mightypork.gamecore.gui.components.VisualComponent;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.control.timing.Updateable;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.timing.Updateable;
|
||||
|
||||
|
||||
public class BouncyBox extends VisualComponent implements Updateable {
|
||||
|
||||
@@ -12,9 +12,9 @@ import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
|
||||
|
||||
public class LayerBouncyBoxes extends ScreenLayer {
|
||||
|
||||
@@ -14,12 +14,12 @@ import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.input.Keys;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.constraints.vect.mutable.VectAnimated;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.mutable.VectAnimated;
|
||||
|
||||
|
||||
public class LayerFlyingCat extends ScreenLayer implements MouseButtonListener {
|
||||
|
||||
@@ -4,8 +4,8 @@ package mightypork.rogue.screens.test_render;
|
||||
import mightypork.gamecore.gui.screens.BaseScreen;
|
||||
import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.util.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.math.color.Color;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBound;
|
||||
|
||||
|
||||
public class LayerTestGradient extends ScreenLayer {
|
||||
|
||||
@@ -3,9 +3,9 @@ package mightypork.rogue.world;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import mightypork.util.ion.IonBinary;
|
||||
import mightypork.util.ion.IonInput;
|
||||
import mightypork.util.ion.IonOutput;
|
||||
import mightypork.util.files.ion.IonBinary;
|
||||
import mightypork.util.files.ion.IonInput;
|
||||
import mightypork.util.files.ion.IonOutput;
|
||||
|
||||
|
||||
public class PathStep implements IonBinary {
|
||||
|
||||
@@ -10,7 +10,8 @@ public class PlayerControl {
|
||||
private final World world;
|
||||
|
||||
|
||||
public PlayerControl(World w) {
|
||||
public PlayerControl(World w)
|
||||
{
|
||||
this.world = w;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package mightypork.rogue.world;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonBundled;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonBundled;
|
||||
|
||||
|
||||
public class PlayerInfo implements IonBundled {
|
||||
|
||||
@@ -7,9 +7,9 @@ import java.util.ArrayList;
|
||||
import mightypork.rogue.world.entity.Entities;
|
||||
import mightypork.rogue.world.entity.Entity;
|
||||
import mightypork.rogue.world.level.Level;
|
||||
import mightypork.util.control.timing.Updateable;
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonBundled;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonBundled;
|
||||
import mightypork.util.timing.Updateable;
|
||||
|
||||
|
||||
/**
|
||||
@@ -114,8 +114,8 @@ public class World implements IonBundled, Updateable {
|
||||
{
|
||||
return control;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Entity getPlayerEntity()
|
||||
{
|
||||
return playerEntity;
|
||||
|
||||
@@ -3,12 +3,12 @@ package mightypork.rogue.world;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.constraints.vect.mutable.VectAnimated;
|
||||
import mightypork.util.control.timing.Updateable;
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonBundled;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonBundled;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.mutable.VectAnimated;
|
||||
import mightypork.util.timing.Updateable;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,17 +6,15 @@ import mightypork.rogue.Res;
|
||||
import mightypork.rogue.world.entity.Entity;
|
||||
import mightypork.rogue.world.level.Level;
|
||||
import mightypork.rogue.world.level.render.TileRenderContext;
|
||||
import mightypork.util.constraints.Pollable;
|
||||
import mightypork.util.constraints.num.Num;
|
||||
import mightypork.util.constraints.num.caching.NumCache;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.RectConst;
|
||||
import mightypork.util.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.constraints.rect.proxy.RectProxy;
|
||||
import mightypork.util.constraints.vect.Vect;
|
||||
import mightypork.util.constraints.vect.VectConst;
|
||||
import mightypork.util.constraints.vect.caching.VectCache;
|
||||
import mightypork.util.math.color.RGB;
|
||||
import mightypork.util.math.constraints.Pollable;
|
||||
import mightypork.util.math.constraints.num.Num;
|
||||
import mightypork.util.math.constraints.num.caching.NumCache;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.caching.RectCache;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectProxy;
|
||||
import mightypork.util.math.constraints.vect.Vect;
|
||||
import mightypork.util.math.constraints.vect.caching.VectCache;
|
||||
|
||||
|
||||
/**
|
||||
@@ -46,7 +44,8 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
private TileRenderContext trc;
|
||||
|
||||
|
||||
public WorldRenderer(World world, Rect viewport, int xTiles, int yTiles, int minTileSize) {
|
||||
public WorldRenderer(World world, Rect viewport, int xTiles, int yTiles, int minTileSize)
|
||||
{
|
||||
super(viewport);
|
||||
|
||||
this.world = world;
|
||||
@@ -71,7 +70,7 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
|
||||
private void rebuildTiles()
|
||||
{
|
||||
Level level = world.getCurrentLevel();
|
||||
final Level level = world.getCurrentLevel();
|
||||
|
||||
if (activeLevel == level) return;
|
||||
activeLevel = level;
|
||||
@@ -84,18 +83,18 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
|
||||
private Vect getOffset()
|
||||
{
|
||||
WorldPos pos = player.getPosition();
|
||||
final WorldPos pos = player.getPosition();
|
||||
final double playerX = pos.getVisualX();
|
||||
final double playerY = pos.getVisualY();
|
||||
|
||||
double ts = tileSize.value();
|
||||
final double ts = tileSize.value();
|
||||
|
||||
return Vect.make((-ts * playerX), (-ts * playerY));
|
||||
}
|
||||
|
||||
|
||||
public void render()
|
||||
{
|
||||
{
|
||||
Render.pushMatrix();
|
||||
Render.setColor(RGB.WHITE);
|
||||
Render.translate(getOffset());
|
||||
@@ -106,10 +105,13 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
final double h = height().value();
|
||||
final double ts = tileSize.value();
|
||||
|
||||
final int x1 = (int) Math.floor(pos.x - (w / (ts*2)));
|
||||
final int y1 = (int) Math.floor(pos.y - (h / (ts*2)));
|
||||
final int x2 = (int) Math.ceil(pos.x + (w / (ts*2)));
|
||||
final int y2 = (int) Math.ceil(pos.y + (h / (ts*2)))+1;
|
||||
final int xtilesh = (int) (w / (ts * 2)) + 1;
|
||||
final int ytilesh = (int) (h / (ts * 2)) + 1;
|
||||
|
||||
final int x1 = pos.x - xtilesh;
|
||||
final int y1 = pos.y - ytilesh;
|
||||
final int x2 = pos.x + xtilesh;
|
||||
final int y2 = pos.y + ytilesh;
|
||||
|
||||
// === TILES ===
|
||||
|
||||
@@ -118,16 +120,11 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
Render.enterBatchTexturedQuadMode(Res.getTexture("tiles16"));
|
||||
}
|
||||
|
||||
Render.setColor(RGB.WHITE);
|
||||
|
||||
int c = 0;
|
||||
for (trc.y = y1; trc.y <= y2; trc.y++) {
|
||||
for (trc.x = x1; trc.x <= x2; trc.x++) {
|
||||
trc.renderTile();
|
||||
c++;
|
||||
}
|
||||
}
|
||||
System.out.println(c);
|
||||
|
||||
if (USE_BATCH_RENDERING) {
|
||||
Render.leaveBatchTexturedQuadMode();
|
||||
@@ -146,8 +143,8 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
for (final Entity e : activeLevel.getEntities()) {
|
||||
|
||||
// avoid entities out of view rect
|
||||
int x = (int) Math.round(e.getPosition().getVisualX());
|
||||
int y = (int) Math.round(e.getPosition().getVisualY());
|
||||
final int x = (int) Math.round(e.getPosition().getVisualX());
|
||||
final int y = (int) Math.round(e.getPosition().getVisualY());
|
||||
|
||||
if (x < x1 - ts || x > x2 + ts) continue;
|
||||
if (y < y1 - ts || y > y2 + ts) continue;
|
||||
@@ -169,8 +166,8 @@ public class WorldRenderer extends RectProxy implements Pollable {
|
||||
|
||||
public WorldPos getClickedTile(Vect clickPos)
|
||||
{
|
||||
Vect v = clickPos.sub(mapRect.origin().add(getOffset()));
|
||||
int ts = (int) tileSize.value();
|
||||
final Vect v = clickPos.sub(mapRect.origin().add(getOffset()));
|
||||
final int ts = (int) tileSize.value();
|
||||
return new WorldPos(v.xi() / ts, v.yi() / ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ import mightypork.rogue.world.entity.models.EntityModel;
|
||||
import mightypork.rogue.world.entity.models.EntityMoveListener;
|
||||
import mightypork.rogue.world.level.Level;
|
||||
import mightypork.rogue.world.level.render.MapRenderContext;
|
||||
import mightypork.util.ion.IonBinary;
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonBundled;
|
||||
import mightypork.util.ion.IonInput;
|
||||
import mightypork.util.ion.IonOutput;
|
||||
import mightypork.util.files.ion.IonBinary;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonBundled;
|
||||
import mightypork.util.files.ion.IonInput;
|
||||
import mightypork.util.files.ion.IonOutput;
|
||||
|
||||
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ public final class Entity implements IonBinary, IonBundled, EntityMoveListener {
|
||||
|
||||
walking = true;
|
||||
|
||||
PathStep step = path.poll();
|
||||
final PathStep step = path.poll();
|
||||
|
||||
final int projX = position.x + step.x, projY = position.y + step.y;
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import mightypork.rogue.Res;
|
||||
import mightypork.rogue.world.WorldPos;
|
||||
import mightypork.rogue.world.entity.Entity;
|
||||
import mightypork.rogue.world.level.render.MapRenderContext;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.math.Calc;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class PlayerRenderer extends EntityRenderer {
|
||||
|
||||
@@ -3,10 +3,10 @@ package mightypork.rogue.world.item;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import mightypork.util.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.ion.IonBinary;
|
||||
import mightypork.util.ion.IonInput;
|
||||
import mightypork.util.ion.IonOutput;
|
||||
import mightypork.util.files.ion.IonBinary;
|
||||
import mightypork.util.files.ion.IonInput;
|
||||
import mightypork.util.files.ion.IonOutput;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBound;
|
||||
|
||||
|
||||
public class Item implements IonBinary {
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.rogue.world.item;
|
||||
|
||||
|
||||
import mightypork.util.annotations.DefaultImpl;
|
||||
import mightypork.util.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBound;
|
||||
|
||||
|
||||
public abstract class ItemModel {
|
||||
|
||||
@@ -13,10 +13,10 @@ import mightypork.rogue.world.entity.Entity;
|
||||
import mightypork.rogue.world.tile.Tile;
|
||||
import mightypork.rogue.world.tile.Tiles;
|
||||
import mightypork.rogue.world.tile.models.TileModel;
|
||||
import mightypork.util.ion.IonBinary;
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonInput;
|
||||
import mightypork.util.ion.IonOutput;
|
||||
import mightypork.util.files.ion.IonBinary;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonInput;
|
||||
import mightypork.util.files.ion.IonOutput;
|
||||
import mightypork.util.math.noise.NoiseGen;
|
||||
|
||||
|
||||
@@ -43,11 +43,13 @@ public class Level implements MapAccess, IonBinary {
|
||||
private transient NoiseGen noiseGen;
|
||||
|
||||
|
||||
public Level() {
|
||||
public Level()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public Level(int width, int height) {
|
||||
public Level(int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
buildArray();
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.rogue.world.level.render;
|
||||
|
||||
|
||||
import mightypork.rogue.world.level.MapAccess;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class EntityRenderContext extends MapRenderContext {
|
||||
|
||||
@@ -2,8 +2,8 @@ package mightypork.rogue.world.level.render;
|
||||
|
||||
|
||||
import mightypork.rogue.world.level.MapAccess;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.builders.TiledRect;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.builders.TiledRect;
|
||||
|
||||
|
||||
public abstract class MapRenderContext {
|
||||
@@ -13,14 +13,15 @@ public abstract class MapRenderContext {
|
||||
private final Rect mapRect;
|
||||
|
||||
|
||||
public MapRenderContext(MapAccess map, Rect drawArea) {
|
||||
this.map = map;
|
||||
public MapRenderContext(MapAccess map, Rect drawArea)
|
||||
{
|
||||
this.map = map;
|
||||
|
||||
this.tiler = drawArea.tiles(map.getWidth(), map.getHeight());
|
||||
this.mapRect = drawArea;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Rect getRectForTile(int x, int y)
|
||||
{
|
||||
return tiler.tile(x, y);
|
||||
|
||||
@@ -3,8 +3,8 @@ package mightypork.rogue.world.level.render;
|
||||
|
||||
import mightypork.rogue.world.level.MapAccess;
|
||||
import mightypork.rogue.world.tile.Tile;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBound;
|
||||
import mightypork.util.math.noise.NoiseGen;
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package mightypork.rogue.world.tile;
|
||||
|
||||
import mightypork.rogue.world.item.Item;
|
||||
import mightypork.rogue.world.level.render.TileRenderContext;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.constraints.rect.proxy.RectBoundAdapter;
|
||||
import mightypork.util.control.timing.Animator;
|
||||
import mightypork.util.control.timing.AnimatorBounce;
|
||||
import mightypork.util.math.Easing;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.proxy.RectBoundAdapter;
|
||||
import mightypork.util.timing.Animator;
|
||||
import mightypork.util.timing.AnimatorBounce;
|
||||
|
||||
|
||||
public class DroppedItemRenderer {
|
||||
|
||||
@@ -9,10 +9,10 @@ import mightypork.rogue.world.level.Level;
|
||||
import mightypork.rogue.world.level.render.TileRenderContext;
|
||||
import mightypork.rogue.world.tile.models.TileModel;
|
||||
import mightypork.rogue.world.tile.renderers.TileRenderer;
|
||||
import mightypork.util.ion.IonBinary;
|
||||
import mightypork.util.ion.IonBundle;
|
||||
import mightypork.util.ion.IonInput;
|
||||
import mightypork.util.ion.IonOutput;
|
||||
import mightypork.util.files.ion.IonBinary;
|
||||
import mightypork.util.files.ion.IonBundle;
|
||||
import mightypork.util.files.ion.IonInput;
|
||||
import mightypork.util.files.ion.IonOutput;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import mightypork.gamecore.render.textures.TxSheet;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.rogue.world.level.render.TileRenderContext;
|
||||
import mightypork.rogue.world.tile.Tile;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
import mightypork.util.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class BasicTileRenderer extends TileRenderer {
|
||||
|
||||
Reference in New Issue
Block a user