Code:
case WM_PAINT:
/*Called when the window needs to be painted (redrawn). */
/* Starts painting. */
hdc = BeginPaint (hwnd, &ps);
//Sets up the off-screen drawing variables.
hdcMem = CreateCompatibleDC(hdc);
hdc_hbm = CreateCompatibleBitmap(hdc,640,480);
DeleteObject(SelectObject(hdcMem,hdc_hbm));
//Fill in the background.
FillRect(hdcMem,&Background_Area,wincl.hbrBackground);
// Sets the colour of the text
switch(Position_Type){case -2: SetTextColor(hdcMem,RGB(atoi(separators[266]+1),atoi(separators[267]+1),atoi(separators[268]+1))); break;
case -1: SetTextColor(hdcMem,RGB(atoi(separators[274]+1),atoi(separators[275]+1),atoi(separators[276]+1))); break;
case 0: SetTextColor(hdcMem,RGB(atoi(separators[282]+1),atoi(separators[283]+1),atoi(separators[284]+1))); break;
case 1: SetTextColor(hdcMem,RGB(atoi(separators[290]+1),atoi(separators[291]+1),atoi(separators[292]+1))); break;
case 2: SetTextColor(hdcMem,RGB(atoi(separators[298]+1),atoi(separators[299]+1),atoi(separators[300]+1))); break;
case 3: SetTextColor(hdcMem,RGB(atoi(separators[306]+1),atoi(separators[307]+1),atoi(separators[308]+1))); break;
case 4: SetTextColor(hdcMem,RGB(atoi(separators[314]+1),atoi(separators[315]+1),atoi(separators[316]+1))); break;}
// Sets the Font.
DeleteObject(SelectObject(hdcMem,Font));
SetBkMode(hdcMem,TRANSPARENT);
// Draws the text.
TB_Title->TB_Draw(hdcMem);
TB_Status->TB_Draw(hdcMem);
TB_Level->TB_Draw(hdcMem);
TB_Position->TB_Draw(hdcMem);
TB_Commands->TB_Draw(hdcMem);
TB_Message->TB_Draw(hdcMem);
TB_Battle1->TB_Draw(hdcMem);
TB_Battle2->TB_Draw(hdcMem);
// Draws the sword and shield.
hdcMem2 = CreateCompatibleDC(hdcMem);
DeleteObject(SelectObject(hdcMem2,Image1));
BitBlt(hdcMem,10,360,bm.bmWidth,bm.bmHeight,hdcMem2,0,0,SRCCOPY);
DeleteObject(SelectObject(hdcMem2,Image2));
BitBlt(hdcMem,490,360,bm.bmWidth,bm.bmHeight,hdcMem2,0,0,SRCCOPY);
DeleteDC(hdcMem2);
//Copies the bitmap drawn off-screen to the screen
BitBlt(ps.hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,hdcMem,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY);
//Deletes the hdc made for drawing in memory.
DeleteDC(hdcMem);
DeleteObject(hdc_hbm);
/* Stops painting. */
EndPaint (hwnd, &ps);
return 1;
break;
case WM_ERASEBKGND: return 1; // Say we handled it.