adds basis for dieNetUi
This commit is contained in:
parent
cd72eae378
commit
a5d09f79c1
3 changed files with 56 additions and 0 deletions
43
core/src/com/monjaro/gamejam/main/DieNetUi.java
Normal file
43
core/src/com/monjaro/gamejam/main/DieNetUi.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package com.monjaro.gamejam.main;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
|
||||
import static com.badlogic.gdx.graphics.GL20.*;
|
||||
|
||||
public class DieNetUi extends Actor{
|
||||
private Die die;
|
||||
private Rectangle rect;
|
||||
private boolean visible;
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(SpriteBatch batch) {
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
|
||||
batch.end();
|
||||
|
||||
|
||||
Gdx.gl.glEnable(GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
ShapeRenderer renderer = new ShapeRenderer();
|
||||
renderer.begin(ShapeRenderer.ShapeType.Filled);
|
||||
renderer.setColor(0.1f, 0.1f, 0.1f, 0.7f);
|
||||
renderer.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
renderer.end();
|
||||
|
||||
batch.begin();
|
||||
}
|
||||
|
||||
public void setVisible(boolean b) {
|
||||
visible = b;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@ import com.monjaro.gamejam.segment.*;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import static com.badlogic.gdx.graphics.GL20.*;
|
||||
|
||||
public class Game extends ApplicationAdapter {
|
||||
|
||||
private final List<Die> dice = new ArrayList<>();
|
||||
|
@ -32,6 +34,7 @@ public class Game extends ApplicationAdapter {
|
|||
private UI ui;
|
||||
private SegmentUI segUi;
|
||||
private ShopeUi shopeUi;
|
||||
private DieNetUi dieNet;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
|
@ -43,6 +46,8 @@ public class Game extends ApplicationAdapter {
|
|||
|
||||
ui = new UI(this, 50, 280);
|
||||
|
||||
dieNet = new DieNetUi();
|
||||
|
||||
shopeUi = new ShopeUi();
|
||||
ShopeUi.setGame(this);
|
||||
|
||||
|
@ -85,6 +90,8 @@ public class Game extends ApplicationAdapter {
|
|||
round.reduceRerolls(1);
|
||||
}
|
||||
|
||||
dieNet.setVisible(input.isKeyPressed(Input.Keys.CONTROL_LEFT));
|
||||
|
||||
if (input.isKeyPressed(Input.Keys.SHIFT_LEFT)) {
|
||||
for (int i = 0; i < round.getSegments().size(); i++) {
|
||||
int keyCode = Input.Keys.NUM_1 + i; //keycode for the current segment, shift + 1, 2...9, 0 on keyboard
|
||||
|
@ -166,6 +173,8 @@ public class Game extends ApplicationAdapter {
|
|||
|
||||
shopeUi.render(batch);
|
||||
|
||||
dieNet.render(batch);
|
||||
|
||||
batch.end();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.monjaro.gamejam;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
import com.monjaro.gamejam.main.Game;
|
||||
|
||||
import static com.badlogic.gdx.graphics.GL20.*;
|
||||
|
||||
// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument
|
||||
public class DesktopLauncher {
|
||||
|
||||
|
@ -13,6 +16,7 @@ public class DesktopLauncher {
|
|||
config.setTitle("GameJam");
|
||||
config.setWindowedMode(480, 800);
|
||||
config.setResizable(false);
|
||||
|
||||
new Lwjgl3Application(new Game(), config);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue