Açıklama Yok

play.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef PLAY_H
  2. #define PLAY_H
  3. #include <QTimer>
  4. #include <QtGui>
  5. #include <QtCore>
  6. #include <QWidget>
  7. #include <QPainter>
  8. #include <string>
  9. #include <vector>
  10. #include "obstacle.h"
  11. #include "flag.h"
  12. #include "car.h"
  13. using namespace std;
  14. const int STEPS = 10 ;
  15. const int CARX = 70 ;
  16. const int FLAGRANGE = 20;
  17. const int OBSTACLERANGE = 30 ;
  18. class play : public QWidget
  19. {
  20. Q_OBJECT
  21. public:
  22. enum Difficulty {EASY, MEDIUM, HARD} ;
  23. enum Track {DAY, NIGHT, BEACH, CANDYLAND} ;
  24. explicit play(QWidget *parent = 0);
  25. int x1;
  26. int x2;
  27. int y_car;
  28. int score;
  29. Difficulty level ;
  30. bool playing;
  31. void collision();
  32. void keyPressEvent(QKeyEvent *event);
  33. void setScore(int = 1);
  34. void setCar(string);
  35. int getScore();
  36. void updateObs();
  37. void updateObstacleYCoordinate(int &, int &, int &, int &) ;
  38. string track;
  39. Track tt ;
  40. void setTrack(Track);
  41. void setTrackPixmap(Track) ;
  42. string getTrackPixmap() ;
  43. Track getTrack();
  44. void stopGame();
  45. ~play();
  46. public slots:
  47. void mySlot();
  48. void run();
  49. void newGame();
  50. protected:
  51. void paintEvent(QPaintEvent *);
  52. int randInt(int min, int max) ;
  53. void setObstaclesPixmap(string) ;
  54. bool obstacleCollision(Obstacle &, Car &) ;
  55. void flagCollision(Flag &, Car &);
  56. QTimer *myTimer;
  57. Obstacle obs[3];
  58. Flag flag;
  59. Car car;
  60. };
  61. #endif // PLAY_H