Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.62 KB | None | 0 0
  1. public class Stones implements Screen, purchaseInterface {
  2.  
  3.    
  4.     OrthographicCamera camera;
  5.     final TombStone game;
  6.    
  7.    
  8.     private Stage stage;
  9.     private TextureAtlas atlas;
  10.     private Skin skin;
  11.     private Table table;
  12.     private BitmapFont font;
  13.     ImageButton btnArrow, btnArrowLeft, imageButton1, imageButton2, imageButton3, imageButton4, imageButton5, imageButton6;
  14.    
  15.    
  16.     public  Texture background, testImage, arrow, arrowLeft;
  17.     public  TextureAtlas buttonAtlas;
  18.    
  19.     purchaseInterface pInt;
  20.    
  21.     public Stones(TombStone gam)    {
  22.         game = gam;
  23.        
  24.         game.assets.load();
  25.         loadStore();
  26.         camera = new OrthographicCamera();
  27.         camera.setToOrtho(false, 136, 204);
  28.        
  29.    
  30.        
  31.     }
  32.  
  33.     public void loadStore()  {
  34.         background = game.assets.storeBackground;
  35.         testImage = game.assets.image;
  36.         arrow = game.assets.arrow;
  37.         arrowLeft = game.assets.arrowLeft;
  38.     }
  39.  
  40.     @Override
  41.     public void render(float delta) {
  42.        
  43.         camera.update();
  44.         game.batch.setProjectionMatrix(camera.combined);
  45.        
  46.        
  47.         game.batch.begin();
  48.        
  49.         game.batch.draw(background, 0, 0, 136, 204);
  50.         game.font.setScale(0.5f);
  51.         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);
  52.        
  53.         game.batch.end();
  54.        
  55.         //Draws the ImageButtons
  56.         stage.act();
  57.         stage.draw();
  58.        
  59.     }
  60.  
  61.     @Override
  62.     public void resize(int width, int height) {
  63.         // TODO Auto-generated method stub
  64.        
  65.     }
  66.  
  67.     @Override
  68.     public void show() {
  69.        
  70.         Skin skin = new Skin();
  71.        
  72.        
  73.        
  74.         //ArrowButtons
  75.         Skin skinTwo = new Skin();
  76.         buttonAtlas = new TextureAtlas(Gdx.files.internal("arrow.pack"));
  77.         skinTwo.addRegions(buttonAtlas);
  78.         ImageButtonStyle styleTwo = new ImageButtonStyle();
  79.         TextureRegionDrawable arrowImage = new TextureRegionDrawable(new TextureRegion(new Texture("arrowLeft.png")));
  80.         styleTwo.up = skinTwo.newDrawable(skinTwo.newDrawable(arrowImage));
  81.         styleTwo.down = skinTwo.newDrawable(skinTwo.newDrawable(arrowImage));
  82.        
  83.        
  84.        
  85.         //ImageButtons - Category buttons
  86.         ImageButtonStyle style = new ImageButtonStyle();
  87.         TextureRegionDrawable ibimage = new TextureRegionDrawable(new TextureRegion(new Texture("image.png")));
  88.        
  89.         style.up = skin.newDrawable(skin.newDrawable(ibimage));
  90.         style.down = skin.newDrawable(skin.newDrawable(ibimage));
  91.         imageButton1 = new ImageButton(style);
  92.         imageButton2 = new ImageButton(style);
  93.         imageButton3 = new ImageButton(style);
  94.         imageButton4 = new ImageButton(style);
  95.         imageButton5 = new ImageButton(style);
  96.         imageButton6 = new ImageButton(style);
  97.        
  98.         //ArrowButtons implement
  99.         btnArrow = new ImageButton(styleTwo);
  100.        
  101.         btnArrow.setSize(150, 150);
  102.         btnArrow.setPosition(450, 10);
  103.        
  104.        
  105.         /*table = new Table();
  106.         table.setBounds(100, 100, 100, 100);
  107.        
  108.         skin = new Skin();
  109.         font = new BitmapFont();
  110.        
  111.         TextureRegion image = new TextureRegion(testImage);
  112.         stage = new Stage();
  113.         Gdx.input.setInputProcessor(stage);
  114.        
  115.         //ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
  116.         //style.imageUp = new TextureRegionDrawable(image);
  117.         //style.imageDown = new TextureRegionDrawable(image);
  118.         ImageButton iconButton = new ImageButton(skin);
  119.        
  120.         //Button imgButton = new Button(new Image(image), skin);*/
  121.        
  122.        
  123.        
  124.         //Stage for the BuyImages
  125.         stage = new Stage();
  126.        
  127.        
  128.        
  129.         table = new Table();
  130.         table.setBounds(20, 320, 175, 1050);
  131.        
  132.         table.add(imageButton1).pad(5).size(175, 175).row();
  133.         table.add(imageButton2).pad(5).size(175, 175).row();
  134.         table.add(imageButton3).pad(5).size(175, 175).row();
  135.         table.add(imageButton4).pad(5).size(175, 175).row();
  136.         table.add(imageButton5).pad(5).size(175, 175).row();
  137.         table.add(imageButton6).pad(5).size(175, 175).row();
  138.        
  139.        
  140.        
  141.         stage.addActor(table);
  142.         stage.addActor(btnArrow);
  143.        
  144.         Gdx.input.setInputProcessor(stage);
  145.        
  146.        
  147.         //Backbutton
  148.         btnArrow.addListener(new ChangeListener() {
  149.  
  150.             @Override
  151.             public void changed(ChangeEvent event, Actor actor) {
  152.                 game.setScreen(new StoreScreen(game));
  153.                
  154.             }
  155.  
  156.            
  157.         });
  158.        
  159.         imageButton1.addListener(new ChangeListener() {
  160.  
  161.             @Override
  162.             public void changed(ChangeEvent event, Actor actor) {
  163.                
  164.                
  165.             }
  166.            
  167.            
  168.         });
  169.        
  170.     }
  171.  
  172.     @Override
  173.     public void hide() {
  174.         // TODO Auto-generated method stub
  175.        
  176.     }
  177.  
  178.     @Override
  179.     public void pause() {
  180.         // TODO Auto-generated method stub
  181.        
  182.     }
  183.  
  184.     @Override
  185.     public void resume() {
  186.         // TODO Auto-generated method stub
  187.        
  188.     }
  189.  
  190.     @Override
  191.     public void dispose() {
  192.         // TODO Auto-generated method stub
  193.        
  194.     }
  195.  
  196.    
  197.  
  198.     @Override
  199.     public void applyTombstone() {
  200.         // TODO Auto-generated method stub
  201.        
  202.     }
  203.  
  204.    
  205.    
  206.    
  207.    
  208.    
  209. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement