Animated Cursor: how get frame delay?

Started by
5 comments, last by BitMaster 7 years, 10 months ago

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?

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.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty
.ani cursor files have a delay associated with each frame. You can see this page for some details: http://www.gdgsoft.com/anituner/help/aniformat.htm

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

"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?

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.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

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

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.

This topic is closed to new replies.

Advertisement