Skip to content
Snippets Groups Projects
Commit 366e024d authored by Luboš Horáček's avatar Luboš Horáček
Browse files

ViewPager imaplementation

parent 86d0a27a
No related merge requests found
package cz.nic.tablexia.screen.gamemenu;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import cz.nic.tablexia.loader.ApplicationTextureManager;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
import cz.nic.tablexia.screen.gamemenu.pages.OfficeMenuPage;
import cz.nic.tablexia.util.ui.ViewPager;
public class GameMenuScreen extends AbstractTablexiaScreen<Void> {
private GameMenuBackground background;
private class GameMenuBackground extends Actor {
private Texture backgroundTexture;
private ViewPager vp;
@Override
protected void screenLoaded() {
vp = new ViewPager();
vp.addActor(new OfficeMenuPage());
vp.addActor(new OfficeMenuPage());
vp.addActor(new OfficeMenuPage());
vp.addActor(new OfficeMenuPage());
vp.addActor(new OfficeMenuPage());
getStage().addActor(vp);
}
public GameMenuBackground() {
backgroundTexture = ApplicationTextureManager.getInstance().get(ApplicationTextureManager.STARTMENU_BACKGOURND, Texture.class);
backgroundTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
@Override
public void draw(Batch batch, float parentAlpha) {
batch.disableBlending();
batch.draw(backgroundTexture, 0, 0, getWidth(), getHeight());
batch.enableBlending();
}
}
@Override
protected void screenLoaded() {
background = new GameMenuBackground();
getStage().addActor(background);
}
@Override
public void screenResized(int width, int height) {
background.setSize(width, height);
}
@Override
public void screenResized(int width, int height) {
vp.setSize(width, height);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment