简体   繁体   English

如何使用Winapi C创建Sprite动画?

[英]How to create sprite animation using winapi c?

How to create sprite animation using winapi without gdi? 如何在不使用gdi的情况下使用winapi创建精灵动画? 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? 我如何更改框架?

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. 这是做基于帧的动画的常见方法,并且没有特定于winapi的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM