gameengine.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2010 Nokia Corporation.
  3. */
  4. #ifndef GAMEENGINE_H
  5. #define GAMEENGINE_H
  6. #include <QObject>
  7. #include <QDeclarativeItem>
  8. #include <QMutex>
  9. #include <QPluginLoader>
  10. #include <QList>
  11. #ifdef Q_OS_SYMBIAN
  12. #include <hwrmvibra.h>
  13. #endif
  14. class GameEngine : public QObject
  15. {
  16. Q_OBJECT
  17. public:
  18. GameEngine(QObject* parent);
  19. ~GameEngine();
  20. Q_PROPERTY(int hiScore READ hiScore WRITE setHiScore)
  21. public:
  22. Q_INVOKABLE QVariant randInt(QVariant low, QVariant high);
  23. Q_INVOKABLE void findQmlObjects();
  24. Q_INVOKABLE void clearQmlObjects();
  25. Q_INVOKABLE void findObjects(QObject *rootObject, const QString& objName, QObjectList& res);
  26. Q_INVOKABLE void doFrame();
  27. Q_INVOKABLE QVariant isSymbian();
  28. Q_INVOKABLE QVariant isMaemo();
  29. Q_INVOKABLE QVariant isWindows();
  30. Q_INVOKABLE void vibra();
  31. Q_INVOKABLE void fastVibra();
  32. signals:
  33. void collision(QObject* a, QObject* b);
  34. private slots:
  35. public:
  36. void setGameQml(QObject* o);
  37. int hiScore() const;
  38. public slots:
  39. void setHiScore(int arg);
  40. private:
  41. void findEnemies(QObject* rootObject);
  42. void setMyShipQml(QObject* o);
  43. private:
  44. void doHitTest();
  45. private:
  46. QList<QDeclarativeItem*> m_enemyList;
  47. QList<QDeclarativeItem*> m_missileList;
  48. QDeclarativeItem* m_GameGml;
  49. QDeclarativeItem* m_myShipGml;
  50. int m_timerId;
  51. int m_doEnemyMissile;
  52. #ifdef Q_OS_SYMBIAN
  53. CHWRMVibra* iVibrate;
  54. #endif
  55. int m_hiScore;
  56. };
  57. #endif // GAMEENGINE_H