Guest User

Untitled

a guest
Jun 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. package com.test.myfirsttriangle;
  2.  
  3. import com.badlogic.gdx.ApplicationListener;
  4. import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
  5. import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
  6.  
  7. public class MyFirstTriangle implements ApplicationListener {
  8.  
  9. public static int width = 5;
  10. public static int height = 2;
  11. public static float blockWidth = 0.25f;
  12. public static float blockHeight = 0.1f;
  13. public static boolean blocks[][];
  14.  
  15. @Override
  16. public void create() {
  17. for (int i = 0; i < height; i++) {
  18. for (int j = 0; j < width; j++) {
  19. blocks[i][j] = true;
  20. }
  21. }
  22. }
  23.  
  24. @Override
  25. public void dispose() { }
  26.  
  27. @Override
  28. public void pause() { }
  29.  
  30. @Override
  31. public void render() {
  32. //Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
  33. //mesh.render(GL10.GL_TRIANGLES, 0, 4);
  34. ShapeRenderer shapeRenderer = new ShapeRenderer();
  35. shapeRenderer.begin(ShapeType.FilledRectangle);
  36. shapeRenderer.setColor(0, 1, 0, 1);
  37. for (int i = 0; i < height; i++) {
  38. for (int j = 0; j < width; j++) {
  39. shapeRenderer.filledRect((float)(-0.95+blockWidth*i), (float)(0.85+blockHeight*j), blockWidth, blockHeight);
  40. }
  41. }
  42. shapeRenderer.end();
  43.  
  44. }
  45.  
  46. @Override
  47. public void resize(int width, int height) { }
  48.  
  49. @Override
  50. public void resume() { }
  51. }
Add Comment
Please, Sign In to add comment