00001 /*
00002 * SDLmm - a C++ wrapper for SDL and related libraries
00003 * Copyright © 2001 David Hedbor <david@hedbor.org>
00004 *
00005 * This program is free software; you can redistribute it and/or
00006 * modify it under the terms of the GNU General Public License as
00007 * published by the Free Software Foundation; either version 2 of the
00008 * License, or (at your option) any later version.
00009 *
00010 * This program is distributed in the hope that it will be useful, but
00011 * WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013 * General Public License for more details.
00014 *
00015 * You should have received a copy of the GNU General Public License
00016 * along with this program; if not, write to the Free Software
00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 *
00019 */
00020
00021 // Description
00022
00023 #ifndef SDLMM_TIMER_H
00024 #define SDLMM_TIMER_H
00025
00026 namespace SDLmm {
00027 class Timer {
00028 public:
00029 typedef unsigned int Ticks;
00030
00031 static bool Init();
00032 static void Quit();
00033
00034 static Ticks GetTicks();
00035
00036 Timer() : m_Tick(GetTicks()), m_Elapsed(0) { }
00037
00038 void Mark();
00039
00040 unsigned int GetElapsed() const {
00041 // What is the purpose of this assertion?
00042 // it will always be true since Ticks is an unsigned int/grendel
00043 // ASSERT(m_Elapsed >= 0);
00044 return m_Elapsed;
00045 }
00046
00047 private:
00048 Ticks m_Tick;
00049 Ticks m_Elapsed;
00050 };
00051 }
00052
00053 #endif // SDLMM_TIMER_H
00054
Documentation automatically generated by written by Dimitri van Heesch. |
Project hosted at |