Ejemplo n.º 1
0
int PASCAL WinMain (HINSTANCE instance_in, HINSTANCE previous_instance,
  LPSTR command_line, int show_style)
{

 	MSG		  msg;

  instance = instance_in;
  WinInit ();
  AppInit ();
  while (!quit) {
		if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))	{
			if (msg.message == WM_QUIT)
				quit = true;
			else {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
    } else
      AppUpdate ();

  }
  AppTerm ();
  return 0;

}
Ejemplo n.º 2
0
int AppMsgLoop()
{
	MSG msg;
	ZeroMemory(&msg, sizeof(MSG));

_AppLoop:
	// 检测是否有消息要处理
	if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
	{
		if (!GetMessage(&msg, NULL, 0, 0))
		{
			// 转向结束程序
			goto _ExitApp;
		}

		// 执行消息处理
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	else
	{
		// 如果没有任何消息要处理就调用主循环
		AppEntryClass()->Process();
		Sleep(1);
	}
	goto _AppLoop;

_ExitApp:
	AppTerm();

	return (int)msg.wParam;
}
Ejemplo n.º 3
0
int main (int argc, char* argv[])
{
  glutInit (&argc, argv);
  glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
  glutInitDisplayString("double rgba depth>=16 rgba");
  glutInitWindowSize (width, height);
  glutInitWindowPosition (0,0);
  glutCreateWindow (APP_TITLE);
  glutVisibilityFunc(visible);
  glutReshapeFunc (resize);
  glutKeyboardFunc (keyboard);
  glutSpecialFunc (keyboard_s);

  AppInit ();

  glutMainLoop();

  AppTerm ();

  return 0;
}