adds working segment ui
This commit is contained in:
parent
5abd65c7b4
commit
d7bcd3e3b8
5 changed files with 31 additions and 15 deletions
|
@ -6,6 +6,7 @@ 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.Game;
|
||||
import com.monjaro.gamejam.main.Round;
|
||||
|
||||
public class SegmentUI extends Actor {
|
||||
|
@ -13,6 +14,7 @@ public class SegmentUI extends Actor {
|
|||
private static Texture separator;
|
||||
private static Texture criteriaSheet;
|
||||
private Rectangle rect;
|
||||
private Game game;
|
||||
|
||||
public SegmentUI(Rectangle rect) {
|
||||
this.rect = rect;
|
||||
|
@ -23,6 +25,10 @@ public class SegmentUI extends Actor {
|
|||
|
||||
}
|
||||
|
||||
public void setGame(Game game){
|
||||
this.game = game;
|
||||
}
|
||||
|
||||
public static void setSeparator(Texture texture) {
|
||||
separator = texture;
|
||||
}
|
||||
|
@ -45,12 +51,18 @@ public class SegmentUI extends Actor {
|
|||
|
||||
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);
|
||||
Round round = game.getRound();
|
||||
|
||||
int numOfSegments = round.getSegments().size();
|
||||
for (int i = 0; i < numOfSegments; i++) {
|
||||
int criteriaType = round.getSegments().get(i).getSpriteColumn();
|
||||
int criteriaQuantity = round.getSegments().get(i).getSpriteRow();
|
||||
batch.draw(criteriaSheet,
|
||||
rect.x + ((rect.width/(numOfSegments+1))*(i+1))-spriteWidth/2, ((rect.y + rect.height/2)-spriteHeight/2),
|
||||
spriteWidth, spriteHeight,
|
||||
spriteWidth*criteriaType, spriteHeight*(criteriaQuantity),
|
||||
spriteWidth, spriteHeight,
|
||||
false, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,15 +40,20 @@ public class Game extends ApplicationAdapter {
|
|||
img = new Texture("badlogic.jpg");
|
||||
|
||||
segUi = new SegmentUI(new Rectangle(0, (Gdx.graphics.getHeight()/3)*2, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/3));
|
||||
segUi.setGame(this);
|
||||
|
||||
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);
|
||||
round = new Round(List.of(new OlympicSegment(2), new OlympicSegment(3), new KinSegment(3), new DualSegment(false)), List.of(new ParityDecay(true)), 5);
|
||||
|
||||
for (Segment segment : round.getSegments()) {
|
||||
System.out.println(segment.getName() + ": " + segment.getSpriteColumn() + ", " + segment.getSpriteRow());
|
||||
}
|
||||
|
||||
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
|
||||
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(new Texture("criteria.png"));
|
||||
// SegmentUI.setCriteriaSheet(""); not made yet
|
||||
|
||||
float divide = Gdx.graphics.getWidth() / 6f;
|
||||
|
|
|
@ -57,12 +57,11 @@ public class DualSegment extends Segment {
|
|||
|
||||
@Override
|
||||
public int getSpriteColumn() {
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpriteRow() {
|
||||
return 0;
|
||||
return firstTrio ? 1 : 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -43,7 +43,7 @@ public class KinSegment extends Segment { //multiple dice of the same value
|
|||
|
||||
@Override
|
||||
public int getSpriteRow() {
|
||||
return 0;
|
||||
return requirement - 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ public class OlympicSegment extends Segment {
|
|||
|
||||
@Override
|
||||
public int getSpriteColumn() {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpriteRow() {
|
||||
return 0;
|
||||
return length - 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue