qmlfrontend/hwengine.h
branchui-scaling
changeset 15288 c4fd2813b127
parent 14377 b6824a53d4b1
equal deleted inserted replaced
13395:0135e64c6c66 15288:c4fd2813b127
       
     1 #ifndef HWENGINE_H
       
     2 #define HWENGINE_H
       
     3 
       
     4 #include <QList>
       
     5 #include <QObject>
       
     6 
       
     7 #include "engine_interface.h"
       
     8 #include "game_config.h"
       
     9 
       
    10 class QQmlEngine;
       
    11 class EngineInstance;
       
    12 class PreviewAcceptor;
       
    13 
       
    14 class HWEngine : public QObject {
       
    15   Q_OBJECT
       
    16 
       
    17   Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY
       
    18                  previewHedgehogsCountChanged)
       
    19   Q_PROPERTY(PreviewAcceptor* previewAcceptor READ previewAcceptor WRITE
       
    20                  setPreviewAcceptor NOTIFY previewAcceptorChanged)
       
    21   Q_PROPERTY(QString engineLibrary READ engineLibrary WRITE setEngineLibrary
       
    22                  NOTIFY engineLibraryChanged)
       
    23 
       
    24  public:
       
    25   explicit HWEngine(QObject* parent = nullptr);
       
    26   ~HWEngine();
       
    27 
       
    28   Q_INVOKABLE void getPreview();
       
    29   Q_INVOKABLE EngineInstance* runQuickGame();
       
    30 
       
    31   int previewHedgehogsCount() const;
       
    32   PreviewAcceptor* previewAcceptor() const;
       
    33   QString engineLibrary() const;
       
    34 
       
    35  public slots:
       
    36   void setPreviewAcceptor(PreviewAcceptor* previewAcceptor);
       
    37   void setEngineLibrary(const QString& engineLibrary);
       
    38 
       
    39  signals:
       
    40   void previewIsRendering();
       
    41   void previewImageChanged();
       
    42   void previewHogCountChanged(int count);
       
    43   void gameFinished();
       
    44   void previewHedgehogsCountChanged(int previewHedgehogsCount);
       
    45   void previewAcceptorChanged(PreviewAcceptor* previewAcceptor);
       
    46   void engineLibraryChanged(const QString& engineLibrary);
       
    47 
       
    48  private:
       
    49   QQmlEngine* m_engine;
       
    50   GameConfig m_gameConfig;
       
    51   int m_previewHedgehogsCount;
       
    52   PreviewAcceptor* m_previewAcceptor;
       
    53   QString m_engineLibrary;
       
    54 };
       
    55 
       
    56 #endif  // HWENGINE_H