In Orxonox, there are some classes refered to be "objects". In this context an object is not an instance of a class, but a class beeing relevant to the game-logic. Examples of objects are: A ship (but not the model), a particle effect (but not the particles themselfes), a trigger (which might be totally abstract like "finish the game after 20 minutes"), a HUD (but not the graphics). Examples of classes not beeing objects are: Interfaces (but objects might inherit from them), graphical components (meshes, textures, sprites, billboards, …), helper classes (Timer, …), classes in external libraries (network, audio, core, …).
To differ objects from other classes, they all derive from BaseObject. They might have other parents like interfaces or listeners, but they must inherit from BaseObject. The other way round you can cast every object to BaseObject, even if the only thing you know is it's a derivative of an interface like Tickable or Synchronisable.
The BaseObject itself inherits from OrxonoxClass.
The BaseObject provides several functions and states:
- XMLPort(element, mode) is a virtual function defining rules to parse an xml element and assign values and subobjects to the object. This is used by the Loader?. See XMLPort for more information.
- setName(name): Sets the name of the object. This involves a call to changedName() (see below).
- getName(): Returns the name of the object (if set).
- changedName(): A virtual function which gets called if the name of the object changes. Can be changed by a subclass if the name is somehow important and changes have to be tracked.
- setActive(bActive): Changes the activity of the object. Every object may define it's own definition of "activity" (see changedActivity).
- isActive(): Returns true if the object is active.
- changedActivity(): A virtual function which gets called if the activity of the object changes. This allows the class to implement it's own definition of "activity".
- setVisible(bVisible): Changes the visibility of the object. Every object may define it's own definition of "visibility" (see changedVisibility).
- isVisible(): Returns true if the object is visiblee.
- changedVisibility(): A virtual function which gets called if the visibility of the object changes. This allows the class to implement it's own definition of "visibility".
In this illustration of a class-tree (Test.h), the classes A1, A2 and A3 (and all derivatives) are "objects", because they inherit from BaseObject. As you can see, there are some Interfaces. Interfaces aren't connected with the BaseObject, they're on the same level. They all inherit from OrxonoxClass, but this isn't relevant to the game-logic.