qmlfrontend/engine_instance.h
author unC0Rr
Fri, 07 Dec 2018 13:56:45 +0100
changeset 14393 b6824a53d4b1
parent 14311 92e5682810d4
child 14394 4409344db447
permissions -rw-r--r--
Allow to instantiate HWEngine with different library binaries
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     1
#ifndef ENGINEINSTANCE_H
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     2
#define ENGINEINSTANCE_H
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     3
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     4
#include <QObject>
14311
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
     5
#include <QOpenGLContext>
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     6
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
     7
#include "engine_interface.h"
14292
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14175
diff changeset
     8
#include "game_config.h"
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14175
diff changeset
     9
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    10
class EngineInstance : public QObject {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    11
  Q_OBJECT
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    12
 public:
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    13
  explicit EngineInstance(const QString& libraryPath,
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    14
                          QObject* parent = nullptr);
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    15
  ~EngineInstance();
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    16
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    17
  Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    18
14311
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
    19
  void sendConfig(const GameConfig& config);
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
    20
  void advance(quint32 ticks);
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
    21
  void renderFrame();
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
    22
  void setOpenGLContext(QOpenGLContext* context);
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    23
  Engine::PreviewInfo generatePreview();
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    24
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    25
  bool isValid() const;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    26
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    27
 signals:
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    28
  void isValidChanged(bool isValid);
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    29
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    30
 public slots:
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    31
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    32
 private:
14311
92e5682810d4 Prepare to have possibility to pass opengl context to engine
unc0rr
parents: 14292
diff changeset
    33
  Engine::EngineInstance* m_instance;
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    34
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    35
  Engine::hedgewars_engine_protocol_version_t*
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    36
      hedgewars_engine_protocol_version;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    37
  Engine::start_engine_t* start_engine;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    38
  Engine::generate_preview_t* generate_preview;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    39
  Engine::cleanup_t* cleanup;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    40
  Engine::send_ipc_t* send_ipc;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    41
  Engine::read_ipc_t* read_ipc;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    42
  Engine::setup_current_gl_context_t* setup_current_gl_context;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    43
  Engine::render_frame_t* render_frame;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    44
  Engine::advance_simulation_t* advance_simulation;
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14311
diff changeset
    45
  bool m_isValid;
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    46
};
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    47
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    48
#endif  // ENGINEINSTANCE_H