new graphics for logo

v5stable
Ondřej Hruška 10 years ago
parent 65efbe33da
commit aac26f47f4
  1. BIN
      res/img/dudes.xcf
  2. BIN
      res/img/logo.png
  3. BIN
      res/img/logo.xcf
  4. BIN
      res/img/logo2.png
  5. BIN
      res/img/logo2.xcf
  6. 22
      src/mightypork/gamecore/gui/components/painters/ImagePainter.java
  7. 16
      src/mightypork/gamecore/resources/fonts/impl/CachedFont.java
  8. 3
      src/mightypork/gamecore/resources/textures/DeferredTexture.java
  9. 14
      src/mightypork/gamecore/util/math/constraints/rect/Rect.java
  10. 16
      src/mightypork/gamecore/util/math/constraints/rect/RectConst.java
  11. 5
      src/mightypork/rogue/Res.java
  12. 18
      src/mightypork/rogue/screens/menu/MenuLayer.java

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

@ -4,6 +4,8 @@ package mightypork.gamecore.gui.components.painters;
import mightypork.gamecore.gui.components.VisualComponent;
import mightypork.gamecore.render.Render;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.util.math.constraints.num.Num;
import mightypork.gamecore.util.math.constraints.rect.Rect;
/**
@ -13,31 +15,31 @@ import mightypork.gamecore.resources.textures.TxQuad;
*/
public class ImagePainter extends VisualComponent {
private TxQuad texture;
private final TxQuad txQuad;
private boolean aspratio = false;
private Rect asprRect;
/**
* @param texture drawn image
* @param txQuad drawn image
*/
public ImagePainter(TxQuad texture)
public ImagePainter(TxQuad txQuad)
{
this.texture = texture;
this.txQuad = txQuad;
this.asprRect = ((Rect) this).axisV().grow(height().div(txQuad.uvs.height()).mul(txQuad.uvs.width()).half(), Num.ZERO);;
}
/**
* @param texture texture to use
*/
public void setTexture(TxQuad texture)
public void keepAspectRatio()
{
this.texture = texture;
aspratio = true;
}
@Override
public void renderComponent()
{
Render.quadTextured(getRect(), texture);
Render.quadTextured(aspratio ? asprRect : this, txQuad);
}
}

@ -310,13 +310,13 @@ public class CachedFont implements GLFont {
glGenTextures(textureId);
glBindTexture(GL_TEXTURE_2D, textureId.get(0));
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter.num);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter.num);
GLU.gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat, width, height, format, GL_UNSIGNED_BYTE, byteBuffer);
return textureId.get(0);
@ -381,7 +381,17 @@ public class CachedFont implements GLFont {
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter.num);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter.num);
glColor4d(color.r(), color.g(), color.b(), color.a());
glBegin(GL_QUADS);

@ -75,6 +75,8 @@ public class DeferredTexture extends DeferredResource implements GLTexture {
if (lastBind != this) {
lastBind = this;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, getTextureID());
GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrap.num);
@ -83,7 +85,6 @@ public class DeferredTexture extends DeferredResource implements GLTexture {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter.num);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter.num);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, getTextureID());
}
}

@ -191,6 +191,8 @@ public abstract class Rect implements RectBound, Digestable<RectDigest> {
private Rect p_edge_r;
private Rect p_edge_t;
private Rect p_edge_b;
private Rect p_axis_v;
private Rect p_axis_h;
private final DigestCache<RectDigest> dc = new DigestCache<RectDigest>() {
@ -912,6 +914,17 @@ public abstract class Rect implements RectBound, Digestable<RectDigest> {
return p_edge_b != null ? p_edge_b : (p_edge_b = bottomLeft().expand(Num.ZERO, width(), Num.ZERO, Num.ZERO));
}
public Rect axisV()
{
return p_axis_v != null ? p_axis_v : (p_axis_v = topCenter().expand(Num.ZERO, Num.ZERO, Num.ZERO, height()));
}
public Rect axisH()
{
return p_axis_h != null ? p_axis_h : (p_axis_h = centerLeft().expand(Num.ZERO, width(), Num.ZERO, Num.ZERO));
}
/**
* Center to given point
@ -1045,5 +1058,6 @@ public abstract class Rect implements RectBound, Digestable<RectDigest> {
// overflow || intersect
return ((rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry));
}
}

@ -38,6 +38,8 @@ public class RectConst extends Rect {
private RectDigest digest;
private RectConst v_floor;
private RectConst v_ceil;
private RectConst v_axis_v;
private RectConst v_axis_h;
/**
@ -315,6 +317,20 @@ public class RectConst extends Rect {
}
@Override
public Rect axisV()
{
return (v_axis_v != null) ? v_axis_v : (v_axis_v = super.axisV().freeze());
}
@Override
public Rect axisH()
{
return (v_axis_h != null) ? v_axis_h : (v_axis_h = super.axisH().freeze());
}
@Override
public Rect shrink(Vect shrink)
{

@ -10,6 +10,7 @@ import mightypork.gamecore.resources.fonts.GLFont;
import mightypork.gamecore.resources.fonts.Glyphs;
import mightypork.gamecore.resources.fonts.impl.DeferredFont;
import mightypork.gamecore.resources.textures.*;
import mightypork.gamecore.util.math.constraints.rect.Rect;
/**
@ -81,6 +82,10 @@ public final class Res {
textures.addSheet("sprite.player", tiles.makeSheet(0, 0, 4, 1));
textures.addSheet("sprite.rat", tiles.makeSheet(0, 1, 4, 1));
// sprites
texture = textures.loadTexture("logo2", "/res/img/logo2.png", FilterMode.NEAREST, WrapMode.CLAMP);
textures.addQuad("logo", texture.makeQuad(Rect.make(0, 0, 0.543, 0.203)));
// small sheet
texture = textures.loadTexture("tiles", "/res/img/tiles16.png", FilterMode.NEAREST, WrapMode.CLAMP);
tiles = texture.grid(8, 8);

@ -4,11 +4,13 @@ package mightypork.rogue.screens.menu;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.AlignX;
import mightypork.gamecore.gui.components.layout.GridLayout;
import mightypork.gamecore.gui.components.painters.ImagePainter;
import mightypork.gamecore.gui.components.painters.QuadPainter;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.events.CrossfadeRequest;
import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.gui.screens.ScreenLayer;
import mightypork.gamecore.util.math.color.Color;
import mightypork.gamecore.util.math.color.pal.COMMODORE;
import mightypork.gamecore.util.math.color.pal.PAL16;
import mightypork.gamecore.util.math.color.pal.RGB;
@ -30,28 +32,28 @@ class MenuLayer extends ScreenLayer {
private void init()
{
final Rect menuBox = root.shrink(Num.ZERO, root.height().mul(0.18)); //.moveY(root.height().mul(-0.03))
final Rect menuBox = root.shrink(Num.ZERO, root.height().mul(0.15)).moveY(root.height().mul(-0.04));
final GridLayout layout = new GridLayout(root, menuBox, 17, 1);
final GridLayout layout = new GridLayout(root, menuBox, 14, 1);
layout.enableCaching(true);
final QuadPainter bg = QuadPainter.gradV(PAL16.NIGHTBLUE, PAL16.SEABLUE);
final QuadPainter bg = QuadPainter.gradV(Color.fromHex(0x007eb3), PAL16.SEABLUE);
bg.setRect(root);
root.add(bg);
root.add(layout);
int r = 0;
final TextPainter tp = new TextPainter(Res.getFont("main_menu_title"), AlignX.CENTER, COMMODORE.PURPLE, "Rats");
tp.setShadow(RGB.BLACK.withAlpha(0.6), Vect.make(tp.height().div(16)));
layout.put(tp, r, 0, 3, 1);
r += 5;
ImagePainter ip = new ImagePainter(Res.getTxQuad("logo"));
ip.keepAspectRatio();
layout.put(ip, r, 0, 5, 1);
r += 6;
MenuButton btn;
// world button
btn = new MenuButton("World Test", PAL16.SLIMEGREEN);
btn = new MenuButton("Game", PAL16.SLIMEGREEN);
btn.setAction(new Action() {
@Override

Loading…
Cancel
Save