Пример #1
0
void sdl_osd_interface::update(bool skip_redraw)
{
	sdl_window_info *window;

	if (m_watchdog != NULL)
		m_watchdog->reset();

	// if we're not skipping this redraw, update all windows
	if (!skip_redraw)
	{
//      profiler_mark(PROFILER_BLIT);
		for (window = sdl_window_list; window != NULL; window = window->next)
			sdlwindow_video_window_update(machine(), window);
//      profiler_mark(PROFILER_END);
	}

	// poll the joystick values here
	sdlinput_poll(machine());
	check_osd_inputs(machine());

#if !defined(NO_DEBUGGER)
	if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
		debugwin_update_during_game(machine());
#endif
}
Пример #2
0
void winwindow_process_events(int ingame)
{
	int is_debugger_visible = 0;
	MSG message;

	assert(GetCurrentThreadId() == main_threadid);

	// if we're running, disable some parts of the debugger
#if defined(MAME_DEBUG)
	if (ingame)
	{
		is_debugger_visible = (options.mame_debug && debugwin_is_debugger_visible());
		debugwin_update_during_game();
	}
#endif

	// remember the last time we did this
	last_event_check = osd_ticks();

	do
	{
		// if we are paused, lets wait for a message
		if (ui_temp_pause > 0)
			WaitMessage();

		// loop over all messages in the queue
		while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
		{
			int dispatch = TRUE;

			switch (message.message)
			{
				// ignore keyboard messages
				case WM_SYSKEYUP:
				case WM_SYSKEYDOWN:
#ifndef MESS
				case WM_KEYUP:
				case WM_KEYDOWN:
				case WM_CHAR:
#endif
					dispatch = is_debugger_visible;
					break;

				// special case for quit
				case WM_QUIT:
					fatalerror("Unexpected WM_QUIT message\n");
					break;

				// temporary pause from the window thread
				case WM_USER_UI_TEMP_PAUSE:
					winwindow_ui_pause_from_main_thread(message.wParam);
					dispatch = FALSE;
					break;

				// request exit from the window thread
				case WM_USER_REQUEST_EXIT:
					mame_schedule_exit(Machine);
					dispatch = FALSE;
					break;

				// execute arbitrary function
				case WM_USER_EXEC_FUNC:
					{
						void (*func)(void *) = (void (*)(void *)) message.wParam;
						void *param = (void *) message.lParam;
						func(param);
					}
					break;

				// forward mouse button downs to the input system
				case WM_LBUTTONDOWN:
					input_mouse_button_down(0, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
					dispatch = is_debugger_visible;
					break;

				case WM_RBUTTONDOWN:
					input_mouse_button_down(1, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
					dispatch = is_debugger_visible;
					break;

				case WM_MBUTTONDOWN:
					input_mouse_button_down(2, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
					dispatch = is_debugger_visible;
					break;

				case WM_XBUTTONDOWN:
					input_mouse_button_down(3, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
					dispatch = is_debugger_visible;
					break;

				// forward mouse button ups to the input system
				case WM_LBUTTONUP:
					input_mouse_button_up(0);
					dispatch = is_debugger_visible;
					break;

				case WM_RBUTTONUP:
					input_mouse_button_up(1);
					dispatch = is_debugger_visible;
					break;

				case WM_MBUTTONUP:
					input_mouse_button_up(2);
					dispatch = is_debugger_visible;
					break;

				case WM_XBUTTONUP:
					input_mouse_button_up(3);
					dispatch = is_debugger_visible;
					break;
			}

			// dispatch if necessary
			if (dispatch)
			{
				TranslateMessage(&message);
				DispatchMessage(&message);
			}
		}
	}
	while(ui_temp_pause > 0);
}