qmlfrontend/engine_instance.cpp
author unC0Rr
Thu, 22 Nov 2018 10:58:55 +0100
changeset 14271 1aac8a62be6f
parent 14154 8354b390f1a2
child 14290 92e5682810d4
permissions -rw-r--r--
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend

#include "engine_instance.h"

EngineInstance::EngineInstance(QObject *parent)
    : QObject(parent), m_instance(Engine::start_engine()) {}

EngineInstance::~EngineInstance() { Engine::cleanup(m_instance); }

void EngineInstance::sendConfig(const GameConfig &config) {
  for (auto b : config.config()) {
    Engine::send_ipc(m_instance, reinterpret_cast<uint8_t *>(b.data()),
                     static_cast<size_t>(b.size()));
  }
}

Engine::PreviewInfo EngineInstance::generatePreview() {
  Engine::PreviewInfo pinfo;

  Engine::generate_preview(m_instance, &pinfo);

  return pinfo;
}