diff --git a/src/mightypork/gamecore/render/Render.java b/src/mightypork/gamecore/render/Render.java index 5664092..0c3ee4a 100644 --- a/src/mightypork/gamecore/render/Render.java +++ b/src/mightypork/gamecore/render/Render.java @@ -41,7 +41,7 @@ public class Render { */ public static void setColor(Color color) { - if (color != null) glColor4d(color.red(), color.green(), color.blue(), color.alpha()); + if (color != null) glColor4d(color.r(), color.g(), color.b(), color.a()); } @@ -53,7 +53,7 @@ public class Render { */ public static void setColor(Color color, double alpha) { - if (color != null) glColor4d(color.red(), color.green(), color.blue(), color.alpha() * alpha); + if (color != null) glColor4d(color.r(), color.g(), color.b(), color.a() * alpha); } diff --git a/src/mightypork/gamecore/render/fonts/impl/CachedFont.java b/src/mightypork/gamecore/render/fonts/impl/CachedFont.java index 2cf182d..651043c 100644 --- a/src/mightypork/gamecore/render/fonts/impl/CachedFont.java +++ b/src/mightypork/gamecore/render/fonts/impl/CachedFont.java @@ -382,7 +382,7 @@ public class CachedFont implements GLFont { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textureID); - glColor4d(color.red(), color.green(), color.blue(), color.alpha()); + glColor4d(color.r(), color.g(), color.b(), color.a()); glBegin(GL_QUADS); diff --git a/src/mightypork/rogue/screens/gamescreen/world/MIPKeyWalk.java b/src/mightypork/rogue/screens/gamescreen/world/MIPKeyWalk.java index 7789ebc..11c1473 100644 --- a/src/mightypork/rogue/screens/gamescreen/world/MIPKeyWalk.java +++ b/src/mightypork/rogue/screens/gamescreen/world/MIPKeyWalk.java @@ -17,15 +17,15 @@ public class MIPKeyWalk implements MapInteractionPlugin { @Override - public void onClick(MapView wv, PlayerControl player, Vect mouse) + public void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down) { } @Override - public void onKey(MapView wv, PlayerControl player, int key) + public void onKey(MapView wv, PlayerControl player, int key, boolean down) { - walkByKey(player); + if(down) walkByKey(player); } diff --git a/src/mightypork/rogue/screens/gamescreen/world/MIPMouseWalk.java b/src/mightypork/rogue/screens/gamescreen/world/MIPMouseWalk.java index 2217d3d..bb5d212 100644 --- a/src/mightypork/rogue/screens/gamescreen/world/MIPMouseWalk.java +++ b/src/mightypork/rogue/screens/gamescreen/world/MIPMouseWalk.java @@ -16,14 +16,16 @@ public class MIPMouseWalk implements MapInteractionPlugin { { if (InputSystem.isMouseButtonDown(0)) { // walk by holding btn - onClick(wv, player, InputSystem.getMousePos()); + onClick(wv, player, InputSystem.getMousePos(), true); } } @Override - public void onClick(MapView wv, PlayerControl player, Vect mouse) + public void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down) { + if(!down) return; + final WorldPos plpos = player.getPos(); final WorldPos clicked = wv.toWorldPos(mouse); @@ -52,7 +54,7 @@ public class MIPMouseWalk implements MapInteractionPlugin { @Override - public void onKey(MapView wv, PlayerControl player, int key) + public void onKey(MapView wv, PlayerControl player, int key, boolean down) { } diff --git a/src/mightypork/rogue/screens/gamescreen/world/MapInteractionPlugin.java b/src/mightypork/rogue/screens/gamescreen/world/MapInteractionPlugin.java index 02cf41d..95edb7a 100644 --- a/src/mightypork/rogue/screens/gamescreen/world/MapInteractionPlugin.java +++ b/src/mightypork/rogue/screens/gamescreen/world/MapInteractionPlugin.java @@ -10,9 +10,9 @@ public interface MapInteractionPlugin { void onStepEnd(MapView wv, PlayerControl player); - void onClick(MapView wv, PlayerControl player, Vect mouse); + void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down); - void onKey(MapView wv, PlayerControl player, int key); + void onKey(MapView wv, PlayerControl player, int key, boolean down); } diff --git a/src/mightypork/rogue/screens/gamescreen/world/MapView.java b/src/mightypork/rogue/screens/gamescreen/world/MapView.java index 1b254c8..c2ddcb8 100644 --- a/src/mightypork/rogue/screens/gamescreen/world/MapView.java +++ b/src/mightypork/rogue/screens/gamescreen/world/MapView.java @@ -95,10 +95,8 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL { if (!event.isOver(this)) return; - if (!event.isUp()) return; // only btn-release evt - for (final MapInteractionPlugin p : plugins) { - p.onClick(this, pc, event.getPos()); + p.onClick(this, pc, event.getPos(), event.isDown()); } event.consume(); // only our clicks. @@ -108,10 +106,8 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL @Override public void receive(KeyEvent event) { - if (!event.isDown()) return; - for (final MapInteractionPlugin p : plugins) { - p.onKey(this, pc, event.getKey()); + p.onKey(this, pc, event.getKey(), event.isDown()); } // don't consume key events, can be useful for others. diff --git a/src/mightypork/util/math/color/Color.java b/src/mightypork/util/math/color/Color.java index b192236..01d960f 100644 --- a/src/mightypork/util/math/color/Color.java +++ b/src/mightypork/util/math/color/Color.java @@ -150,25 +150,25 @@ public abstract class Color { /** * @return red 0-1 */ - public abstract double red(); + public abstract double r(); /** * @return green 0-1 */ - public abstract double green(); + public abstract double g(); /** * @return blue 0-1 */ - public abstract double blue(); + public abstract double b(); /** * @return alpha 0-1 */ - public final double alpha() + public final double a() { double alpha = rawAlpha(); diff --git a/src/mightypork/util/math/color/ColorAlphaAdjuster.java b/src/mightypork/util/math/color/ColorAlphaAdjuster.java index 61db6e5..b92cca4 100644 --- a/src/mightypork/util/math/color/ColorAlphaAdjuster.java +++ b/src/mightypork/util/math/color/ColorAlphaAdjuster.java @@ -18,23 +18,23 @@ public class ColorAlphaAdjuster extends Color { @Override - public double red() + public double r() { - return source.red(); + return source.r(); } @Override - public double green() + public double g() { - return source.green(); + return source.g(); } @Override - public double blue() + public double b() { - return source.blue(); + return source.b(); } diff --git a/src/mightypork/util/math/color/ColorHsb.java b/src/mightypork/util/math/color/ColorHsb.java index e75f276..673da54 100644 --- a/src/mightypork/util/math/color/ColorHsb.java +++ b/src/mightypork/util/math/color/ColorHsb.java @@ -33,28 +33,28 @@ public class ColorHsb extends Color { @Override - public double red() + public double r() { return asRgb()[0]; } @Override - public double green() + public double g() { return asRgb()[1]; } @Override - public double blue() + public double b() { return asRgb()[2]; } @Override - public double rawAlpha() + protected double rawAlpha() { return asRgb()[3]; } diff --git a/src/mightypork/util/math/color/ColorRgb.java b/src/mightypork/util/math/color/ColorRgb.java index 15982a4..9e1eb09 100644 --- a/src/mightypork/util/math/color/ColorRgb.java +++ b/src/mightypork/util/math/color/ColorRgb.java @@ -22,28 +22,28 @@ public class ColorRgb extends Color { @Override - public double red() + public double r() { return clamp(r); } @Override - public double green() + public double g() { return clamp(g); } @Override - public double blue() + public double b() { return clamp(b); } @Override - public double rawAlpha() + protected double rawAlpha() { return clamp(a); }