Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. package com.mygdx.game;
  2.  
  3. import com.badlogic.gdx.ApplicationAdapter;
  4. import com.badlogic.gdx.Game;
  5. import com.badlogic.gdx.Gdx;
  6. import com.badlogic.gdx.graphics.GL20;
  7. import com.badlogic.gdx.graphics.Texture;
  8. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  9.  
  10. public class sandbox_main extends Game {
  11. SpriteBatch batch;
  12. Texture img;
  13.  
  14. @Override
  15. public void create () {
  16. batch = new SpriteBatch();
  17. img = new Texture("badlogic.jpg");
  18. setScreen(new testScreen());
  19. }
  20.  
  21. @Override
  22. public void render ()
  23. { super.render();
  24. /*Gdx.gl.glClearColor(0, 1, 0, 1);
  25. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  26. batch.begin();
  27. batch.draw(img, 0, 0);
  28. batch.end();*/
  29. }
  30. }
  31.  
  32.  
  33. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  34.  
  35.  
  36. package com.mygdx.game;
  37.  
  38. import com.badlogic.gdx.Gdx;
  39. import com.badlogic.gdx.Input.Keys;
  40. import com.badlogic.gdx.InputProcessor;
  41. import com.badlogic.gdx.Screen;
  42. import com.badlogic.gdx.graphics.GL20;
  43. import com.badlogic.gdx.graphics.Texture;
  44. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  45.  
  46.  
  47. public class testScreen implements Screen, InputProcessor
  48. { SpriteBatch batch;
  49. Texture img;
  50.  
  51. public void show()
  52. { batch = new SpriteBatch();
  53. img = new Texture("badlogic.jpg");
  54. System.out.println("I am inside the Show method :P");
  55. }
  56.  
  57. public void render(float delta)
  58. {
  59. Gdx.gl.glClearColor(1, 0, 0, 1);
  60. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  61. batch.begin();
  62. batch.draw(img, 0, 0);
  63. batch.end();
  64.  
  65. }
  66.  
  67. public void resize(int width, int height)
  68. {
  69.  
  70. }
  71.  
  72. public void pause()
  73. {
  74.  
  75. }
  76.  
  77. public void resume()
  78. {
  79.  
  80. }
  81.  
  82. public void hide()
  83. {
  84.  
  85. }
  86.  
  87. public void dispose()
  88. {
  89.  
  90. }
  91.  
  92.  
  93. @Override
  94. public boolean keyDown(int keycode) {
  95. System.out.println("Key Pressed! "+keycode);
  96. return false;
  97. }
  98.  
  99. @Override
  100. public boolean keyUp(int keycode) {
  101. // TODO Auto-generated method stub
  102. return false;
  103. }
  104.  
  105. @Override
  106. public boolean keyTyped(char character) {
  107. // TODO Auto-generated method stub
  108. return false;
  109. }
  110.  
  111. @Override
  112. public boolean touchDown(int screenX, int screenY, int pointer, int button) {
  113. System.out.println("Touch Down!! "+screenX+" , "+screenY);
  114. return false;
  115. }
  116.  
  117. @Override
  118. public boolean touchUp(int screenX, int screenY, int pointer, int button) {
  119. // TODO Auto-generated method stub
  120. return false;
  121. }
  122.  
  123. @Override
  124. public boolean touchDragged(int screenX, int screenY, int pointer) {
  125. // TODO Auto-generated method stub
  126. return false;
  127. }
  128.  
  129. @Override
  130. public boolean mouseMoved(int screenX, int screenY) {
  131. // TODO Auto-generated method stub
  132. return false;
  133. }
  134.  
  135. @Override
  136. public boolean scrolled(int amount) {
  137. // TODO Auto-generated method stub
  138. return false;
  139. }
  140.  
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement