forked from yinhui1129754/CppFishingCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathticker.cpp
More file actions
48 lines (44 loc) · 900 Bytes
/
Copy pathticker.cpp
File metadata and controls
48 lines (44 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "../stdafx.h"
#include "ticker.h"
ticker::ticker()
{
}
void ticker::start() {
this->started = true;
};
void ticker::stop() {
this->started = false;
};
void ticker::setTimmer(float time) {
this->timmer = time;
};
void ticker::addFun(void(*fs)(DemoApp ** app, ticker *tk)) {
this->tickerArr.push_back(fs);
}
void ticker::setId(string str) {
this->id = str;
};
void ticker::render(DemoApp ** app) {
if (this->started != true) {
return;
}
this->newTimmer += (*app)->msTime;
this->msTime = this->newTimmer;
this->fpsTimmer += (*app)->msTime;
if (this->newTimmer >= this->timmer) {
this->fpsInt++;
this->newTimmer = 0;
unsigned int len = this->tickerArr.size();
for (unsigned int i = 0;i < len;i++) {
this->tickerArr[i](app,this);
}
}
if (this->fpsTimmer >= 1000) {
this->fps = this->fpsInt;
this->fpsInt = 0;
this->fpsTimmer = 0;
}
}
ticker::~ticker()
{
}