Keine Beschreibung

car.cpp 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "car.h"
  2. ///
  3. /// Default Constructor for the racer class. Properties are set as follow:
  4. /// * y_car: The starting Y coordinate of the racecar
  5. ///
  6. Car::Car(QWidget *parent) :
  7. QWidget(parent)
  8. {
  9. y_car=80;
  10. name = ":/resources/racer.png" ;
  11. }
  12. ///
  13. /// Setter for the racecar
  14. ///
  15. void Car::setCar(string arg){
  16. if (arg == "red") name = ":/resources/racer.png";
  17. else if(arg== "pink") name = ":/resources/racer2.png";
  18. else if(arg== "green") name = ":/resources/racer3.png";
  19. else if(arg == "orange") name = ":/resources/racer4.png";
  20. else if(arg == "candy") name = ":/resources/sweetcar.png";
  21. else if(arg == "batman") name = ":/resources/batman.png";
  22. else name = ":/resources/racer5.png";
  23. repaint();
  24. }
  25. ///
  26. /// Getter for the racecar
  27. ///
  28. string Car::getCar(){
  29. return name;
  30. }
  31. ///
  32. /// Setter for the Y coordinate of the racecar
  33. ///
  34. void Car::setYCar(int arg){
  35. y_car = arg;
  36. }
  37. ///
  38. /// Getter for the Y coordinate of the racecar
  39. ///
  40. int Car::getYCar(){
  41. return y_car;
  42. }