feat: really basic zoom functionnality

This commit is contained in:
Laureηt 2021-04-23 17:32:17 +02:00
parent 939ceaed4a
commit 8b95bc03a5
3 changed files with 13 additions and 4 deletions

View file

@ -1,14 +1,14 @@
package sagittarius.view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Group;
import org.omg.CORBA.Current;
import sagittarius.SagittariusGame;
import sagittarius.model.*;
@ -43,6 +43,8 @@ public class GameScreen extends BaseScreen {
@Override
public void initialize() {
Gdx.input.setInputProcessor(null); // on a pas de boutons
// planets & moons
attractors = new Group();
@ -118,6 +120,12 @@ public class GameScreen extends BaseScreen {
mainCameraPosition.scl(ispeed);
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;
}
}
/**

View file

@ -19,12 +19,12 @@ public class SettingsScreen extends BaseScreen {
@Override
public void initialize() {
Gdx.input.setInputProcessor(mainStage);
Gdx.input.setInputProcessor(uiStage);
// Table creation
VisTable table = new VisTable(true);
table.setFillParent(true);
mainStage.addActor(table);
uiStage.addActor(table);
VisLabel errorLabel = new VisLabel();
errorLabel.setColor(Color.RED);

View file

@ -12,6 +12,7 @@ public class DesktopLauncher {
config.setForegroundFPS(120);
config.setWindowedMode(1920, 1080);
config.setDecorated(false);
config.setResizable(false);
new Lwjgl3Application(new SagittariusGame(), config);