2
/* ScummVM - Graphic Adventure Engine
4
* ScummVM is the legal property of its developers, whose names
5
* are too numerous to list here. Please refer to the COPYRIGHT
6
* file distributed with this source distribution.
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
#include "common/scummsys.h"
29
#if defined(SDL_BACKEND)
31
#include "backends/timer/sdl/sdl-timer.h"
33
#include "common/textconsole.h"
35
static Uint32 timer_handler(Uint32 interval, void *param) {
36
((DefaultTimerManager *)param)->handler();
40
SdlTimerManager::SdlTimerManager() {
41
// Initializes the SDL timer subsystem
42
if (SDL_InitSubSystem(SDL_INIT_TIMER) == -1) {
43
error("Could not initialize SDL: %s", SDL_GetError());
46
// Creates the timer callback
47
_timerID = SDL_AddTimer(10, &timer_handler, this);
50
SdlTimerManager::~SdlTimerManager() {
51
// Removes the timer callback
52
SDL_RemoveTimer(_timerID);