forked from KevinHall2/CustomPhysics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorld.h
More file actions
59 lines (43 loc) · 1.07 KB
/
Copy pathWorld.h
File metadata and controls
59 lines (43 loc) · 1.07 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
#pragma once
#include <memory>
#include <vector>
#include "PhysObject.h"
class World
{
private:
std::vector<PhysObject> PhysObjects;
protected:
//Represents elapsed time since last fixed tick
float AccumulatedFixedTime;
public:
//Represents time between fixed ticks
float TargetFixedStep;
World();
//For initialization
void Init();
//For update logic
void Tick();
//For physics update logic
void TickFixed();
//For drawing
void Draw();
//For cleanup and termination
void Exit();
//Determines whether or not the world needs to shut down
//Returns True if shutdown needed, otherwise false
bool ShouldClose() const;
//Determines whether the world needs to perform a fixed tick
//Returns True if needs TickFixed(), otherwise false
bool ShouldTickFixed() const;
protected:
//Runs at the end of Init()
virtual void OnInit();;
//Runs at the end of Tick()
virtual void OnTick();;
//Runs at the end of TickFixed()
virtual void OnTickFixed() {};
//Runs at the end of Draw()
virtual void OnDraw() {};
//Runs at the start of Exit()
virtual void OnExit() {};
};