commit
6ea195db76
@ -0,0 +1,44 @@
|
||||
package com.trs.game.view.Screens;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.trs.game.view.Button;
|
||||
import com.trs.game.view.Screen;
|
||||
import com.trs.game.view.Text;
|
||||
|
||||
public class EndScreen extends Screen {
|
||||
|
||||
public EndScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT){
|
||||
super(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, 2);
|
||||
buttons.add(new Button(0,0,0,200,200,"EndScreen", Color.BLACK,Color.WHITE));
|
||||
texts.add(new Text(500,500,"EHREEHREEHRE",Color.RED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void timer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(SpriteBatch batch, ShapeRenderer renderer, BitmapFont font) {
|
||||
for(Button button : buttons){
|
||||
button.render(batch,renderer,font);
|
||||
}
|
||||
for(Text text : texts){
|
||||
text.render(batch,font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int touchDown(int x, int y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.trs.game.view.Screens;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.Intersector;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.trs.game.view.Button;
|
||||
import com.trs.game.view.Screen;
|
||||
import com.trs.game.view.Text;
|
||||
|
||||
public class GameScreen extends Screen {
|
||||
|
||||
public GameScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT){
|
||||
super(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, 1);
|
||||
buttons.add(new Button(0,0,0,200,200,"GameScreen", Color.BLACK,Color.WHITE));
|
||||
texts.add(new Text(500,500,"EHREEHRE",Color.RED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void timer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(SpriteBatch batch, ShapeRenderer renderer, BitmapFont font) {
|
||||
for(Button button : buttons){
|
||||
button.render(batch,renderer,font);
|
||||
}
|
||||
for(Text text : texts){
|
||||
text.render(batch,font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int touchDown(int x, int y) {
|
||||
Rectangle r = new Rectangle(x,y,1,1);
|
||||
for(Button button : buttons){
|
||||
if(Intersector.overlaps(r, button.getRect())){
|
||||
System.out.println(button.getId());
|
||||
return button.getId();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.trs.game.view.Screens;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.trs.game.view.Button;
|
||||
import com.trs.game.view.Screen;
|
||||
import com.trs.game.view.Text;
|
||||
|
||||
public class MainMenuScreen extends Screen {
|
||||
|
||||
public MainMenuScreen(int GAME_WORLD_WIDTH, int GAME_WORLD_HEIGHT){
|
||||
super(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, 0);
|
||||
buttons.add(new Button(0,0,0,200,200,"MainMenuScreen", Color.BLACK,Color.WHITE));
|
||||
texts.add(new Text(500,500,"EHRE",Color.RED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void timer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(SpriteBatch batch, ShapeRenderer renderer, BitmapFont font) {
|
||||
for(Button button : buttons){
|
||||
button.render(batch,renderer,font);
|
||||
}
|
||||
for(Text text : texts){
|
||||
text.render(batch,font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int touchDown(int x, int y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.trs.game.view;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
|
||||
public class Text {
|
||||
|
||||
int xPos;
|
||||
int yPos;
|
||||
String text;
|
||||
Color color;
|
||||
|
||||
public Text(int xPos, int yPos, String text, Color color){
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
this.text = text;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void render(SpriteBatch batch, BitmapFont font){
|
||||
if(batch.isDrawing()) batch.end();
|
||||
batch.begin();
|
||||
font.setColor(color);
|
||||
font.draw(batch,text,xPos,yPos);
|
||||
batch.end();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue