feat: modifed GameScreen according to last commits
This commit is contained in:
parent
51495f7509
commit
56bde9124c
|
@ -1,10 +1,9 @@
|
||||||
package sagittarius.view;
|
package sagittarius.view;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
|
||||||
|
|
||||||
import sagittarius.model.*;
|
import sagittarius.model.*;
|
||||||
|
|
||||||
|
@ -15,26 +14,43 @@ public class GameScreen extends BaseScreen {
|
||||||
// Constants
|
// Constants
|
||||||
public static final int G = 100;
|
public static final int G = 100;
|
||||||
|
|
||||||
|
// Cursors
|
||||||
|
public static Vector2 screenCursor;
|
||||||
|
private static Vector3 unprojectedCursor;
|
||||||
|
public static Vector2 worldCursor;
|
||||||
|
|
||||||
|
|
||||||
// ---------- METHODs ----------
|
// ---------- METHODs ----------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
mainStage = new Stage();
|
mainStage.setDebugAll(true); // TODO: disable later
|
||||||
|
|
||||||
Planet planet1 = new Planet(new Vector2(400, 400), 1000, 200, Color.WHITE);
|
Planet planet1 = new Planet(new Vector2(400, 400), 1000, 50, Color.BLUE);
|
||||||
planet1.setDebug(true);
|
|
||||||
mainStage.addActor(planet1);
|
mainStage.addActor(planet1);
|
||||||
|
|
||||||
|
Planet planet2 = new Planet(new Vector2(1400, 700), 1000, 100, Color.ORANGE);
|
||||||
|
mainStage.addActor(planet2);
|
||||||
|
|
||||||
Player player1 = new Player(planet1, Color.WHITE);
|
Player player1 = new Player(planet1, Color.WHITE);
|
||||||
player1.setDebug(true);
|
|
||||||
mainStage.addActor(player1);
|
mainStage.addActor(player1);
|
||||||
|
|
||||||
|
FPS fpsCounter = new FPS();
|
||||||
|
uiStage.addActor(fpsCounter);
|
||||||
|
|
||||||
|
MouseInfo mouseInfo = new MouseInfo();
|
||||||
|
uiStage.addActor(mouseInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(float dt) {
|
public void update(float dt) {
|
||||||
// todo ?
|
|
||||||
|
screenCursor = new Vector2(Gdx.input.getX(), Gdx.input.getY());
|
||||||
|
unprojectedCursor = mainStage.getCamera().unproject(new Vector3(screenCursor, 0));
|
||||||
|
worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue