Jump to content
  • Advertisement
Sign in to follow this  
cambalinho

Animated Cursor: how get frame delay?

This topic is 933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

using DrawIconEx() i can get the frame count:

int GetAniFrameCount(HCURSOR anicursor)
{
    BitmapDC btDC(16,16);//create a memory DC
    int intFrameCount=0;
    while( DrawIconEx(btDC,0,0,anicursor,16,16,intFrameCount,0,DI_NORMAL)!=NULL)
    {
        intFrameCount=intFrameCount+1;
    }
    return intFrameCount;
}

it's a nice thot for it ;)

 

i need 1 correction: normaly we say 'frame rate' or 'frame delay'?

how can i get the frame delay? or  it's fixed?

Edited by cambalinho

Share this post


Link to post
Share on other sites
Advertisement

I don't understand this.

 

First of all, your code won't even compile because "i" is undeclared.

 

Your while loop will probably never exit, so your program will just get stuck once you call GetAniFrameCount().

Even if this somehow worked, it would not return the frame rate of your app. You'd just be timing how fast DrawIconEx() is, which has nothing to do with frame rate.

 

And lastly, Windows applications don't have a "frame rate" per se. They are only redrawn when they need to be redrawn (e.g. when you rescale the window), so the concept of "frame rate" doesn't exist.

Edited by TheComet

Share this post


Link to post
Share on other sites

"DWORD JifRate; // Default Jiffies (1/60th of a second) if rate chunk not present."

thinking on that way: 1000/60 = 16,66(6) ms... right?

Share this post


Link to post
Share on other sites

Yes, a "jiffy" is 16.67ms.

 

Each frame of the animation can control how long it is displayed. If no specific time is given, the setting you mentioned is the default frame delay.

 

So you technically need to look at every frame to see if it specifies a custom delay time, and respect that time to get playback to look right.

Share this post


Link to post
Share on other sites

but i continue confused with 1 thing: how can i get the JifRate?

the win32 don't have tagANIHeader structure(i think). so i don't know use it

Share this post


Link to post
Share on other sites
The link ApochPiQ posted appears to describe tagANIHeader already, including where to find it in the .ani files. Either you will have to implement what is described there yourself or you need to find a library which does it for you. Considering the format looks rather simple to implement I would not spend a lot of time looking for a 3rd party library. Edited by BitMaster

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!