adds start of criteria gui

This commit is contained in:
Rosia E Evans 2024-04-21 13:27:41 +01:00
parent e2dc9dcc4b
commit bdc70403e9
2 changed files with 41 additions and 12 deletions

View file

@ -4,29 +4,55 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.monjaro.gamejam.main.Actor;
import com.monjaro.gamejam.main.Round;
public class SegmentUI extends Actor {
private Texture separator;
private Texture criteriaSheet;
private static Texture separator;
private static Texture criteriaSheet;
private Rectangle rect;
public SegmentUI(Rectangle rect) {
this.rect = rect;
}
@Override
public void tick() {
}
public static void setSeparator(Texture texture) {
separator = texture;
}
public static void setCriteriaSheet(Texture texture) {
criteriaSheet = texture;
}
@Override
public void render(SpriteBatch batch) {
// batch.end();
//
// ShapeRenderer renderer = new ShapeRenderer();
// renderer.begin(ShapeRenderer.ShapeType.Filled);
// renderer.setColor(0.4f, 0.7f, 0.4f, 1);
// renderer.rect(0, (Gdx.graphics.getHeight()/3)*2, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/3);
// renderer.end();
//
// batch.begin();
batch.end();
ShapeRenderer renderer = new ShapeRenderer();
renderer.begin(ShapeRenderer.ShapeType.Filled);
renderer.setColor(0.7f, 0.4f, 0.6f, 1);
renderer.rect(rect.x, rect.y, rect.width, rect.height);
renderer.end();
batch.begin();
int spriteWidth = 75;
int spriteHeight = 200;
Round round = Game.getRound();
// change 3
for (int i = 0; i < 3; i++) {
int criteriaType = 0 ;
int criteriaQuantity = 0;
batch.draw(criteriaSheet, rect.x + (spriteWidth*i), rect.y, spriteWidth, rect.height, spriteWidth*criteriaType, spriteHeight*criteriaQuantity, spriteWidth, spriteHeight, false, false);
}
}
}

View file

@ -6,6 +6,7 @@ import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.ScreenUtils;
import com.monjaro.gamejam.SegmentUI;
import com.monjaro.gamejam.segment.DualSegment;
@ -38,7 +39,7 @@ public class Game extends ApplicationAdapter {
font.getData().markupEnabled = true;
img = new Texture("badlogic.jpg");
segUi = new SegmentUI();
segUi = new SegmentUI(new Rectangle(0, (Gdx.graphics.getHeight()/3)*2, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/3));
ui = new UI(this, 50, 280);
round = new Round(List.of(new OlympicSegment(1), new OlympicSegment(3), new KinSegment(3), new DualSegment(false)), List.of(new ParityDecay(true)), 5);
@ -47,6 +48,8 @@ public class Game extends ApplicationAdapter {
Face.setPipSprite(new Texture("pip.png"));
Die.setLockedSprite(new Texture("locked_die_border.png"));
UI.setRerollTexture(new Texture("reroll_symbol.png"));
SegmentUI.setCriteriaSheet(new Texture("criteria_red.png"));
// SegmentUI.setCriteriaSheet(""); not made yet
float divide = Gdx.graphics.getWidth() / 6f;
for (int i = 0; i < 5; i++) {