Exemplo n.º 1
0
const char *VideoDriver_Allegro::Start(const char * const *parm)
{
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) {
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
		return "Failed to set up Allegro";
	}
	_allegro_instance_count++;

	install_timer();
	install_mouse();
	install_keyboard();

#if defined _DEBUG
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
 * be triggered, so rereplace the signals and make the debugger useful. */
	signal(SIGABRT, NULL);
	signal(SIGSEGV, NULL);
#endif

#if defined(DOS)
	/* Force DOS builds to ALWAYS use full screen as
	 * it can't do windowed. */
	_fullscreen = true;
#endif

	GetVideoModes();
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		return "Failed to set up Allegro video";
	}
	MarkWholeScreenDirty();
	set_close_button_callback(HandleExitGameRequest);

	return NULL;
}
Exemplo n.º 2
0
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
{
	_fullscreen = fullscreen;
	GetVideoModes(); // get the list of available video modes
	if (_num_resolutions == 0 || !CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		/* switching resolution failed, put back full_screen to original status */
		_fullscreen ^= true;
		return false;
	}
	return true;
}
Exemplo n.º 3
0
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
{
	if (_draw_mutex != NULL) _draw_mutex->BeginCritical(true);
	_fullscreen = fullscreen;
	GetVideoModes(); // get the list of available video modes
	bool ret = _num_resolutions != 0 && CreateMainSurface(_cur_resolution.width, _cur_resolution.height);

	if (!ret) {
		/* switching resolution failed, put back full_screen to original status */
		_fullscreen ^= true;
	}

	if (_draw_mutex != NULL) _draw_mutex->EndCritical(true);
	return ret;
}
Exemplo n.º 4
0
bool VideoDriver_Allegro::ToggleFullscreen(bool fullscreen)
{
#ifdef DOS
	return false;
#else
	_fullscreen = fullscreen;
	GetVideoModes(); // get the list of available video modes
	if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
		/* switching resolution failed, put back full_screen to original status */
		_fullscreen ^= true;
		return false;
	}
	return true;
#endif
}
Exemplo n.º 5
0
const char *VideoDriver_SDL::Start(const char * const *parm)
{
	char buf[30];
	_use_hwpalette = GetDriverParamInt(parm, "hw_palette", 2);

	const char *s = SdlOpen(SDL_INIT_VIDEO);
	if (s != NULL) return s;

	GetVideoModes();
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		return SDL_CALL SDL_GetError();
	}

	SDL_CALL SDL_VideoDriverName(buf, sizeof buf);
	DEBUG(driver, 1, "SDL: using driver '%s'", buf);

	MarkWholeScreenDirty();
	SetupKeyboard();

	_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL;

	return NULL;
}
Exemplo n.º 6
0
const char *VideoDriver_SDL::Start(const char * const *parm)
{
	char buf[30];

	const char *s = SdlOpen(SDL_INIT_VIDEO);
	if (s != NULL) return s;

	GetVideoModes();
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		return SDL_CALL SDL_GetError();
	}

	SDL_CALL SDL_VideoDriverName(buf, sizeof buf);
	DEBUG(driver, 1, "SDL: using driver '%s'", buf);

	MarkWholeScreenDirty();

	SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
	SDL_CALL SDL_EnableUNICODE(1);

	_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL;

	return NULL;
}