Results 1 to 5 of 5

Thread: flipping/rotating overlayrendercomponent

  1. #1
    Squire
    Join Date
    Apr 2011
    Posts
    26

    Default flipping/rotating overlayrendercomponent

    I want to use one image and have it face all four directions. I use the pos2d, size2d and visible vars without a problem but setting flipX to 1 or rotation to 90 does nothing. I assume these are functional as you put them on the feature list?

    Thanks

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

    Default

    Hrm, yes rotation should be working fine, I use it a lot.

    Can you try stepping through void OverlayRenderComponent::OnRender(VariantList *pVList) and checking the value of m_pRotation? It shouldn't be 0 if you've set it.

    In case it's a bug with using it with flipX/flipY, maybe try rotating without those first and see if it works.
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Squire
    Join Date
    Apr 2011
    Posts
    26

    Default

    Just to be sure this is what I'm doing
    pEnt->GetVar("flipX")->Set((uint32)1);
    same with rotation where I put 90 and 270.

    Actually setting rotation seems to crash on windows. Line 138 in Variant.h, assertion failed on ( m_type == TYPE_UNUSED || m_type == TYPE_UINT32 )
    flipX doesn't crash, but in onRender it is set to 0. I'm confused here though, it only steps through once for that image even though I have several entities using it. But even when I set all those to flipX 1 it is still 0.

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

    Default

    Ok, I think I know what's wrong on both issues.

    First, flipX is not at the entity level, it's a parm of the OverlayRender component as that's the only thing it works with. (actually, not true, it also works with the ProgressBarComponent)

    So to fix, set like this:

    Code:
    EntityComponent *overlayComp = pEnt->GetComponentByName("OverlayRender");
    overlayComp->GetVar("flipX")->Set(uint32(1));
    Next, rotation is done at the entity level, but it is a float, not an int. The assert is saying "you are setting it as the wrong type, it's been previously initted with something else".

    So, to fix that, send it a float.

    If you're not sure about a parm, do a project-wide search for "rotation" or whatever and where it's initted should pop up and give you a better idea, for instance, rotate is initted like this:

    Code:
    m_pRotation = &GetParent()->GetVar("rotation")->GetFloat();  //in degrees
    And "flipX" would get this:

    Code:
    m_pFlipX = &GetVar("flipX")->GetUINT32();
    Notice the flipX one doesn't have GetParent()-> so you know it's at the component level of the file its in, not the entity like with "rotate". Yeah, it's confusing. I think I should have put flipX/flipY at the entity level really.
    Seth A. Robinson
    Robinson Technologies

  5. #5
    Squire
    Join Date
    Apr 2011
    Posts
    26

    Default

    Ok thanks. It's confusing to learn without intellisense and such helping out.

Similar Threads

  1. Flipping sprites
    By trigger-happy in forum Official ClanLib SDK Forums
    Replies: 8
    Last Post: 02-23-2010, 12:08 PM
  2. Rotating Font?
    By kingfinn in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 11-17-2009, 02:47 PM
  3. Rotating view and minimap
    By attle in forum Novashell Game Creation System
    Replies: 4
    Last Post: 12-22-2008, 02:26 AM
  4. Rotating tiles/entities
    By sphair in forum Novashell Game Creation System
    Replies: 0
    Last Post: 03-12-2007, 09:33 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
  •