如何讓圖形不在閃爍

Home Home
引用 | 編輯 沒有明天
2007-02-23 19:05
樓主
推文 x0
這是我的程式碼
是可以用方向鍵讓圖形移動
我用的是dev-c++
我在網站找過許多資訊
可是都沒辦法解決我的問題

#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)

{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */

/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);

/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;

/* The c ..

訪客只能看到部份內容,免費 加入會員



獻花 x0
引用 | 編輯 fredxxx123
2007-02-24 08:34
1樓
  
閃爍啊~
就是利用緩衝區!!

先把圖都畫在緩衝區裡面,再一次貼上螢幕

至於緩衝區要怎麼用嘛~
我只記得當時書上是用Bitblt(...)去做的
剩下給人補上囉~
PS:用了DirectX之後就不用管這麼多了 表情

獻花 x0