Simple Screens and so
This commit is contained in:
parent
76cc7e8e47
commit
bc201739b8
BIN
android/assets/data/jet.png
Normal file
BIN
android/assets/data/jet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@ -2,7 +2,7 @@ package de.samdev.colorrunner;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
|
||||
import de.samdev.colorrunner.screens.GameScreen;
|
||||
import de.samdev.colorrunner.screens.gameScreen.GameScreen;
|
||||
|
||||
public class CRGame extends Game {
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class DemoActor extends Actor {
|
||||
addListener(new InputListener() {
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||
System.out.println("touch my one more time");
|
||||
Gdx.app.log("CRGame", "touch my one more time");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -1,18 +1,30 @@
|
||||
package de.samdev.colorrunner.screens;
|
||||
package de.samdev.colorrunner.screens.gameScreen;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction;
|
||||
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||
|
||||
public class GameScreen implements Screen {
|
||||
import de.samdev.colorrunner.actors.DemoActor;
|
||||
|
||||
public class GameScreen implements Screen {
|
||||
private Stage stage;
|
||||
|
||||
public GameScreen() {
|
||||
stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); //TODO fix w/h ???
|
||||
|
||||
DemoActor myActor = new DemoActor();
|
||||
myActor.setTouchable(Touchable.enabled);
|
||||
stage.addActor(myActor);
|
||||
|
||||
|
||||
MoveToAction moveAction = new MoveToAction();
|
||||
moveAction.setPosition(300f, 0f);
|
||||
moveAction.setDuration(10f);
|
||||
myActor.addAction(moveAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,31 +44,27 @@ public class GameScreen implements Screen {
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.input.setInputProcessor(stage);
|
||||
|
||||
Gdx.app.log("GameScreen", "show called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Gdx.app.log("GameScreen", "hide called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Gdx.app.log("GameScreen", "pause called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Gdx.app.log("GameScreen", "resume called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Gdx.app.log("GameScreen", "dispose called");
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,11 @@ import de.samdev.colorrunner.CRGame;
|
||||
public class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
|
||||
config.title = "ColorRunner";
|
||||
config.width = 967;
|
||||
config.height = 544;
|
||||
|
||||
new LwjglApplication(new CRGame(), config);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user