Crystal Space
Welcome, Guest. Please login or register.
November 20, 2014, 11:45:11 pm

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2046 Topics by 9077 Members
Latest Member: Pwrsrg
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  Troubles with billboard
« previous next »
Pages: [1] Print
Author Topic: Troubles with billboard  (Read 2379 times)
Antol
Newbie
*
Posts: 3


View Profile Email
« on: December 12, 2010, 08:29:46 am »

Hello, I have a problem and need your advice. I can`t make billboard clickable. Actually, it don`t react to any my activities. I`m new in this subject, CELL and CS I mean, help me please.
 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;
}

Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.985 seconds with 16 queries.