ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

sdl-timer.cpp

Go to the documentation of this file.
00001 
00002 /* ScummVM - Graphic Adventure Engine
00003  *
00004  * ScummVM is the legal property of its developers, whose names
00005  * are too numerous to list here. Please refer to the COPYRIGHT
00006  * file distributed with this source distribution.
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  */
00023 
00024 #include "common/scummsys.h"
00025 
00026 #if defined(SDL_BACKEND)
00027 
00028 #include "backends/timer/sdl/sdl-timer.h"
00029 
00030 #include "common/textconsole.h"
00031 
00032 static Uint32 timer_handler(Uint32 interval, void *param) {
00033     ((DefaultTimerManager *)param)->handler();
00034     return interval;
00035 }
00036 
00037 SdlTimerManager::SdlTimerManager() {
00038     // Initializes the SDL timer subsystem
00039     if (SDL_InitSubSystem(SDL_INIT_TIMER) == -1) {
00040         error("Could not initialize SDL: %s", SDL_GetError());
00041     }
00042 
00043     // Creates the timer callback
00044     _timerID = SDL_AddTimer(10, &timer_handler, this);
00045 }
00046 
00047 SdlTimerManager::~SdlTimerManager() {
00048     // Removes the timer callback
00049     SDL_RemoveTimer(_timerID);
00050 }
00051 
00052 #endif


Generated on Sat Feb 16 2019 05:01:03 for ResidualVM by doxygen 1.7.1
curved edge   curved edge