Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Stones implements Screen, purchaseInterface {
- OrthographicCamera camera;
- final TombStone game;
- private Stage stage;
- private TextureAtlas atlas;
- private Skin skin;
- private Table table;
- private BitmapFont font;
- ImageButton btnArrow, btnArrowLeft, imageButton1, imageButton2, imageButton3, imageButton4, imageButton5, imageButton6;
- public Texture background, testImage, arrow, arrowLeft;
- public TextureAtlas buttonAtlas;
- purchaseInterface pInt;
- public Stones(TombStone gam) {
- game = gam;
- game.assets.load();
- loadStore();
- camera = new OrthographicCamera();
- camera.setToOrtho(false, 136, 204);
- }
- public void loadStore() {
- background = game.assets.storeBackground;
- testImage = game.assets.image;
- arrow = game.assets.arrow;
- arrowLeft = game.assets.arrowLeft;
- }
- @Override
- public void render(float delta) {
- camera.update();
- game.batch.setProjectionMatrix(camera.combined);
- game.batch.begin();
- game.batch.draw(background, 0, 0, 136, 204);
- game.font.setScale(0.5f);
- game.font.draw(game.batch, "This is the current selection of tombstones! Simply click the image of the stone you want to buy it.", 50, 200);
- game.batch.end();
- //Draws the ImageButtons
- stage.act();
- stage.draw();
- }
- @Override
- public void resize(int width, int height) {
- // TODO Auto-generated method stub
- }
- @Override
- public void show() {
- Skin skin = new Skin();
- //ArrowButtons
- Skin skinTwo = new Skin();
- buttonAtlas = new TextureAtlas(Gdx.files.internal("arrow.pack"));
- skinTwo.addRegions(buttonAtlas);
- ImageButtonStyle styleTwo = new ImageButtonStyle();
- TextureRegionDrawable arrowImage = new TextureRegionDrawable(new TextureRegion(new Texture("arrowLeft.png")));
- styleTwo.up = skinTwo.newDrawable(skinTwo.newDrawable(arrowImage));
- styleTwo.down = skinTwo.newDrawable(skinTwo.newDrawable(arrowImage));
- //ImageButtons - Category buttons
- ImageButtonStyle style = new ImageButtonStyle();
- TextureRegionDrawable ibimage = new TextureRegionDrawable(new TextureRegion(new Texture("image.png")));
- style.up = skin.newDrawable(skin.newDrawable(ibimage));
- style.down = skin.newDrawable(skin.newDrawable(ibimage));
- imageButton1 = new ImageButton(style);
- imageButton2 = new ImageButton(style);
- imageButton3 = new ImageButton(style);
- imageButton4 = new ImageButton(style);
- imageButton5 = new ImageButton(style);
- imageButton6 = new ImageButton(style);
- //ArrowButtons implement
- btnArrow = new ImageButton(styleTwo);
- btnArrow.setSize(150, 150);
- btnArrow.setPosition(450, 10);
- /*table = new Table();
- table.setBounds(100, 100, 100, 100);
- skin = new Skin();
- font = new BitmapFont();
- TextureRegion image = new TextureRegion(testImage);
- stage = new Stage();
- Gdx.input.setInputProcessor(stage);
- //ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
- //style.imageUp = new TextureRegionDrawable(image);
- //style.imageDown = new TextureRegionDrawable(image);
- ImageButton iconButton = new ImageButton(skin);
- //Button imgButton = new Button(new Image(image), skin);*/
- //Stage for the BuyImages
- stage = new Stage();
- table = new Table();
- table.setBounds(20, 320, 175, 1050);
- table.add(imageButton1).pad(5).size(175, 175).row();
- table.add(imageButton2).pad(5).size(175, 175).row();
- table.add(imageButton3).pad(5).size(175, 175).row();
- table.add(imageButton4).pad(5).size(175, 175).row();
- table.add(imageButton5).pad(5).size(175, 175).row();
- table.add(imageButton6).pad(5).size(175, 175).row();
- stage.addActor(table);
- stage.addActor(btnArrow);
- Gdx.input.setInputProcessor(stage);
- //Backbutton
- btnArrow.addListener(new ChangeListener() {
- @Override
- public void changed(ChangeEvent event, Actor actor) {
- game.setScreen(new StoreScreen(game));
- }
- });
- imageButton1.addListener(new ChangeListener() {
- @Override
- public void changed(ChangeEvent event, Actor actor) {
- }
- });
- }
- @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() {
- // TODO Auto-generated method stub
- }
- @Override
- public void applyTombstone() {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement