User Tools

Site Tools


en:tutorials:structure_logall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:tutorials:structure_logall [2018/07/19 08:11 (3 months ago)] (current)
sausage created
Line 1: Line 1:
 +====== 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:
 +
 +<code ini>
 +[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
 +</​code>​
 +
 +The robot would be created in-game with:
 +
 +<code cpp>
 +orxObject_CreateFromConfig("​Robot);​
 +</​code>​
 +
 +Use the following command to log out all the current Structures live in your game:
 +
 +<code cpp>
 +orxStructure_LogAll();​
 +</​code>​
 +
 +In your console window, a coloured tree will be displayed:
 +
 +{{ :​tutorials:​robot-tree.png |}}
 +
 +Also, in your game log file, the same output would be generated:
 +
 +<​code>​
 +*** 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 ***
 +</​code>​
 +
 +This is very handy for getting a nice overview of your structure layout for debugging or comparison.
en/tutorials/structure_logall.txt ยท Last modified: 2018/07/19 08:11 (3 months ago) by sausage