qmlfrontend/hwengine.h
author unc0rr
Tue, 02 Jan 2018 23:45:18 +0100
branchqmlfrontend
changeset 12881 b544bbbd0696
parent 12868 fe16fa088b69
permissions -rw-r--r--
Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     1
#ifndef HWENGINE_H
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     2
#define HWENGINE_H
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     3
12863
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12862
diff changeset
     4
#include <QList>
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     5
#include <QObject>
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     6
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     7
#include "flib.h"
12868
fe16fa088b69 Make playing a game possible
unc0rr
parents: 12866
diff changeset
     8
#include "gameconfig.h"
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     9
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    10
class QQmlEngine;
12866
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12863
diff changeset
    11
class PreviewImageProvider;
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12863
diff changeset
    12
class RunQueue;
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    13
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    14
class HWEngine : public QObject {
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    15
    Q_OBJECT
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    16
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    17
public:
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    18
    explicit HWEngine(QQmlEngine* engine, QObject* parent = nullptr);
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    19
    ~HWEngine();
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    20
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    21
    static void exposeToQML();
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    22
12863
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12862
diff changeset
    23
    Q_INVOKABLE void getPreview();
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12862
diff changeset
    24
    Q_INVOKABLE void runQuickGame();
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12862
diff changeset
    25
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    26
signals:
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    27
    void previewIsRendering();
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    28
    void previewImageChanged();
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    29
    void previewHogCountChanged(int count);
12866
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12863
diff changeset
    30
    void gameFinished();
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    31
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    32
public slots:
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    33
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    34
private:
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    35
    QQmlEngine* m_engine;
12866
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12863
diff changeset
    36
    PreviewImageProvider* m_previewProvider;
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12863
diff changeset
    37
    RunQueue* m_runQueue;
12868
fe16fa088b69 Make playing a game possible
unc0rr
parents: 12866
diff changeset
    38
    GameConfig m_gameConfig;
12881
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents: 12868
diff changeset
    39
    QByteArray m_seed;
12862
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    40
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    41
    static void guiMessagesCallback(void* context, MessageType mt, const char* msg, uint32_t len);
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    42
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    43
private slots:
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    44
    void engineMessageHandler(MessageType mt, const QByteArray& msg);
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    45
};
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    46
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    47
#endif // HWENGINE_H