Lots of small tweaks
- Added text outlining - Shrunk and moved compass bar (it no longer pretends to be a hotbar) - Changed cross to match text proportions - Refactored TileRenderSimple into TileRender{Opaque,Transparent}Surface - Also renamed OpaqueTile into OpaqueSurface - Added about and version info
This commit is contained in:
parent
e467d00877
commit
eb82c96390
@ -108,6 +108,10 @@ public class Font {
|
||||
return withStyle(getStyle() | Typeface.Style.SHADOW);
|
||||
}
|
||||
|
||||
public Font deriveOutlined() {
|
||||
return withStyle(getStyle() | Typeface.Style.OUTLINED);
|
||||
}
|
||||
|
||||
public Font deriveNotBold() {
|
||||
return withStyle(getStyle() & ~Typeface.Style.BOLD);
|
||||
}
|
||||
@ -128,6 +132,10 @@ public class Font {
|
||||
return withStyle(getStyle() & ~Typeface.Style.SHADOW);
|
||||
}
|
||||
|
||||
public Font deriveNotOutlined() {
|
||||
return withStyle(getStyle() & ~Typeface.Style.OUTLINED);
|
||||
}
|
||||
|
||||
public Font withAlign(float align) {
|
||||
return new Font(getTypeface(), getStyle(), align, getColor());
|
||||
}
|
||||
|
@ -430,6 +430,10 @@ public abstract class SpriteTypeface extends Typeface {
|
||||
return w.align * (w.totalSize.x - w.currentWidth);
|
||||
}
|
||||
|
||||
private static final float[][] OUTLINE_DIRECTIONS = new float[][] {
|
||||
{0, 1}, {1, 0}, {-1, 0}, {0, -1}
|
||||
};
|
||||
|
||||
private void drawLine(Drawer drawer, Workspace workspace) {
|
||||
int style = workspace.styles.peek();
|
||||
|
||||
@ -440,6 +444,29 @@ public abstract class SpriteTypeface extends Typeface {
|
||||
|
||||
drawPlainLine(drawer, workspace);
|
||||
|
||||
} else if (Style.isOutlined(style)) {
|
||||
|
||||
workspace.pushStyle(~Style.OUTLINED);
|
||||
|
||||
drawLine(drawer, workspace); // TODO figure out why placing this line after drawing outline reverses order of display (should be the opposite)
|
||||
workspace.pos.x = xToRestore;
|
||||
|
||||
Colors.multiplyRGB(workspace.pushColor(), getShadowColorMultiplier());
|
||||
|
||||
for (int i = 0; i < OUTLINE_DIRECTIONS.length; ++i) {
|
||||
float[] direction = OUTLINE_DIRECTIONS[i];
|
||||
|
||||
workspace.pushTransform().translate(direction[0] * getThickness(), direction[1] * getThickness(), 0);
|
||||
drawLine(drawer, workspace);
|
||||
workspace.transforms.pop();
|
||||
|
||||
if (i != OUTLINE_DIRECTIONS.length - 1) workspace.pos.x = xToRestore;
|
||||
}
|
||||
|
||||
workspace.colors.pop();
|
||||
|
||||
workspace.styles.pop();
|
||||
|
||||
} else if (Style.hasShadow(style)) {
|
||||
|
||||
workspace.pushStyle(~Style.SHADOW);
|
||||
|
@ -16,7 +16,8 @@ public abstract class Typeface extends Named {
|
||||
ITALIC = 1 << 1,
|
||||
UNDERLINED = 1 << 2,
|
||||
STRIKETHRU = 1 << 3,
|
||||
SHADOW = 1 << 4;
|
||||
SHADOW = 1 << 4,
|
||||
OUTLINED = 1 << 5;
|
||||
|
||||
public static final int PLAIN = 0;
|
||||
|
||||
@ -39,6 +40,10 @@ public abstract class Typeface extends Named {
|
||||
public static boolean hasShadow(int style) {
|
||||
return (style & SHADOW) != 0;
|
||||
}
|
||||
|
||||
public static boolean isOutlined(int style) {
|
||||
return (style & OUTLINED) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static final float ALIGN_LEFT = 0;
|
||||
|
@ -47,7 +47,7 @@ public class ChunkRenderOptimizerCube extends ChunkRenderOptimizer {
|
||||
public boolean isBlockOpaque();
|
||||
}
|
||||
|
||||
public static interface OpaqueTile {
|
||||
public static interface OpaqueSurface {
|
||||
public Texture getTexture(BlockFace face);
|
||||
public boolean isOpaque(BlockFace face);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class ChunkRenderOptimizerCube extends ChunkRenderOptimizer {
|
||||
static final int NO_OPAQUE_TILES = -1;
|
||||
|
||||
int topOpaqueTile = NO_OPAQUE_TILES;
|
||||
final OpaqueTile[] tiles = new OpaqueTile[TILES_PER_FACE];
|
||||
final OpaqueSurface[] tiles = new OpaqueSurface[TILES_PER_FACE];
|
||||
int tileCount = 0;
|
||||
}
|
||||
|
||||
@ -100,8 +100,8 @@ public class ChunkRenderOptimizerCube extends ChunkRenderOptimizer {
|
||||
|
||||
@Override
|
||||
public void processTile(TileRender tile, Vec3i pos, BlockFace face) {
|
||||
if (!(tile instanceof OpaqueTile)) return;
|
||||
OpaqueTile opaqueTile = (OpaqueTile) tile;
|
||||
if (!(tile instanceof OpaqueSurface)) return;
|
||||
OpaqueSurface opaqueTile = (OpaqueSurface) tile;
|
||||
addTile(pos, face, opaqueTile);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public class ChunkRenderOptimizerCube extends ChunkRenderOptimizer {
|
||||
getBlock(pos).block = cube;
|
||||
}
|
||||
|
||||
private void addTile(Vec3i pos, BlockFace face, OpaqueTile opaqueTile) {
|
||||
private void addTile(Vec3i pos, BlockFace face, OpaqueSurface opaqueTile) {
|
||||
FaceInfo faceInfo = getFace(pos, face);
|
||||
|
||||
int index = faceInfo.tileCount;
|
||||
|
@ -9,10 +9,10 @@ import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerCube.OpaqueTile;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerCube.OpaqueSurface;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
|
||||
public class TileRenderGrass extends TileRender implements OpaqueTile {
|
||||
public class TileRenderGrass extends TileRender implements OpaqueSurface {
|
||||
|
||||
private final Texture topTexture;
|
||||
private final Texture sideTexture;
|
||||
|
@ -0,0 +1,17 @@
|
||||
package ru.windcorp.progressia.client.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
|
||||
public class TileRenderOpaqueSurface extends TileRenderSurface {
|
||||
|
||||
public TileRenderOpaqueSurface(String id, Texture texture) {
|
||||
super(id, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -9,22 +9,16 @@ import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerCube.OpaqueTile;
|
||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerCube.OpaqueSurface;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
|
||||
public class TileRenderSimple extends TileRender implements OpaqueTile {
|
||||
public abstract class TileRenderSurface extends TileRender implements OpaqueSurface {
|
||||
|
||||
private final Texture texture;
|
||||
private final boolean opaque;
|
||||
|
||||
public TileRenderSimple(String id, Texture texture, boolean opaque) {
|
||||
public TileRenderSurface(String id, Texture texture) {
|
||||
super(id);
|
||||
this.texture = texture;
|
||||
this.opaque = opaque;
|
||||
}
|
||||
|
||||
public TileRenderSimple(String id, Texture texture) {
|
||||
this(id, texture, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,11 +26,6 @@ public class TileRenderSimple extends TileRender implements OpaqueTile {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
return opaque;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderable createRenderable(BlockFace face) {
|
||||
ShapeRenderProgram program = WorldRenderProgram.getDefault();
|
@ -0,0 +1,17 @@
|
||||
package ru.windcorp.progressia.client.world.tile;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.common.world.block.BlockFace;
|
||||
|
||||
public class TileRenderTransparentSurface extends TileRenderSurface {
|
||||
|
||||
public TileRenderTransparentSurface(String id, Texture texture) {
|
||||
super(id, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque(BlockFace face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -48,7 +48,17 @@ public class LayerTestGUI extends GUILayer {
|
||||
|
||||
Collection<Label> labels = new ArrayList<>();
|
||||
Vec4 color = Colors.WHITE;
|
||||
Font font = new Font().withColor(color).deriveShadow();
|
||||
Font font = new Font().withColor(color).deriveOutlined();
|
||||
Font aboutFont = font.withColor(0xFF37A3E6).deriveBold();
|
||||
|
||||
panel.addChild(new Label(
|
||||
"About", aboutFont,
|
||||
"\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0438\u044F / Progressia"
|
||||
));
|
||||
panel.addChild(new Label(
|
||||
"About", font,
|
||||
"Version: pre-TechDemo"
|
||||
));
|
||||
|
||||
panel.addChild(new Label(
|
||||
"IsFlyingDisplay", font,
|
||||
@ -111,8 +121,8 @@ public class LayerTestGUI extends GUILayer {
|
||||
)
|
||||
));
|
||||
panel.addChild(new Label(
|
||||
"SelectedTileDisplay", font,
|
||||
"(Blocks ↔ Tiles: Shift + Mouse Wheel)"
|
||||
"PlacementModeDisplay", font,
|
||||
"(Blocks \u2B04 Tiles: Ctrl + Mouse Wheel)"
|
||||
));
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class LayerTestUI extends AssembledFlatLayer {
|
||||
|
||||
private boolean flag = false;
|
||||
|
||||
private static final int WIDTH = 512 + 256;
|
||||
private static final int WIDTH = 80;
|
||||
private static final int HEIGHT = 80;
|
||||
private static final int BORDER = 5;
|
||||
|
||||
@ -55,7 +55,7 @@ public class LayerTestUI extends AssembledFlatLayer {
|
||||
final int borderColor = flag ? 0xFFAA4444 : 0xFFAAAA44;
|
||||
final int boxShadowColor = flag ? 0xFF440000 : 0xFF444400;
|
||||
|
||||
int x = (getWidth() - WIDTH) / 2;
|
||||
int x = 2*BORDER;
|
||||
int y = 2*BORDER;
|
||||
|
||||
target.fill(x + BORDER, y - BORDER, WIDTH, HEIGHT, boxShadowColor);
|
||||
@ -102,8 +102,8 @@ public class LayerTestUI extends AssembledFlatLayer {
|
||||
int cy = getHeight() / 2;
|
||||
|
||||
final int length = 15;
|
||||
final int thickness = 5;
|
||||
final int borderSize = 1;
|
||||
final int thickness = 6;
|
||||
final int borderSize = 2;
|
||||
final Vec4 borderColor = Colors.BLACK;
|
||||
final Vec4 fillColor = Colors.WHITE;
|
||||
|
||||
|
@ -101,27 +101,27 @@ public class TestContent {
|
||||
register(new TestTileLogicGrass("Test:Grass"));
|
||||
|
||||
register(new TileData("Test:Stones"));
|
||||
register(new TileRenderSimple("Test:Stones", getTileTexture("stones")));
|
||||
register(new TileRenderTransparentSurface("Test:Stones", getTileTexture("stones")));
|
||||
register(new HangingTileLogic("Test:Stones"));
|
||||
|
||||
register(new TileData("Test:YellowFlowers"));
|
||||
register(new TileRenderSimple("Test:YellowFlowers", getTileTexture("yellow_flowers")));
|
||||
register(new TileRenderTransparentSurface("Test:YellowFlowers", getTileTexture("yellow_flowers")));
|
||||
register(new HangingTileLogic("Test:YellowFlowers"));
|
||||
|
||||
register(new TileData("Test:Sand"));
|
||||
register(new TileRenderSimple("Test:Sand", getTileTexture("sand")));
|
||||
register(new TileRenderTransparentSurface("Test:Sand", getTileTexture("sand")));
|
||||
register(new HangingTileLogic("Test:Sand"));
|
||||
|
||||
register(new TileData("Test:SnowOpaque"));
|
||||
register(new TileRenderSimple("Test:SnowOpaque", getTileTexture("snow_opaque"), true));
|
||||
register(new TileRenderOpaqueSurface("Test:SnowOpaque", getTileTexture("snow_opaque")));
|
||||
register(new HangingTileLogic("Test:SnowOpaque"));
|
||||
|
||||
register(new TileData("Test:SnowHalf"));
|
||||
register(new TileRenderSimple("Test:SnowHalf", getTileTexture("snow_half")));
|
||||
register(new TileRenderTransparentSurface("Test:SnowHalf", getTileTexture("snow_half")));
|
||||
register(new HangingTileLogic("Test:SnowHalf"));
|
||||
|
||||
register(new TileData("Test:SnowQuarter"));
|
||||
register(new TileRenderSimple("Test:SnowQuarter", getTileTexture("snow_quarter")));
|
||||
register(new TileRenderTransparentSurface("Test:SnowQuarter", getTileTexture("snow_quarter")));
|
||||
register(new HangingTileLogic("Test:SnowQuarter"));
|
||||
|
||||
TileDataRegistry.getInstance().values().forEach(PLACEABLE_TILES::add);
|
||||
|
@ -277,7 +277,7 @@ public class TestPlayerControls {
|
||||
if (event.hasHorizontalMovement()) {
|
||||
switchPlacingMode();
|
||||
}
|
||||
if (InputTracker.isKeyPressed(GLFW.GLFW_KEY_LEFT_SHIFT)) {
|
||||
if (InputTracker.isKeyPressed(GLFW.GLFW_KEY_LEFT_CONTROL)) {
|
||||
switchPlacingMode();
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user