qmlfrontend/hwengine.h
author unc0rr
Sun, 07 Jan 2018 01:21:42 +0100
branchqmlfrontend
changeset 12888 adb1fccc706a
parent 12881 b544bbbd0696
permissions -rw-r--r--
- ResizeWindow function to pass engine new window size - Remove TabBar to leave more space at the bottom of the screen - ifdef GL_ES in shaders

#ifndef HWENGINE_H
#define HWENGINE_H

#include <QList>
#include <QObject>

#include "flib.h"
#include "gameconfig.h"

class QQmlEngine;
class PreviewImageProvider;
class RunQueue;

class HWEngine : public QObject {
    Q_OBJECT

public:
    explicit HWEngine(QQmlEngine* engine, QObject* parent = nullptr);
    ~HWEngine();

    static void exposeToQML();

    Q_INVOKABLE void getPreview();
    Q_INVOKABLE void runQuickGame();

signals:
    void previewIsRendering();
    void previewImageChanged();
    void previewHogCountChanged(int count);
    void gameFinished();

public slots:

private:
    QQmlEngine* m_engine;
    PreviewImageProvider* m_previewProvider;
    RunQueue* m_runQueue;
    GameConfig m_gameConfig;
    QByteArray m_seed;

    static void guiMessagesCallback(void* context, MessageType mt, const char* msg, uint32_t len);

private slots:
    void engineMessageHandler(MessageType mt, const QByteArray& msg);
};

#endif // HWENGINE_H