Advertisement
Suby

classes.h

Apr 27th, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. #ifndef CLASSES_H
  2. #define CLASSES_H
  3.  
  4. class Block
  5. {
  6. private:
  7. int x, y;
  8. bool ShowBlock;
  9. int ShapeColor;
  10.  
  11. public:
  12. Block();
  13. int Getx();
  14. int Gety();
  15. void Setx(int xvalue);
  16. void Sety(int yvalue);
  17. void DisplayBlocks();
  18. bool GetShowBlock();
  19. void SetShowBlock(bool OnOff);
  20. void SetShapeColor(int shapecolorvalue);
  21.  
  22. friend class Shape;
  23. };
  24.  
  25. class Shape
  26. {
  27. private:
  28. int shape, orientation;
  29. int BlockMarker[4];
  30. bool LxVel, RxVel, yVel, FlipShape;
  31. bool LxVelFast, RxVelFast, yVelFast, Fast, pause, restart;
  32.  
  33. public:
  34. Shape();
  35. void handle_input();
  36. bool move(Block* aBlock, Shape aShape, int maxsize);
  37. int CheckCollision(Block* aBlock, int maxsize, int* OriginalyPosition, int* OriginalxPosition);
  38. void SetShape(int shapevalue, Block* aBlock, int maxsize);
  39. void SetBlockMarker(int value, int index);
  40. int GetBlockMarker(int index);
  41. bool MoveShapeDown(Block* aBlock, Shape aShape, int maxsize);
  42. void SpawnNewShapeIfNeeded(bool &SpawnShapeAnswer, Block* aBlock, int maxsize, int &nextblockshape, int &linesclearedint, int &scorevalue);
  43. void SpawnNextShapeInSidebar(int shapevalue, Block* aBlock);
  44. void Shape::Rotate(Block* aBlock, Shape aShape, int maxsize);
  45. bool GetIfKeyHeldDown();
  46. void SetFast(bool fastvalue);
  47. bool GetPause();
  48. void SetPause(bool pausevalue);
  49. void SetOrientation(int OrientationValue);
  50. bool CheckGameOver(Block* aBlock, int maxsize);
  51. bool GetRestart();
  52. void SetRestart(bool restartvalue);
  53. };
  54.  
  55. //timer class and functions made by Lazy Foo [http://lazyfoo.net/SDL_tutorials/index.php]
  56. class Timer
  57. {
  58. private:
  59. //The clock time when the timer started
  60. int startTicks;
  61.  
  62. //The ticks stored when the timer was paused
  63. int pausedTicks;
  64.  
  65. //The timer status
  66. bool paused;
  67. bool started;
  68.  
  69. public:
  70. //Initializes variables
  71. Timer();
  72.  
  73. //The various clock actions
  74. void start();
  75. void stop();
  76. void pause();
  77. void unpause();
  78.  
  79. //Gets the timer's time
  80. int get_ticks();
  81.  
  82. //Checks the status of the timer
  83. bool is_started();
  84. bool is_paused();
  85. };
  86.  
  87. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement