Table of Contents

 
AddObject
 

Purpose

Adds a new object to the current scene

 

Protoype

void CSceneMngr::AddObject (int i_type, string str_name, int i_layer = -1)
 

Parameters

type the type of object
name the ID of the object
layer the layer to insert this object in
 

Description

After a scene has been loaded, you can add objects to that scene using this function. You must specify the type of object (MUSIC_OBJ, TEXT_OBJ, IMAGE_OBJ, BUTTON_OBJ, SPRITE_OBJ) that you will be adding, along with the unique ID that was assigned to that object when it was created. You then have the option of sticking the object anywhere in the scene. If you choose to ignore the last parameter, the object will automatically be loaded as the bottom-most layer.

NOTE: Layers begin at 0, not 1

NOTE: If you try adding an object in a layer more than one greater that of the lowest layer, the object will be insterted at the lowest layer. So if there are 22 layers and you try inserting an object at layer 34, it will instead be insterted at layer 23.

NOTE: If no scene is loaded when this function is called the function will exit after reporting a warning in the event log

 

Use

CSceneMngr scene;
// assume scene loaded
// load a text object into layer 15
scene.AddObject(TEXT_OBJ, "my_text", 15);
 

Prev: Table of Contents
Next: AddScene