feat: really basic zoom functionnality
This commit is contained in:
parent
939ceaed4a
commit
8b95bc03a5
|
@ -1,14 +1,14 @@
|
||||||
package sagittarius.view;
|
package sagittarius.view;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Input.Buttons;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||||
|
|
||||||
import org.omg.CORBA.Current;
|
|
||||||
|
|
||||||
import sagittarius.SagittariusGame;
|
import sagittarius.SagittariusGame;
|
||||||
import sagittarius.model.*;
|
import sagittarius.model.*;
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ public class GameScreen extends BaseScreen {
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
|
Gdx.input.setInputProcessor(null); // on a pas de boutons
|
||||||
|
|
||||||
// planets & moons
|
// planets & moons
|
||||||
attractors = new Group();
|
attractors = new Group();
|
||||||
|
|
||||||
|
@ -118,6 +120,12 @@ public class GameScreen extends BaseScreen {
|
||||||
mainCameraPosition.scl(ispeed);
|
mainCameraPosition.scl(ispeed);
|
||||||
mainCameraPosition.add(new Vector3(focus.getPosition(), 0).scl(speed));
|
mainCameraPosition.add(new Vector3(focus.getPosition(), 0).scl(speed));
|
||||||
|
|
||||||
|
if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
|
||||||
|
((OrthographicCamera) mainStage.getCamera()).zoom = 2f;
|
||||||
|
} else {
|
||||||
|
((OrthographicCamera) mainStage.getCamera()).zoom = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,12 +19,12 @@ public class SettingsScreen extends BaseScreen {
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
Gdx.input.setInputProcessor(mainStage);
|
Gdx.input.setInputProcessor(uiStage);
|
||||||
|
|
||||||
// Table creation
|
// Table creation
|
||||||
VisTable table = new VisTable(true);
|
VisTable table = new VisTable(true);
|
||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
mainStage.addActor(table);
|
uiStage.addActor(table);
|
||||||
|
|
||||||
VisLabel errorLabel = new VisLabel();
|
VisLabel errorLabel = new VisLabel();
|
||||||
errorLabel.setColor(Color.RED);
|
errorLabel.setColor(Color.RED);
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class DesktopLauncher {
|
||||||
config.setForegroundFPS(120);
|
config.setForegroundFPS(120);
|
||||||
config.setWindowedMode(1920, 1080);
|
config.setWindowedMode(1920, 1080);
|
||||||
config.setDecorated(false);
|
config.setDecorated(false);
|
||||||
|
config.setResizable(false);
|
||||||
|
|
||||||
new Lwjgl3Application(new SagittariusGame(), config);
|
new Lwjgl3Application(new SagittariusGame(), config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue