Removed unneeded Timer class.

This commit is contained in:
Felix Ableitner 2013-03-29 18:35:32 +01:00
parent 6e631e78d5
commit 995895872e
2 changed files with 0 additions and 82 deletions

View file

@ -1,48 +0,0 @@
/*
* Timer.cpp
*
* Created on: 19.10.2012
* Author: Felix
*/
#include "Timer.h"
#include <assert.h>
/**
* Initializes time limit to zero.
*/
Timer::Timer() {
}
/**
* Initializes time limit to parameter value.
*/
Timer::Timer(sf::Time timeLimit) :
mLimit(timeLimit) {
}
/**
* Returns true if the time set in setLimit() has passed since calling start().
*/
bool
Timer::isExpired() const {
return mClock.getElapsedTime() >= mLimit;
}
/**
* Starts the timer.
*/
void
Timer::start() {
mClock.restart();
}
/**
* Sets the time limit to run to.
*/
void
Timer::setLimit(sf::Time timeLimit) {
assert(timeLimit > sf::Time::Zero);
mLimit = timeLimit;
}

View file

@ -1,34 +0,0 @@
/*
* Timer.h
*
* Created on: 19.10.2012
* Author: Felix
*/
#ifndef DG_TIMER_H_
#define DG_TIMER_H_
#include <SFML/System.hpp>
/**
* A small timer utility that allows testing whether a certain amount of time is over.
*
* Replacement for thor::Timer as it causes crashes.
*/
class Timer {
// Public functions.
public:
Timer();
Timer(sf::Time timeLimit);
void start();
void setLimit(sf::Time timeLimit);
bool isExpired() const;
// Private variables.
private:
sf::Clock mClock;
sf::Time mLimit;
};
#endif /* DG_TIMER_H_ */