File diff r25013:4c02a1340d93 → r25014:e1f1bf3a062e
src/video/allegro_v.cpp
Show inline comments
 
@@ -409,13 +409,13 @@ bool VideoDriver_Allegro::PollEvent()
 
/**
 
 * There are multiple modules that might be using Allegro and
 
 * Allegro can only be initiated once.
 
 */
 
int _allegro_instance_count = 0;
 

	
 
const char *VideoDriver_Allegro::Start(const StringList &parm)
 
const char *VideoDriver_Allegro::Start(const StringList &param)
 
{
 
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
 
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
 
		return "Failed to set up Allegro";
 
	}
 
	_allegro_instance_count++;
 
@@ -437,12 +437,14 @@ const char *VideoDriver_Allegro::Start(c
 
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
 
		return "Failed to set up Allegro video";
 
	}
 
	MarkWholeScreenDirty();
 
	set_close_button_callback(HandleExitGameRequest);
 

	
 
	this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
 

	
 
	return nullptr;
 
}
 

	
 
void VideoDriver_Allegro::Stop()
 
{
 
	if (--_allegro_instance_count == 0) allegro_exit();
 
@@ -472,18 +474,22 @@ void VideoDriver_Allegro::InputLoop()
 

	
 
	if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
 
}
 

	
 
void VideoDriver_Allegro::MainLoop()
 
{
 
	this->StartGameThread();
 

	
 
	for (;;) {
 
		if (_exit_game) return;
 
		if (_exit_game) break;
 

	
 
		this->Tick();
 
		this->SleepTillNextTick();
 
	}
 

	
 
	this->StopGameThread();
 
}
 

	
 
bool VideoDriver_Allegro::ChangeResolution(int w, int h)
 
{
 
	return CreateMainSurface(w, h);
 
}