第12期 SDL2系列教程:对SDL.Timer类进行封装
发布时间
阅读量:
阅读量
为方便使用SDL的定时器,实现了类封装:
代码如下
time.h:
#pragma once
#include
class timer {
timer(Uint64 s, Uint64 p, bool perf);
~timer();
Uint64 start;
Uint64 pause;
Uint64 lag;
bool isPerfCounter;
friend class Time;
};
class Time
{
public:
Time();
~Time();
bool init();
bool kill();
boolean AddTimer(const string& tID, bool is Paused = false);
boolean AddPerformanceCounter(const string& tID, bool is Paused = false);
bool remove(const std::string& tID);
bool addCallback(32位无符号整数指针(*callback)(32位无符号整数,空指针), 32位无符号整数 delay, 空指针 param
全部评论 (0)
还没有任何评论哟~
