Ejemplo n.º 1
0
void WzMainWindow::paintGL()
{
	if (notReadyToPaint)
	{
		return;
	}
	if (crashing)
	{
		glClear(GL_COLOR_BUFFER_BIT);
		swapBuffers();
		return;
	}

	mainLoop();

	// Tell the input system about the start of another frame
	inputNewFrame();
	update();	// add a new paint event for constant redraws
}
Ejemplo n.º 2
0
// Actual mainloop
void wzMainEventLoop(void)
{
	SDL_Event event;

	while (true)
	{
		/* Deal with any windows messages */
		while (SDL_PollEvent(&event))
		{
			switch (event.type)
			{
			case SDL_KEYUP:
			case SDL_KEYDOWN:
				inputHandleKeyEvent(&event.key);
				break;
			case SDL_MOUSEBUTTONUP:
			case SDL_MOUSEBUTTONDOWN:
				inputHandleMouseButtonEvent(&event.button);
				break;
			case SDL_MOUSEMOTION:
				inputHandleMouseMotionEvent(&event.motion);
				break;
			case SDL_MOUSEWHEEL:
				inputHandleMouseWheelEvent(&event.wheel);
				break;
			case SDL_WINDOWEVENT:
				handleActiveEvent(&event);
				break;
			case SDL_TEXTINPUT:	// SDL now handles text input differently
				inputhandleText(&event.text);
				break;
			case SDL_QUIT:
				return;
			default:
				break;
			}
		}
		appPtr->processEvents();		// Qt needs to do its stuff
		mainLoop();				// WZ does its thing
		inputNewFrame();			// reset input states
	}
}