About Store Forum Documentation Contact



Post Reply 
Returned parameter of drawPrepared
Author Message
Kevin Offline
Member

Post: #1
Returned parameter of drawPrepared
Hi,
I've just updated my EE version, and as I noticed there are some major differences (which also sound good).
I've changed the code of my project to use this version, but I encountered some problems...
Especially the UInt return parameter of drawPrepared isn't working correctly for me (or I'm using it wrong).
In the previous version of EE I used this code to draw a grenade with explosion:

Code:
void Grenade::draw() {
    //only draw grenade, if LifeSpan is valid -> grenade is still alive/no explosion
    if(LifeSpan != -1)
        __super::draw();

    switch(Renderer()) {
        case RM_BLEND  :
        case RM_PALETTE:
            explosion.draw();
    }
}

I changed it like to this code block to work with the current version:

Code:
UInt Grenade::drawPrepare() {
    //only draw grenade, if LifeSpan is valid -> grenade is still alive/no explosion
    if(LifeSpan != -1)
        __super::drawPrepare();

    switch(Renderer()) {
        case RM_BLEND  :
        case RM_PALETTE:
            explosion.draw();
    }
    return EE::IndexToFlag(RM_BLEND) | EE::IndexToFlag(RM_PALETTE);
}

The grenade is drawn correctly, but the explosion isn't drawn at all...
I don't know how to return the UInt, that's the problem I'm facing...

regards,
Kevin
01-09-2010 03:04 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Returned parameter of drawPrepared
Hi,

please check the comments on drawPrepare, with it you must return the value to request rendering for an additional mode.
Code:
return EE::IndexToFlag(RM_BLEND) | EE::IndexToFlag(RM_PALETTE);
you're doing this ok, but you need to move the explosion.draw into proper functions:
Code:
void Grenade::drawBlend()
{
   explosion.draw();
}
void Grenade::drawPalette()
{
   explosion.draw();
}
and you should remove explosion.draw from drawPrepare()
01-09-2010 04:26 PM
Find all posts by this user Quote this message in a reply
Kevin Offline
Member

Post: #3
RE: Returned parameter of drawPrepared
ok thanks, works fine now wink
01-09-2010 04:38 PM
Find all posts by this user Quote this message in a reply
Post Reply