Logging all Structures to a Tree

The Data Configuration feature of Orx makes it simple to build up a complex scene or object with minimal code. All these items are defined in various ini files however the developer chooses to arrange them.

Orx provides a nice way to display a tree view of your Orx objects currently in game, and what structures make them up.

Let's say you had a robot made up of several Objects, Graphics, Bodies and Textures. Also there is a Viewport and Camera:

[MainViewport]
Camera = MainCamera
 
[MainCamera]
Position = (0.0, 0.0, -1.0)
 
[RobotGraphic]
Texture = robot-inside.png
 
[Robot]
Graphic   = RobotGraphic
ChildList = LeftWheel # RightWheel # WeaponObject
Body      = RobotBody
 
[RobotBody]
PartList = RobotBodyPart 
 
[RobotBodyPart]
Type = box
 
[WeaponGraphic]
Texture = weapon.png
 
 
[WeaponObject]
Graphic = WeaponGraphic
Body    = WeaponBody
 
 
[WeaponBody]
PartList = WeaponBodyPart
 
[WeaponBodyPart]
Type  = box
Solid = true

The robot would be created in-game with:

orxObject_CreateFromConfig("Robot);

Use the following command to log out all the current Structures live in your game:

orxStructure_LogAll();

In your console window, a coloured tree will be displayed:

Also, in your game log file, the same output would be generated:

*** BEGIN STRUCTURE LOG ***

[ROOT]
  +-VIEWPORT         "MainViewport"                                [0001000000000014]
  | `-CAMERA           "MainCamera"                                [000200000000000C]
  +-OBJECT           "Robot"                                       [000100000000000F]
  | +-BODY             "RobotBody"                                 [0002000000000001]
  | +-OBJECT           "LeftWheel"                                 [000100010000002F]
  | | +-BODY             "LeftWheelBody"                           [0002000100000021]
  | | `-GRAPHIC          "WheelGraphic"                            [0002000100000025]
  | +-OBJECT           "WeaponObject"                              [000100030000006F]
  | | +-BODY             "WeaponBody"                              [0002000300000061]
  | | `-GRAPHIC          "WeaponGraphic"                           [0002000300000065]
  | |   `-TEXTURE          "weapon.png"                            [00010005000000B3]
  | +-OBJECT           "RightWheel"                                [000100020000004F]
  | | +-BODY             "RightWheelBody"                          [0002000200000041]
  | | `-GRAPHIC          "WheelGraphic"                            [0002000200000045]
  | |   `-TEXTURE          "wheel.png"                             [0002000400000093]
  | `-GRAPHIC          "RobotGraphic"                              [0002000000000005]
  |   `-TEXTURE          "robot-inside.png"                        [0001000300000073]
  | `-TEXTURE          "default"                                   [0002000200000053]

*** END STRUCTURE LOG ***

This is very handy for getting a nice overview of your structure layout for debugging or comparison.