ColorRunner/core/src/de/samdev/colorrunner/screens/gameScreen/GameScreen.java

71 lines
1.6 KiB
Java
Raw Normal View History

2014-08-10 00:42:19 +02:00
package de.samdev.colorrunner.screens.gameScreen;
2014-08-10 00:24:45 +02:00
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Stage;
2014-08-10 00:42:19 +02:00
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction;
2014-08-10 00:24:45 +02:00
import com.badlogic.gdx.utils.viewport.ExtendViewport;
2014-08-10 00:42:19 +02:00
import de.samdev.colorrunner.actors.DemoActor;
2014-08-10 00:24:45 +02:00
2014-08-10 00:42:19 +02:00
public class GameScreen implements Screen {
2014-08-10 00:24:45 +02:00
private Stage stage;
public GameScreen() {
stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); //TODO fix w/h ???
2014-08-10 00:42:19 +02:00
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);
2014-08-10 00:24:45 +02:00
}
@Override
public void render(float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta);
stage.draw();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
Gdx.input.setInputProcessor(stage);
2014-08-10 00:42:19 +02:00
Gdx.app.log("GameScreen", "show called");
2014-08-10 00:24:45 +02:00
}
@Override
public void hide() {
2014-08-10 00:42:19 +02:00
Gdx.app.log("GameScreen", "hide called");
2014-08-10 00:24:45 +02:00
}
@Override
public void pause() {
2014-08-10 00:42:19 +02:00
Gdx.app.log("GameScreen", "pause called");
2014-08-10 00:24:45 +02:00
}
@Override
public void resume() {
2014-08-10 00:42:19 +02:00
Gdx.app.log("GameScreen", "resume called");
2014-08-10 00:24:45 +02:00
}
@Override
public void dispose() {
2014-08-10 00:42:19 +02:00
Gdx.app.log("GameScreen", "dispose called");
2014-08-10 00:24:45 +02:00
}
}