minor tweaks

v5stable
Ondřej Hruška 11 years ago
parent 289145a9aa
commit 147f499e62
  1. 4
      src/mightypork/gamecore/render/Render.java
  2. 2
      src/mightypork/gamecore/render/fonts/impl/CachedFont.java
  3. 6
      src/mightypork/rogue/screens/gamescreen/world/MIPKeyWalk.java
  4. 8
      src/mightypork/rogue/screens/gamescreen/world/MIPMouseWalk.java
  5. 4
      src/mightypork/rogue/screens/gamescreen/world/MapInteractionPlugin.java
  6. 8
      src/mightypork/rogue/screens/gamescreen/world/MapView.java
  7. 8
      src/mightypork/util/math/color/Color.java
  8. 12
      src/mightypork/util/math/color/ColorAlphaAdjuster.java
  9. 8
      src/mightypork/util/math/color/ColorHsb.java
  10. 8
      src/mightypork/util/math/color/ColorRgb.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);
}

@ -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);

@ -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);
}

@ -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)
{
}

@ -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);
}

@ -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.

@ -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();

@ -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();
}

@ -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];
}

@ -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);
}

Loading…
Cancel
Save