Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public class LaohuGame extends Game {
  2.  
  3. public static final int FRUIT_NUM = 24;
  4. public static final String WORK_DIR = "Desktop/assets/";
  5.  
  6. @Override
  7. public void create() {
  8. GameScreen gameScreen = new GameScreen(this);
  9. setScreen(gameScreen);
  10.  
  11. }
  12.  
  13. public class GameScreen extends LaohuScreen {
  14.  
  15. private final Stage stage;
  16. public static int START_X = 11;
  17. public static int START_Y = 199;
  18.  
  19. public GameScreen(Game game) {
  20. super(game);
  21. stage = new Stage(GAME_WIDTH,GAME_HEIGHT,true);
  22. //add actors to the stage
  23. }
  24.  
  25. public class LaohuScreen implements Screen{
  26.  
  27. int GAME_WIDTH;
  28. int GAME_HEIGHT;
  29. protected Game game;
  30. public LaohuScreen(Game game) {
  31. this.game = game;
  32. GAME_WIDTH = Gdx.graphics.getWidth();
  33. GAME_HEIGHT = Gdx.graphics.getHeight();
  34. }
  35.  
  36. public class LaohuGame extends Game {
  37.  
  38. public static final int FRUIT_NUM = 24;
  39. public static final String WORK_DIR = "Desktop/assets/";
  40.  
  41.  
  42. @Override
  43. public void create() {
  44. GameScreen gameScreen = new GameScreen(this);
  45. setScreen(gameScreen);
  46.  
  47. }
  48.  
  49. @Override
  50. public void setScreen(Screen screen) {
  51. super.setScreen(screen);
  52. this.getScreen().resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() * 5 / 10);
  53. }
  54.  
  55. @Override
  56. public void resize(int width, int height) {
  57. if (getScreen() != null) getScreen().resize(width, height * 5 / 10);
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement