Determine When SceneGraph Has Loaded in a State Controller

This is the 2017 version of IGE and is based on the "appCore" branch in git and is a relatively large re-write of many areas of the engine to allow for automatic dependency injection in your code, much simpler navigation of your game scenes etc.

It is modelled after AngularJS in the way dependency injection works and modelled after ui-router for how routing works, although it doesn't include either of those libraries.

Determine When SceneGraph Has Loaded in a State Controller

Postby rob » Tue Sep 12, 2017 4:26 pm

If you are using the state router system in IGE 2.x you may notice that the order of initialisation of state modules is:

textures -> controller -> sceneGraph

This means that at the point your controler init is called your sceneGraph data may not exist in the engine scene graph. If you want to be informed when it is there, simply hook the "ready" event from your controller module:

Code: Select all
appCore.module('MyStateControllerModule', function ($ige, $game, IgeStreamComponent) {
   var moduleSelf = this;
   
   var MyStateControllerModule = function () {
      var self = this;
      
      moduleSelf.on('ready', function () {
         // Your sceneGraph data will exist now
      });
   });
});
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 315
Joined: Tue Oct 22, 2013 5:08 pm

Return to Version 2.x

Who is online

Users browsing this forum: No registered users and 1 guest
cron