Incremented version and made some small changes
- Version is now pre-alpha 2. Yay? - Removed compass display in the lower-left - The cross can now be hidden by pressing F1 - Does not hide LayerAbout though - Generator spawns the player in the middle of a surface rather than at its edge
This commit is contained in:
parent
2328f2ae3a
commit
6f90bf345b
@ -69,7 +69,7 @@ public class PlanetGenerator extends AbstractWorldGenerator<Boolean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 suggestSpawnLocation() {
|
public Vec3 suggestSpawnLocation() {
|
||||||
return new Vec3(407f, 1f, getPlanet().getRadius() + 10);
|
return new Vec3(7f, 1f, getPlanet().getRadius() + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,7 +50,7 @@ public class LayerAbout extends GUILayer {
|
|||||||
new Label(
|
new Label(
|
||||||
"Version",
|
"Version",
|
||||||
font,
|
font,
|
||||||
new MutableStringLocalized("LayerAbout.Version").format("pre-alpha 1")
|
new MutableStringLocalized("LayerAbout.Version").format("pre-alpha 2")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -15,14 +15,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ru.windcorp.progressia.test;
|
package ru.windcorp.progressia.test;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
|
||||||
import glm.mat._4.Mat4;
|
|
||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.GraphicsInterface;
|
import ru.windcorp.progressia.client.graphics.backend.GraphicsInterface;
|
||||||
@ -30,9 +29,6 @@ import ru.windcorp.progressia.client.graphics.flat.AssembledFlatLayer;
|
|||||||
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
|
import ru.windcorp.progressia.client.graphics.flat.RenderTarget;
|
||||||
import ru.windcorp.progressia.client.graphics.input.KeyEvent;
|
import ru.windcorp.progressia.client.graphics.input.KeyEvent;
|
||||||
import ru.windcorp.progressia.client.graphics.input.bus.Input;
|
import ru.windcorp.progressia.client.graphics.input.bus.Input;
|
||||||
import ru.windcorp.progressia.client.graphics.model.LambdaModel;
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.SimpleTextures;
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
|
||||||
|
|
||||||
public class LayerTestUI extends AssembledFlatLayer {
|
public class LayerTestUI extends AssembledFlatLayer {
|
||||||
|
|
||||||
@ -42,55 +38,13 @@ public class LayerTestUI extends AssembledFlatLayer {
|
|||||||
GraphicsInterface.subscribeToInputEvents(this);
|
GraphicsInterface.subscribeToInputEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean flag = false;
|
private boolean drawUI = true;
|
||||||
|
|
||||||
private static final int SCALE = 4;
|
|
||||||
private static final int TEX_SIZE = 16 * SCALE;
|
|
||||||
private static final int TEX_SHADOW = SCALE / 2;
|
|
||||||
private static final int BORDER = 5;
|
|
||||||
private static final int HEIGHT = TEX_SIZE + 4 * BORDER;
|
|
||||||
private static final int WIDTH = HEIGHT;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void assemble(RenderTarget target) {
|
protected void assemble(RenderTarget target) {
|
||||||
final int boxColor = flag ? 0xFFEE8888 : 0xFFEEEE88;
|
if (drawUI) {
|
||||||
final int borderColor = flag ? 0xFFAA4444 : 0xFFAAAA44;
|
drawCross(target);
|
||||||
final int boxShadowColor = flag ? 0xFF440000 : 0xFF444400;
|
}
|
||||||
|
|
||||||
int x = 2 * BORDER;
|
|
||||||
int y = 2 * BORDER;
|
|
||||||
|
|
||||||
target.fill(x + BORDER, y - BORDER, WIDTH, HEIGHT, boxShadowColor);
|
|
||||||
target.fill(x - 1, y - 1, WIDTH + 2, HEIGHT + 2, boxShadowColor);
|
|
||||||
target.fill(x, y, WIDTH, HEIGHT, borderColor);
|
|
||||||
target.fill(x + BORDER, y + BORDER, WIDTH - 2 * BORDER, HEIGHT - 2 * BORDER, boxColor);
|
|
||||||
|
|
||||||
target.pushTransform(new Mat4().identity().translate(x + 2 * BORDER, y + 2 * BORDER, 0));
|
|
||||||
|
|
||||||
final Texture compassBg = SimpleTextures.get("compass_icon");
|
|
||||||
final Texture compassFg = SimpleTextures.get("compass_icon_arrow");
|
|
||||||
|
|
||||||
target.drawTexture(TEX_SHADOW, -TEX_SHADOW, TEX_SIZE, TEX_SIZE, Colors.BLACK, compassBg);
|
|
||||||
target.drawTexture(0, 0, TEX_SIZE, TEX_SIZE, compassBg);
|
|
||||||
|
|
||||||
target.addCustomRenderer(
|
|
||||||
new LambdaModel(
|
|
||||||
LambdaModel.lambdaBuilder()
|
|
||||||
.addDynamicPart(
|
|
||||||
target.createRectagle(0, 0, TEX_SIZE, TEX_SIZE, Colors.WHITE, compassFg),
|
|
||||||
mat -> mat.translate(TEX_SIZE / 2, TEX_SIZE / 2, 0)
|
|
||||||
.rotateZ(getCompassRotation())
|
|
||||||
.translate(-TEX_SIZE / 2, -TEX_SIZE / 2, 0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
target.popTransform();
|
|
||||||
|
|
||||||
drawCross(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getCompassRotation() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawCross(RenderTarget target) {
|
private void drawCross(RenderTarget target) {
|
||||||
@ -138,16 +92,16 @@ public class LayerTestUI extends AssembledFlatLayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleInput(Input input) {
|
protected void handleInput(Input input) {
|
||||||
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onKeyEvent(KeyEvent event) {
|
public void onKeyEvent(KeyEvent event) {
|
||||||
if (event.isRepeat() || event.getKey() != GLFW.GLFW_KEY_LEFT_CONTROL) {
|
if (!event.isPress() || event.getKey() != GLFW.GLFW_KEY_F1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
flag = event.isPress();
|
drawUI = !drawUI;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user