-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (44 loc) · 1.8 KB
/
Copy pathmain.cpp
File metadata and controls
64 lines (44 loc) · 1.8 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <iomanip>
using namespace std;
#include "Tweener.h"
using namespace core;
auto globalTime = 0.0f;
class QuickTest {
public:
bool isComplete;
QuickTest() {
isComplete = false;
value = 200.0f;
cout << "At time: " << globalTime << ", tween was created: " << value << endl;
Tweener.addTween("TestTween")
.delay(0.5) // wait 0.5 seconds before starting the tween
.time(1) // take 1 second to complete the tween
.type(EaseOutExpo) // quick at first, slow towards end
.param(&value, 25) // tween the float stored by value to 25 over the course of the tween
.onStart(this, &QuickTest::onStart) // when the tween starts(after the delay timer), call onStart
.onUpdate(this, &QuickTest::onUpdate) // when ever the tween changes the value, call onUpdate
.onComplete(this, &QuickTest::onComplete); // when the tween reaches the target value of 25, call onComplete
}
void onStart() {
cout << "At time: " << globalTime << ", Tween has started: " << value << endl;
}
void onUpdate() {
cout << "At time: " << globalTime << ", Tween has updated: " << value << endl;
}
void onComplete() {
cout << "At time: " << globalTime << ", Tween has completed: " << value << endl;
isComplete = true;
}
float value;
};
int main() {
QuickTest test;
auto deltaSeconds = 1.0f/60.0f;
cout << std::fixed << std::setw( 3 ) << std::setprecision( 3 );
while(!test.isComplete) {
globalTime += deltaSeconds;
Tweener.update(deltaSeconds);
}
return 0;
}