How to create sprite animation using winapi c?

How to create sprite animation using winapi without gdi? im trying to do this:

Sprite(hDC, L"fon.bmp",150, 14, 30, 30, SRCCOPY);

void Sprite(HDC hdc, CHAR* Path, int x, int y, int Width, int Height, DWORD rop)
{
    HBITMAP bmp = (HBITMAP) LoadImage(NULL, Path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    HDC memdc = CreateCompatibleDC(hdc);
    SelectObject(memdc, bmp);
    BitBlt(hdc, x, y, Width, Height, memdc, 0, 0, rop);
}

How i can change frame?

Upvotes: 0

Views: 664

Answers (1)

Cem Kalyoncu
Cem Kalyoncu

Reputation: 14593

Create a vector and place frames of the animation. Then using some sort of timer, erase the screen and bitblt the next frame's image. This is common way of doing frame based animation and there is nothing specific for winapi.

Upvotes: 1

Related Questions