Advertisement
andreystar

Untitled

Feb 27th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. package com.ptl.chees.stages.actors;
  2.  
  3. import com.badlogic.gdx.graphics.Texture;
  4. import com.badlogic.gdx.graphics.g2d.Batch;
  5. import com.badlogic.gdx.scenes.scene2d.Actor;
  6.  
  7. public class BoardActor extends Actor {
  8.  
  9. private Texture texture;
  10. private Texture pawn_b;
  11. private Texture rook_b;
  12. private Texture knight_b;
  13. private Texture bishop_b;
  14. private Texture queen_b;
  15. private Texture king_b;
  16. private Texture pawn_w;
  17. private Texture rook_w;
  18. private Texture knight_w;
  19. private Texture bishop_w;
  20. private Texture queen_w;
  21. private Texture king_w;
  22.  
  23.  
  24. public BoardActor(float width, float height) {
  25. setSize(width, height);
  26. texture = new Texture("board.jpg");
  27. pawn_b = new Texture("pawn-b.png");
  28. rook_b = new Texture("rook-b.png");
  29. knight_b = new Texture("knight-b.png");
  30. bishop_b = new Texture("bishop-b.png");
  31. king_b = new Texture("king-b.png");
  32. queen_b = new Texture("queen-b.png");
  33. pawn_w = new Texture("pawn-w.png");
  34. rook_w = new Texture("rook-w.png");
  35. knight_w = new Texture("knight-w.png");
  36. bishop_w = new Texture("bishop-w.png");
  37. king_w = new Texture("king-w.png");
  38. queen_w = new Texture("queen-w.png");
  39. }
  40.  
  41. @Override
  42. public void draw(Batch batch, float parentAlpha) {
  43. batch.draw(texture, 0, 0, getWidth(), getHeight());
  44. batch.draw(pawn_b, 61, 117, 40, 40);
  45. batch.draw(pawn_b, 116, 117, 40, 40);
  46. batch.draw(pawn_b, 171, 117, 40, 40);
  47. batch.draw(pawn_b, 225, 117, 40, 40);
  48. batch.draw(pawn_b, 279, 117, 40, 40);
  49. batch.draw(pawn_b, 334, 117, 40, 40);
  50. batch.draw(pawn_b, 387, 117, 40, 40);
  51. batch.draw(pawn_b, 442, 117, 40, 40);
  52. batch.draw(rook_b, 61, 62, 40, 40);
  53. batch.draw(rook_b, 442, 62, 40, 40);
  54. batch.draw(knight_b, 116, 62, 40, 40);
  55. batch.draw(knight_b, 387, 62, 40, 40);
  56. batch.draw(bishop_b, 171, 62, 40, 40);
  57. batch.draw(bishop_b, 334, 62, 40, 40);
  58. batch.draw(king_b, 225, 62, 40, 40);
  59. batch.draw(queen_b, 279, 62, 40, 40);
  60.  
  61.  
  62. batch.draw(pawn_w, 61, 388, 40, 40);
  63. batch.draw(pawn_w, 116, 388, 40, 40);
  64. batch.draw(pawn_w, 171, 388, 40, 40);
  65. batch.draw(pawn_w, 225, 388, 40, 40);
  66. batch.draw(pawn_w, 279, 388, 40, 40);
  67. batch.draw(pawn_w, 334, 388, 40, 40);
  68. batch.draw(pawn_w, 387, 388, 40, 40);
  69. batch.draw(pawn_w, 442, 388, 40, 40);
  70. batch.draw(rook_w, 61, 443, 40, 40);
  71. batch.draw(rook_w, 442, 443, 40, 40);
  72. batch.draw(knight_w, 116, 443, 40, 40);
  73. batch.draw(knight_w, 387, 443, 40, 40);
  74. batch.draw(bishop_w, 171, 443, 40, 40);
  75. batch.draw(bishop_w, 334, 443, 40, 40);
  76. batch.draw(king_w, 279, 443, 40, 40);
  77. batch.draw(queen_w, 225, 443, 40, 40);
  78.  
  79. }
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement