Here my billboard:
Code:
_g3d->BeginDraw (CSDRAW_2DGRAPHICS);
//adding billboard factory
if (!_pl->LoadPropertyClassFactory ("cel.pcfactory.2d.billboard"))
printf("Error loading pcbillboard factory!");
//loading textures
iTextureWrapper* txt2 = _engine->CreateTexture("start", "gameData/start.png", 0, CS_TEXTURE_2D);
txt2->Register (_g3d->GetTextureManager ());
_engine->CreateMaterial ("start", txt2);
//Creating entity
menu_entity1 = _pl->CreateEntity ("menu_start", _bl, "menu_behave",
"pc2d.billboard",
CEL_PROPCLASS_END);
//creating pcBillboard (each pcBillboard controls one billboard)
csRef<iPcBillboard> start_g = celQueryPropertyClassEntity <iPcBillboard> (menu_entity1);
//enable events processing
start_g->EnableEvents(true);
if(!start_g->AreEventsEnabled())
printf("pcBillbord events are disabled!");
//billboard creating + some parametres for it
start_g->SetBillboardName("start");
iBillboard* b1 = start_g->GetBillboard();
b1->SetSize(73143, 75143);
b1->SetMaterialNameFast("start");
b1->SetPosition(65000,55600);
b1->SetTextBgColor(csColor(0,0,0));
b1->StackTop();
//billboard contol flags switching on
csFlags& f1 = b1->GetFlags();
f1.SetAll(true);
f1.Set(CEL_BILLBOARD_CLICKABLE, true);
+++++++++++++++++++++++++++++++++++++++++++++++++
//behaviour for billboard events
BehaviourMenu::BehaviourMenu( iCelEntity* entity, BehaviourLayer* bl, iCelPlLayer* pl)
: CommonBehaviour (entity, bl, pl) {
//catching message
id_pcbillboard_select = pl->FetchStringID ("cel.billboard.select.down");//*/("pcbillboard_select");
//using [u]pcbillboard_select[/u] instead of [u]cel.billboard.select.down[/u] changes nothing
}
bool BehaviourMenu::ReceiveMessage( csStringID msg_id, iMessageSender* sender, celData& ret,
iCelParameterBlock* params ) {
//getting entity name to compare
const char *entityName = _entity->GetName();
//static pointer to call RunFirstlevel
GameApplication *p = GameApplication::getApp();
if( !strcmp( entityName, "menu_start")) {
p->RunFirstLevel();
printf("***Start clicked***");
} else if ( !strcmp( entityName, "menu_exit")) {
p->CloseApp();
//printf("Goodbye!");
} else if( !strcmp( entityName, "options")) {
printf("***Options clicked***");
}
return true;
}
//adding billboard factory
if (!_pl->LoadPropertyClassFactory ("cel.pcfactory.2d.billboard"))
printf("Error loading pcbillboard factory!");
//loading textures
iTextureWrapper* txt2 = _engine->CreateTexture("start", "gameData/start.png", 0, CS_TEXTURE_2D);
txt2->Register (_g3d->GetTextureManager ());
_engine->CreateMaterial ("start", txt2);
//Creating entity
menu_entity1 = _pl->CreateEntity ("menu_start", _bl, "menu_behave",
"pc2d.billboard",
CEL_PROPCLASS_END);
//creating pcBillboard (each pcBillboard controls one billboard)
csRef<iPcBillboard> start_g = celQueryPropertyClassEntity <iPcBillboard> (menu_entity1);
//enable events processing
start_g->EnableEvents(true);
if(!start_g->AreEventsEnabled())
printf("pcBillbord events are disabled!");
//billboard creating + some parametres for it
start_g->SetBillboardName("start");
iBillboard* b1 = start_g->GetBillboard();
b1->SetSize(73143, 75143);
b1->SetMaterialNameFast("start");
b1->SetPosition(65000,55600);
b1->SetTextBgColor(csColor(0,0,0));
b1->StackTop();
//billboard contol flags switching on
csFlags& f1 = b1->GetFlags();
f1.SetAll(true);
f1.Set(CEL_BILLBOARD_CLICKABLE, true);
+++++++++++++++++++++++++++++++++++++++++++++++++
//behaviour for billboard events
BehaviourMenu::BehaviourMenu( iCelEntity* entity, BehaviourLayer* bl, iCelPlLayer* pl)
: CommonBehaviour (entity, bl, pl) {
//catching message
id_pcbillboard_select = pl->FetchStringID ("cel.billboard.select.down");//*/("pcbillboard_select");
//using [u]pcbillboard_select[/u] instead of [u]cel.billboard.select.down[/u] changes nothing
}
bool BehaviourMenu::ReceiveMessage( csStringID msg_id, iMessageSender* sender, celData& ret,
iCelParameterBlock* params ) {
//getting entity name to compare
const char *entityName = _entity->GetName();
//static pointer to call RunFirstlevel
GameApplication *p = GameApplication::getApp();
if( !strcmp( entityName, "menu_start")) {
p->RunFirstLevel();
printf("***Start clicked***");
} else if ( !strcmp( entityName, "menu_exit")) {
p->CloseApp();
//printf("Goodbye!");
} else if( !strcmp( entityName, "options")) {
printf("***Options clicked***");
}
return true;
}





