qmlfrontend/hwengine.h
author unc0rr
Wed, 10 Jan 2018 23:49:47 +0100
branchqmlfrontend
changeset 12890 9c259fb4d405
parent 12876 b544bbbd0696
permissions -rw-r--r--
Pass mouse movements to engine, warp cursor in frontend
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12857
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
12858
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12857
diff changeset
     4
#include <QList>
12857
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"
12863
fe16fa088b69 Make playing a game possible
unc0rr
parents: 12861
diff changeset
     8
#include "gameconfig.h"
12857
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
     9
90f927b4b9e1 Start hacking new frontend
unc0rr
parents:
diff changeset
    10
class QQmlEngine;
12861
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12858
diff changeset
    11
class PreviewImageProvider;
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12858
diff changeset
    12
class RunQueue;
12857
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
12858
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12857
diff changeset
    23
    Q_INVOKABLE void getPreview();
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12857
diff changeset
    24
    Q_INVOKABLE void runQuickGame();
0c6fb706f747 More refactoring in attempt to move away from frontlib
unc0rr
parents: 12857
diff changeset
    25
12857
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);
12861
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12858
diff changeset
    30
    void gameFinished();
12857
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;
12861
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12858
diff changeset
    36
    PreviewImageProvider* m_previewProvider;
488782d9aba9 Recreate uFLRunQueue in Qt, render previews
unc0rr
parents: 12858
diff changeset
    37
    RunQueue* m_runQueue;
12863
fe16fa088b69 Make playing a game possible
unc0rr
parents: 12861
diff changeset
    38
    GameConfig m_gameConfig;
12876
b544bbbd0696 Break engine completely and make it render in frontend window (no actual rendering yet, just white screen)
unc0rr
parents: 12863
diff changeset
    39
    QByteArray m_seed;
12857
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