Forums

OverviewV-Play 2 Support (Qt 5)Multiscene Multilevel resolution problem › Reply To: Multiscene Multilevel resolution problem

OverviewV-Play 2 Support (Qt 5)Multiscene Multilevel resolution problem › Reply To: Multiscene Multilevel resolution problem
#11322

Phil

The code from MultiSceneMultiLevel is:

Main.qml

import VPlay 2.0
import QtQuick 2.0
import "scenes"

GameWindow {
    id: window
    width: 320
    height: 480

    //...

    // game scene to play a level
    GameScene {
        id: gameScene
        width:320
        height:320*window.height/window.width
    }

    //...
}

GameScene.qml

import VPlay 2.0
import QtQuick 2.0
import "../common"
import "../levels"

SceneBase {
    id:gameScene
    focus: true

    //...

    // load levels at runtime
    Loader {
        id: loader
        source: activeLevelFileName != "" ? "../levels/" + activeLevelFileName : ""
        onLoaded: {
            // since we did not define a width and height in the level item itself, we are doing it here
            item.width = parent.width
            item.height = parent.height

            //...
        }
    }
}

 

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support