This repository has been archived on 2019-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
dungeon-gunner/source/util/Singleton.h
Felix Ableitner 45f0b31d57 Initial commit after git corruption, old repo deleted.
Working:
Rendering
Resources
Physics
Player movement with mouse
Shooting with mouse
Tiles
2012-09-10 17:26:37 +02:00

31 lines
557 B
C++

/*
* Singleton.h
*
* Created on: 04.07.2012
* Author: Felix
*/
#ifndef DG_SINGLETON_H_
#define DG_SINGLETON_H_
#include <SFML/System.hpp>
/**
* Template class for inheriting singleton behaviour.
*
* To use, just make a subclass with only a private default constructor and Singleton<T>
* as friend class.
*/
template <class T>
class Singleton : public sf::NonCopyable {
public:
/**
* Get the instance of this class.
*/
static T& i() {
static T s;
return s;
};
};
#endif /* DG_SINGLETON_H_ */