Source: easytimer.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          easytimer.h  -  description
                             -------------------
    begin                : Wed Oct 30 2002
    copyright            : (C) 2002 by Vladimir Grichina
    email                : vgrichina@mail.ru
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef EASYTIMER_H
#define EASYTIMER_H


#include "SDL.h"

/**Timer class. Calls a callback function every specified period of time
  *@author Vladimir Grichina
  */

class EasyTimer {
public: 
	EasyTimer();
	~EasyTimer();
	/**Callback which is called every time when period is expired
	*/
	void (*onTimer)(int time);
  /** Stops timer
  */
  void stop();
  /** Starts timer
	*/
  void start(int period);
  /** Call this method to make timer working
Usually you have to call it in application idle loop
 */
  void process();
protected:
	Uint32 last_ticks;
	int period;	
public: // Public attributes
  /** Shows if timer is running
 */
  int running;
};

#endif

Generated by: vg on localhost.localdomain on Fri Jan 17 13:05:24 2003, using kdoc 2.0a53.