PDA

View Full Version : Placing Entities next to each other



BigBMan
11-18-2010, 07:24 AM
Trying to place one of your text buttons next to another but my current (and likely incorrect) method of getting an Entity's width/height isn't working.


pEnt = CreateTextButtonEntity(pBG, "Debug", x, y, "Debug Options");
pEnt->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&MainMenuOnSelect);
pEnt->GetVar("alignment")->Set(uint32(ALIGNMENT_DOWN_LEFT));

x += ((CL_Vec2f*)(pEnt->GetVar("size2d")))->x + space;

pEnt = CreateTextButtonEntity(pBG, "Terrain", x, y, "3D Terrain");
pEnt->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&MainMenuOnSelect);
pEnt->GetVar("alignment")->Set(uint32(ALIGNMENT_DOWN_LEFT));



Any ideas?

Seth
11-18-2010, 11:30 AM
You had:


x += ((CL_Vec2f*)(pEnt->GetVar("size2d")))->x + space;

Don't think this is right, try this:


x += pEnt->GetVar("size2d")->GetVector2().x + space;