Oh lol, srry xD Was to busy watching the M$ E3 conference
Im using Libgdx
package com.mayogames.zombiecubes.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.mayogames.zombiecubes.ZombieCubes;
public class HelpScreen1 implements Screen {
ZombieCubes zombieCubes;
Stage stage;
TextureAtlas atlas;
Skin skin;
SpriteBatch batch;
Texture helpScreen1Texture;
OrthographicCamera camera;
Rectangle glViewport;
Button arrowLeftButton;
Button arrowRightButton;
public HelpScreen1(ZombieCubes zombieCubes){
this.zombieCubes = zombieCubes;
}
@Override
public void render(float delta) {
GL10 gl = Gdx.graphics.getGL10();
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glViewport((int) glViewport.x, (int) glViewport.y,
(int) glViewport.width, (int) glViewport.height);
camera.update();
camera.apply(gl);
stage.act(delta);
batch.begin();
stage.draw();
batch.end();
}
@Override
public void resize(int width, int height) {
if(stage == null){
stage = new Stage(width, height, true);
stage.clear();
Gdx.input.setInputProcessor(stage);
helpScreen1Texture = new Texture(Gdx.files.internal("data/HelpScreens/HelpScreen1.png"));
helpScreen1Texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion helpScreen1Region = new TextureRegion(helpScreen1Texture, 0, 0, 800, 480);
Image helpScreen1Image = new Image(helpScreen1Region);
helpScreen1Image.setX(0);
helpScreen1Image.setY(0);
ButtonStyle arrowLeftStyle = new ButtonStyle();
arrowLeftStyle.up = skin.getDrawable("arrowLeft");
arrowLeftStyle.down = skin.getDrawable("arrowLeftPressed");
ButtonStyle arrowRightStyle = new ButtonStyle();
arrowRightStyle.up = skin.getDrawable("arrowRight");
arrowRightStyle.down = skin.getDrawable("arrowRightPressed");
arrowRightButton = new Button(arrowRightStyle);
arrowRightButton.setWidth(64);
arrowRightButton.setHeight(64);
arrowRightButton.setX(735);
arrowRightButton.setY(0);
arrowRightButton.addListener(new InputListener(){
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
return true;
}
public void touchUp(InputEvent event, float x, float y, int pointer, int button){
zombieCubes.setScreen(new HelpScreen2(zombieCubes));
}
});
stage.addActor(helpScreen1Image);
stage.addActor(arrowRightButton);
}
}
@Override
public void show() {
batch = new SpriteBatch();
atlas = new TextureAtlas("data/Misc/buttons.atlas");
skin = new Skin();
skin.addRegions(atlas);
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
glViewport = new Rectangle(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
@Override
public void hide() {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
helpScreen1Texture.dispose();
batch.dispose();
stage.dispose();
skin.dispose();
atlas.dispose();
}
}
This is just one example out of the three others helpscreens I have
The other twos don’t have the camera in it, but it didn’t make a difference 