qmlfrontend/Page1.qml
author Wuzzy <Wuzzy2@mail.ru>
Thu, 25 Apr 2019 23:01:05 +0200
changeset 14839 e239378a9400
parent 14372 b6824a53d4b1
child 14854 aed75d439027
permissions -rw-r--r--
Prevent entering “/”, “\” and “:” in team and scheme names. The name of teams and schems is saved in the file name itself, so these characters would cause trouble as they are used in path names in Linux and Windows.

import QtQuick 2.7
import Hedgewars.Engine 1.0

Page1Form {
  property var hwEngine

  Component {
    id: hwEngineComponent

    HWEngine {
      engineLibrary: "./libhedgewars_engine.so"
      previewAcceptor: PreviewAcceptor
      onPreviewImageChanged: previewImage.source = "image://preview/image"
      onPreviewIsRendering: previewImage.source = "qrc:/res/iconTime.png"
    }
  }

  Component.onCompleted: {
    hwEngine = hwEngineComponent.createObject()
  }

  tickButton.onClicked: {
    gameView.tick(100)
  }
  gameButton.onClicked: {
    var engineInstance = hwEngine.runQuickGame()
    gameView.engineInstance = engineInstance
  }
  button1.onClicked: {
    hwEngine.getPreview()
  }
}