package sagittarius.view; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Group; import sagittarius.model.*; public class GameScreen extends BaseScreen { // ---------- ATTRIBUTEs ---------- // Cursors public static Vector2 screenCursor; private static Vector3 unprojectedCursor; public static Vector2 worldCursor; // Groups // TODO: move this in SagittariusGame ? public static Group planets; public static Group arrows; // ---------- METHODs ---------- @Override public void initialize() { // planets planets = new Group(); Planet planet1 = new Planet(new Vector2(400, 400), 1000, 50, Color.BLUE); planets.addActor(planet1); Planet planet2 = new Planet(new Vector2(1400, 700), 1000, 100, Color.ORANGE); planet2.addMoon(new Moon(planet2, 100, 10, 300, Color.MAGENTA)); planets.addActor(planet2); mainStage.addActor(planets); // players Player player1 = new Player(planet1, Color.WHITE); mainStage.addActor(player1); // arrows arrows = new Group(); mainStage.addActor(arrows); // others FPS fpsCounter = new FPS(); uiStage.addActor(fpsCounter); MouseInfo mouseInfo = new MouseInfo(); uiStage.addActor(mouseInfo); mainStage.setDebugAll(true); // TODO: disable later } @Override public void update(float dt) { screenCursor = new Vector2(Gdx.input.getX(), Gdx.input.getY()); unprojectedCursor = mainStage.getCamera().unproject(new Vector3(screenCursor, 0)); worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y); } }