Guest User

Untitled

a guest
Oct 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. package com.mygdx.game;
  2. public class MyGdxGame extends Game {
  3.  
  4. Stage stage;
  5. BitmapFont yesa;
  6. SpriteBatch batch;
  7. Image img, img3;
  8. String font;
  9.  
  10. @Override
  11. public void create() {
  12. setScreen(new Menu());
  13. }
  14.  
  15. @Override
  16. public void render() {
  17. Gdx.gl.glClearColor(1, 0, 0, 1);
  18. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  19. //dont know what to do here
  20. }
  21.  
  22. public class Menu extends PaideTodasAsJanelas {
  23.  
  24.  
  25. private Game game;
  26. SpriteBatch batch;
  27. Texture img, img2, img4;
  28. private Player player, player2;
  29. private Texture start, continued;
  30. TextureRegion my, my2, my3;
  31. TextureRegionDrawable myt, myt2, myt3;
  32. Stage stage, stage2;
  33. String font, starte, opcoes;
  34. BitmapFont yesa, funciona;
  35. Image ima;
  36. Texture img3;
  37. Sprite spider;
  38. TextureAtlas textatlas, ta;
  39. FileHandle f;
  40. TextButton b, op;
  41. Text fonte;
  42. Table t;
  43.  
  44. @Override
  45. public void abrirStage(){
  46. stage = new Stage();
  47. //OrthographicCamera camera = new OrthographicCamera();
  48. //camera.setToOrtho(false, 800, 480);
  49. batch = new SpriteBatch();
  50. textatlas = new TextureAtlas("Agorafunfa.txt");
  51. TextureAtlas.AtlasRegion a = textatlas.findRegion("spider");
  52. spider = new Sprite(a);
  53. player2 = new Player("spider.png", Info.WIDTH / 2, Info.HEIGHT / 2);
  54. player = new Player("playerr.png", Info.WIDTH / 2, Info.HEIGHT / 2);
  55. img = new Texture("Captura.PNG");
  56. myt = new TextureRegionDrawable(my);
  57. yesa = new BitmapFont(Gdx.files.internal("yesa.fnt"));
  58. font = "Escape Planet";
  59. img3 = new Texture("saturno.png");
  60. myt2 = new TextureRegionDrawable(my2);
  61. funciona = new BitmapFont(Gdx.files.internal("yesa.fnt"));
  62. starte = "Começar";
  63. myt3 = new TextureRegionDrawable(my3);
  64. opcoes = "Opções";
  65. TextureAtlas ta = new TextureAtlas("Comecar.txt");
  66. Skin skin = new Skin();
  67. skin.addRegions(ta);
  68. final TextButton.TextButtonStyle tbs = new TextButton.TextButtonStyle();
  69. tbs.font = yesa;
  70. tbs.checked = skin.getDrawable("comecaversao2");
  71. tbs.up = skin.getDrawable("comeca");
  72. op = new TextButton("Opções", tbs);
  73. b = new TextButton("Começar",tbs);
  74. op.setTransform(true);
  75. b.setTransform(true);
  76. op.addListener(new ClickListener() {
  77. @Override
  78. public void clicked(InputEvent event, float x, float y) {
  79. }
  80. });
  81. b.addListener(new ClickListener() {
  82. @Override
  83. public void clicked(InputEvent event, float x, float y) {
  84. }
  85. });
  86. t = new Table();
  87. t.add(b).setActorBounds(200,200,250,300);
  88. t.add(op).setActorBounds(100,200,250,300);
  89. t.setFillParent(true);
  90. stage.addActor(t);
  91. Gdx.input.setInputProcessor(stage);
  92. }
  93. @Override
  94. public void dispose() {
  95.  
  96. }
  97.  
  98. @Override
  99. public void hide() {
  100.  
  101. }
  102.  
  103. @Override
  104. public void show() {
  105.  
  106. }
  107.  
  108. @Override
  109. public void render(float delta) {
  110. Gdx.gl.glClearColor(1, 0, 0, 1);
  111. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  112. batch.begin();
  113. batch.draw(img,0,0);
  114. batch.draw(img3, 200,170, 250, 170);
  115. yesa.draw(batch,font,440,300);
  116. batch.end();
  117. stage.draw();
  118. }
  119.  
  120. public abstract class PaideTodasAsJanelas extends Stage implements Screen {
  121.  
  122. protected PaideTodasAsJanelas(){
  123. super( new StretchViewport(320.0f, 240.0f, new OrthographicCamera()) );
  124.  
  125. }
  126.  
  127. public abstract void abrirStage();
  128.  
  129. @Override
  130. public void show() {
  131.  
  132. }
  133.  
  134. @Override
  135. public void render(float delta) {
  136.  
  137. }
Add Comment
Please, Sign In to add comment