Results 1 to 4 of 4

Thread: dynamic OverlayEntity change

  1. #1

    Default dynamic OverlayEntity change

    Hello... I'm thinking about an optimal way to dynamicly change an image connected with an OverlayEntity. Is there any method to set it? I would like to set N different images to one pointer from time to time but can't figure out how to do that ... I tried to use CreateOverlayMethod twice for one pointer but after setting its visibility to false it was still visible like there was another instance of that entity somewhere "in the air"... I just don't get it.... I could just create N pointers with N OverlayEntities and manipulate with their visibility but that would be the worst solution...

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    You can change an image "on the fly" in an OverlayRenderComponent by changing its "fileName" parm. The CreateOverlayEntity utility function creates an OverlayRenderComponent, as does CreateOverlayButtonEntity and pretty much anything that requires a 2d visual, so this would work for all of them:

    First, create your entity:

    Code:
    Entity *pEnt = CreateOverlayEntity(pParent, "myEnt", "skeleton.rttex", 0, 0);
    Ok, it's been added and is displaying "skeleton.rttex". To change it later, you would do this:

    Code:
    //either use pEnt that you saved somewhere before, or grab it again like this:
    //Entity *pEnt = GetEntityRoot()->GetEntityByName("myEnt);
    
    pEnt->GetComponentByName("OverlayRender")->GetVar("fileName")->Set("pumpkin.rttex");
    It will load the new image and adjust its size variables/centering, etc as needed.

    Because "fileName" is just a variable of OverlayRender, you can use the MessageManager to schedule changes after X mount of milliseconds and such, useful for psuedo-animations.
    Seth A. Robinson
    Robinson Technologies

  3. #3

    Default

    Thank you very much Is there any detailed documentation where I could find a list of each component's varables ? It's hard to guess their names when they're string parameters in those methods...

  4. #4
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    Sorry - I'd like to have a page on the Proton Wiki for every component explaining how to use it but.. time. Anybody want to help me with this? I could check over anything added for correctness.

    Until that happens, your best bet is to look in the source file itself or ask here like you did. I can add usage examples to svn for tricky things if needed.

    Sometimes I put examples in the .h file, and if you check the .cpp's OnAdd(), you can see all the variables used.

    For instance, this is from RectRenderComponent::OnAdd():

    Code:
    m_pBorderColor = &GetVarWithDefault("borderColor", Variant(MAKE_RGBA(255,255,255,0)))->GetUINT32();
    This tells you there is a RGBA "borderColor" parm at the component level. Changing it does indeed change the border color. The default has 0 alpha, which means don't render it. So to get a border, you'd have to change this var.
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. setting overlayEntity position in realtime problem
    By blackMasoon in forum Proton SDK
    Replies: 0
    Last Post: 08-08-2011, 11:50 AM
  2. How to change CL_String to CString in MFC?
    By halley62373 in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 08-01-2011, 06:52 AM
  3. Change for CL_GUIManager
    By logixoul in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 05-26-2010, 06:58 PM
  4. How do I change controls?
    By in forum Dink Smallwood HD
    Replies: 8
    Last Post: 08-13-2006, 11:24 PM
  5. Question about what is a change
    By in forum Other RTsoft Games
    Replies: 1
    Last Post: 10-15-2002, 11:24 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •