Advertisement
Guest User

Ball.h

a guest
Nov 23rd, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. /*
  2. * Ball.h
  3. *
  4. * Created on: Nov 21, 2014
  5. * Author: Austin
  6. *
  7. * Creates ball texture, when goes out of bounds, restarts back at center, launches in a random direction, collides with
  8. * bottom and top of window with the opposite direction of velocity.
  9. */
  10. #include <iostream>
  11. #include <SDL.h>
  12. using namespace std;
  13.  
  14. #ifndef BALL_H_
  15. #define BALL_H_
  16.  
  17. class Ball {
  18. private:
  19. SDL_Texture *texture;
  20. SDL_Rect posRect;
  21. int xVel, yVel;
  22. int GetRandomNumber(int high, int low);
  23. const int startX;
  24. const int startY;
  25.  
  26. public:
  27. Ball(SDL_Renderer *renderBall, string filePath, int x, int y);
  28. ~Ball();
  29.  
  30. int RandomNumber;
  31. void bDraw(SDL_Renderer *renderTarget);
  32. SDL_Rect ballRect;
  33. };
  34.  
  35. #endif /* BALL_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement