|
|
|
|
@ -4,6 +4,8 @@ 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;
|
|
|
|
|
@ -12,8 +14,12 @@ 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));
|
|
|
|
|
buttons.add(new Button(-1,0,0,200,200,"MainMenuScreen", Color.BLACK,Color.WHITE));
|
|
|
|
|
texts.add(new Text(500,500,"EHRE",Color.RED));
|
|
|
|
|
|
|
|
|
|
buttons.add(new Button(0,0,800,200,100, "MainMenu", Color.BLACK,Color.WHITE));
|
|
|
|
|
buttons.add(new Button(1,200,800,200,100, "GameScreen", Color.DARK_GRAY,Color.WHITE));
|
|
|
|
|
buttons.add(new Button(2,400,800,200,100, "EndScreen", Color.BLACK,Color.WHITE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -34,6 +40,13 @@ public class MainMenuScreen extends Screen {
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|