Jump to content
  • Advertisement
Sign in to follow this  
Marusu

Flicker

This topic is 3262 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I need help to remove flicker. I even use double buffer, but that doesn't help...
LRESULT CALLBACK WinProc (HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_CREATE:
			//main.hCursor = LoadCursor(hInstance, IDC_ARROW);
			return(0);
			break;
		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case ID_EXIT:
					PostMessage(handle, WM_DESTROY, 0, 0);
					return(0);
					break;
			}
			break;
		case WM_CHAR:
			if (name.b)
			{
				if (wParam == '\b' && name.i >= 0)
					name.wc[--name.i] = ' ';
				else if (wParam == 13)
				{
					name.b = FALSE;
				}
				else if (name.i == 15)
					MessageBox(handle, L"Perpildei visą atmintį skirtą vardui", L"Klaida", MB_ICONERROR);
				else
					name.wc[name.i++] = wParam;
				InvalidateRect(handle, NULL, TRUE);
			}
			return(0);
			break;
		case WM_LBUTTONDOWN:
			if (!name.b && !game.bEnd)
			{
				game.iX = LOWORD(lParam);
				game.iY = HIWORD(lParam);
				Game(handle);
			}
			return(0);
			break;
		case WM_PAINT:
		{
			hdc = BeginPaint(handle, &ps);

			HDC hBuffer = CreateCompatibleDC(hdc);

			HPEN hPen = CreatePen(PS_SOLID, 10, RGB(0, 0, 0));
			SelectObject(hBuffer, hPen);

			if (game.iWinner == 0)
				game.bGame = true;
			if (name.b)
			{
				BackgroundImage (hBuffer);
				TextOut(hBuffer, 10, 10, L"Įvesk savo vardą:", 17);
				TextOut(hBuffer, 10, 40, name.wc, 15);
			}
			else if (game.bGame)
			{
				//BackgroundImage (hBuffer);
				Table(hBuffer);
			}
			else if (game.bEnd)
			{
				if (game.iWin <= 0)
				{
					FailImage(hBuffer);
				}
				else
					SuccessImage(hBuffer);
			}

			BitBlt(hdc, 0, 0, 300, 400, hBuffer, 0, 0, SRCCOPY);

			DeleteObject(hPen);
			DeleteDC(hBuffer);

			EndPaint(handle, &ps);
			return(0);
			break;
		}
		case WM_DESTROY:
			PostQuitMessage(0);
			return(0);
			break;
		default:
			break;
	}
	return DefWindowProc(handle, message, wParam, lParam);
}



This is very important to me. I want to get it doen before moving to directx. Any help will be appreceated. [Edited by - Marusu on October 29, 2009 1:42:27 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!