Meteor2D  dev internal
Meteor is a lightweight 2D game engine.
Loading...
Searching...
No Matches
time.h
1#pragma once
2#include <entities/entity.h>
3#include <SDL.h>
4
5namespace meteor {
9 class MTime : public MEntity {
10 public:
14 static void updateTime();
15
19 static double getDeltaTime() { return deltaTime; }
20
24 static int getFrameTime() {
25 return SDL_GetTicks() - currFrameTime;
26 }
27
31 static float getTimeScale() { return timeScale; }
32
37 static void setTimeScale(float val) { timeScale = val; }
38
39 private:
40 static uint64_t timeNow;
41 static uint64_t timeLast;
42 static double deltaTime;
43 static float timeScale;
44 static uint64_t currFrameTime;
45 };
46
47}
An Entity is the base class for all data and behaviour oriented objects in meteor....
Definition entity.h:9
This class handles time function.
Definition time.h:9
static void setTimeScale(float val)
set time scale.
Definition time.h:37
static int getFrameTime()
Definition time.h:24
static double getDeltaTime()
returns the time between last and last-to-last frame.
Definition time.h:19
static void updateTime()
updates internal timer
static float getTimeScale()
Definition time.h:31