No Description

genericscrollingobject.h 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef GENERICSCROLLINGOBJECT_H
  2. #define GENERICSCROLLINGOBJECT_H
  3. #include <QGraphicsPixmapItem>
  4. #include <QGraphicsScene>
  5. #include <QBitmap>
  6. // A class for the items that move.
  7. class MainGameWindow;
  8. class GenericScrollingObject : public QGraphicsPixmapItem {
  9. public:
  10. GenericScrollingObject(const std::string& filename, QGraphicsScene *scene,
  11. int x, int y, int w, int h,
  12. const QColor& transparency_color = QColor(0,255,0),
  13. MainGameWindow *parent = 0
  14. );
  15. int x() const { return myX; }
  16. int y() const { return myY; }
  17. //
  18. // This method that is automatically called on each tick
  19. //
  20. void advance(int phase);
  21. // given an integer number of pixels, move the item by that amount, vertically
  22. void kill();
  23. bool isAlive() {return alive;}
  24. int myDirX, myDirY;
  25. int myX, myY;
  26. int toX, toY;
  27. private:
  28. bool alive;
  29. QGraphicsScene *myScene;
  30. MainGameWindow *myParent;
  31. };
  32. #endif // GENERICSCROLLINGOBJECT_H