qmlfrontend/game_view.h
changeset 14712 57293f34ce59
parent 14290 92e5682810d4
child 14713 cc6ab1e3f7d5
equal deleted inserted replaced
14711:40809bfd44af 14712:57293f34ce59
    11 #include "engine_instance.h"
    11 #include "engine_instance.h"
    12 
    12 
    13 class GameViewRenderer : public QObject, protected QOpenGLFunctions {
    13 class GameViewRenderer : public QObject, protected QOpenGLFunctions {
    14   Q_OBJECT
    14   Q_OBJECT
    15  public:
    15  public:
    16   GameViewRenderer();
    16   explicit GameViewRenderer();
    17   ~GameViewRenderer();
    17   ~GameViewRenderer() override;
    18 
    18 
    19   void tick(quint32 delta);
    19   void tick(quint32 delta);
    20   void setViewportSize(const QSize& size);
       
    21   void setEngineInstance(EngineInstance* engineInstance);
    20   void setEngineInstance(EngineInstance* engineInstance);
    22 
    21 
    23  public slots:
    22  public slots:
    24   void paint();
    23   void paint();
       
    24   void onViewportSizeChanged(QQuickWindow* window);
    25 
    25 
    26  private:
    26  private:
    27   quint32 m_delta;
    27   quint32 m_delta;
    28   QPointer<EngineInstance> m_engineInstance;
    28   QPointer<EngineInstance> m_engineInstance;
    29 };
    29 };
    33 
    33 
    34   Q_PROPERTY(EngineInstance* engineInstance READ engineInstance WRITE
    34   Q_PROPERTY(EngineInstance* engineInstance READ engineInstance WRITE
    35                  setEngineInstance NOTIFY engineInstanceChanged)
    35                  setEngineInstance NOTIFY engineInstanceChanged)
    36 
    36 
    37  public:
    37  public:
    38   GameView();
    38   explicit GameView();
    39 
    39 
    40   Q_INVOKABLE void tick(quint32 delta);
    40   Q_INVOKABLE void tick(quint32 delta);
    41 
    41 
    42   EngineInstance* engineInstance() const;
    42   EngineInstance* engineInstance() const;
    43 
    43 
    54 
    54 
    55  private:
    55  private:
    56   quint32 m_delta;
    56   quint32 m_delta;
    57   QScopedPointer<GameViewRenderer> m_renderer;
    57   QScopedPointer<GameViewRenderer> m_renderer;
    58   bool m_windowChanged;
    58   bool m_windowChanged;
    59   qint32 m_centerX;
       
    60   qint32 m_centerY;
       
    61   QPointer<EngineInstance> m_engineInstance;
    59   QPointer<EngineInstance> m_engineInstance;
       
    60   QSize m_viewportSize;
    62 };
    61 };
    63 
    62 
    64 #endif  // GAMEVIEW_H
    63 #endif  // GAMEVIEW_H