You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
783 B
C++
54 lines
783 B
C++
5 years ago
|
/*
|
||
|
Singleton test
|
||
|
|
||
|
project: RYZOM / TEST
|
||
|
|
||
|
*/
|
||
|
|
||
|
#include "nel/misc/types_nl.h"
|
||
|
#include "nel/misc/common.h"
|
||
|
#include "nel/misc/debug.h"
|
||
|
#include "game_share/singleton_registry.h"
|
||
|
|
||
|
class CSingletonTest: public IServiceSingleton
|
||
|
{
|
||
|
public:
|
||
|
void init()
|
||
|
{
|
||
|
nlinfo("CSingletonTest::init()");
|
||
|
serviceCounter=0;
|
||
|
tickCounter=0;
|
||
|
}
|
||
|
|
||
|
void serviceUpdate()
|
||
|
{
|
||
|
++serviceCounter;
|
||
|
if (serviceCounter>=50)
|
||
|
{
|
||
|
nlinfo("CSingletonTest::serviceUpdate() @50");
|
||
|
serviceCounter=0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void tickUpdate()
|
||
|
{
|
||
|
++tickCounter;
|
||
|
if (tickCounter>=25)
|
||
|
{
|
||
|
nlinfo("CSingletonTest::tickUpdate() @25");
|
||
|
tickCounter=0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void release()
|
||
|
{
|
||
|
nlinfo("CSingletonTest::release()");
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
uint32 tickCounter;
|
||
|
uint32 serviceCounter;
|
||
|
};
|
||
|
|
||
|
static CSingletonTest SingletonTest;
|