Forums

OverviewV-Play 1 SupportProblems with cocos-renderer › Re: Problems with cocos-renderer

OverviewV-Play 1 SupportProblems with cocos-renderer › Re: Problems with cocos-renderer
#4029

Christian
V-Play Team

Hi Heini,
that’s great to hear that your issue could be resolved!

Regarding the QML Loader element:
As soon as the source or sourceComponent property of the Loader element is changed, the old resources get removed from memory. You can check that by adding

Component.onDestruction: { console.debug("Destructor called, this item is removed from memory...") }

to the item you load dynamically. When using the Loader element, please also add a call of [codeloadItemWithCocos()] which is defined in GameWindow. This is currently required to be done manually, because you might not always want to load the loaded item immediately with cocosRenderer. This is a complete example, like used in the SquabyMain example to load the CreditsScene dynamically:

Loader {
    //    source: "otherScenes/CreditsScene.qml" // set this source whenever you want to load the Scene dynamically
    id: creditsSceneLoader

    onLoaded: {
      console.debug("finished loading CreditsScene")
      loadItemWithCocos(creditsSceneLoader.item)
    }
  }

cheers,
Chris

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