Game Development Reference
In-Depth Information
for (y = 0 ; y < ImageHeight ; y++)
{
for (x = 0 ; x < ImageWidth ; x++)
{
int Ofs = y * ImageWidth + x;
int c = (x ^ y) & 0xFF;
int RGB = (c<<16) | (c<<8) | (c<<0) | 0xFF000000;
( ( unsigned int* )g_FrameBuffer )[ Ofs ] = RGB;
}
}
}
The following code shows the WinAPI window function:
LRESULT CALLBACK MyFunc(HWND h, UINT msg, WPARAM w, LPARAM p)
{
PAINTSTRUCT ps;
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_KEYUP:
OnKeyUp(w);
break;
case WM_KEYDOWN:
OnKeyDown(w);
break;
case WM_LBUTTONDOWN:
SetCapture(h);
OnMouseDown(x, y);
break;
case WM_MOUSEMOVE:
OnMouseMove(x, y);
break;
case WM_LBUTTONUP:
OnMouseUp(x, y);
ReleaseCapture();
break;
case WM_PAINT:
dc = BeginPaint(h, &ps);
DrawFrame();
 
Search WWH ::




Custom Search