Fix some minor problems with new frontend code
authorunc0rr
Fri, 26 Apr 2019 23:21:58 +0200
changeset 14842 ef9630519491
parent 14841 111c4d750c6d
child 14843 9f6b650a6812
Fix some minor problems with new frontend code
qmlfrontend/engine_instance.h
qmlfrontend/game_view.cpp
qmlfrontend/game_view.h
--- a/qmlfrontend/engine_instance.h	Fri Apr 26 23:21:27 2019 +0200
+++ b/qmlfrontend/engine_instance.h	Fri Apr 26 23:21:58 2019 +0200
@@ -18,8 +18,6 @@
   Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
 
   void sendConfig(const GameConfig& config);
-  void advance(quint32 ticks);
-  void moveCamera(const QPoint& delta);
   void renderFrame();
   void setOpenGLContext(QOpenGLContext* context);
   QImage generatePreview();
@@ -30,6 +28,9 @@
   void isValidChanged(bool isValid);
 
  public slots:
+  void advance(quint32 ticks);
+  void moveCamera(const QPoint& delta);
+  void controlEvent(bool isStart, int type);
 
  private:
   Engine::EngineInstance* m_instance;
--- a/qmlfrontend/game_view.cpp	Fri Apr 26 23:21:27 2019 +0200
+++ b/qmlfrontend/game_view.cpp	Fri Apr 26 23:21:58 2019 +0200
@@ -6,7 +6,8 @@
 #include <QtGui/QOpenGLContext>
 #include <QtGui/QOpenGLShaderProgram>
 
-GameView::GameView() : m_delta(0), m_windowChanged(true) {
+GameView::GameView(QQuickItem* parent)
+    : QQuickItem(parent), m_delta(0), m_windowChanged(true) {
   connect(this, &QQuickItem::windowChanged, this,
           &GameView::handleWindowChanged);
 }
--- a/qmlfrontend/game_view.h	Fri Apr 26 23:21:27 2019 +0200
+++ b/qmlfrontend/game_view.h	Fri Apr 26 23:21:58 2019 +0200
@@ -35,7 +35,7 @@
                  setEngineInstance NOTIFY engineInstanceChanged)
 
  public:
-  explicit GameView();
+  explicit GameView(QQuickItem* parent = nullptr);
 
   Q_INVOKABLE void tick(quint32 delta);