qmlfrontend/gameview.h
author unc0rr
Sun, 07 Jan 2018 09:48:26 +0100
branchqmlfrontend
changeset 12884 66171ce586cc
parent 12883 adb1fccc706a
child 12890 9c259fb4d405
permissions -rw-r--r--
Fix referencing missing item
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12876
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     1
#ifndef GAMEVIEW_H
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     2
#define GAMEVIEW_H
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     3
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     4
#include <QQuickItem>
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     5
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     6
#include <QtGui/QOpenGLFunctions>
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     7
#include <QtGui/QOpenGLShaderProgram>
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     8
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
     9
class GameViewRenderer : public QObject, protected QOpenGLFunctions {
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    10
    Q_OBJECT
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    11
public:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    12
    GameViewRenderer()
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    13
        : m_delta(0)
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    14
    {
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    15
    }
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    16
    ~GameViewRenderer();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    17
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    18
    void tick(quint32 delta) { m_delta = delta; }
12883
adb1fccc706a - ResizeWindow function to pass engine new window size
unc0rr
parents: 12876
diff changeset
    19
    void setViewportSize(const QSize& size);
12876
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    20
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    21
public slots:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    22
    void paint();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    23
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    24
private:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    25
    quint32 m_delta;
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    26
};
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    27
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    28
class GameView : public QQuickItem {
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    29
    Q_OBJECT
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    30
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    31
public:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    32
    GameView();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    33
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    34
    Q_INVOKABLE void tick(quint32 delta);
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    35
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    36
signals:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    37
    void tChanged();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    38
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    39
public slots:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    40
    void sync();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    41
    void cleanup();
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    42
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    43
private slots:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    44
    void handleWindowChanged(QQuickWindow* win);
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    45
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    46
private:
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    47
    quint32 m_delta;
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    48
    GameViewRenderer* m_renderer;
12883
adb1fccc706a - ResizeWindow function to pass engine new window size
unc0rr
parents: 12876
diff changeset
    49
    bool m_windowChanged;
12876
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    50
};
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    51
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents:
diff changeset
    52
#endif // GAMEVIEW_H