ig.

UIToggle

new UIToggle()

Interactive ui element that toggles states.
- toggles between ig.EntityExtended#activate and ig.EntityExtended#deactivate Tip: Impact++ UIElements are meant to be used for simple user interfaces. If you need something complex, it is recommended that you use the DOM!

Author:
  • Collin Hover - collinhover.com
Source:
Example
// it is easy to create a toggle button
ig.UIToggleButton = ig.UIInteractive.extend({
     // override the activate method to do something
     activateComplete: function ( entity ) {
         // call parent activate
         this.parent();
         // and doing something
     },
     // override the deactivate method to do something else
     deactivateComplete: function ( entity ) {
         // call parent deactivate
         this.parent();
         // and doing something else
     }
});
// then spawn an instance of the ig.UIToggleButton when the player is added to the game
// and player can click it to do something as well as something else

activateComplete()

Source:

deactivateComplete()

Source: