Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
engine.hpp
Go to the documentation of this file.
1#pragma once
2#include "../core/definitions.hpp"
3#include "../core/node/node.hpp"
5#include "services.hpp"
6
34class Engine
35{
36public:
37 Engine(std::string _appName = "Calamity App");
38 ~Engine();
39 const std::string appName;
40
41 int appendWindow(std::shared_ptr<Window> window);
42 void removeWindow(int id);
43 std::shared_ptr<Window> getWindow(int id);
44
45 void update();
46 void render(Graphics &graphics);
47 void initialize();
48 void exit();
49
50 float physicsTimestep = 1.0f / 60.0f;
51 float accumulator = 0.0f;
52 Uint64 now = SDL_GetPerformanceCounter();
53 Uint64 last = 0;
54
55 template <class Archive>
56 void serialize(Archive &ar)
57 {
58 ar(CEREAL_NVP(windows));
59 }
60
61private:
62 std::vector<std::shared_ptr<Window>> windows;
63};
Definition engine.hpp:35
float accumulator
Definition engine.hpp:51
int appendWindow(std::shared_ptr< Window > window)
Definition engine.cpp:129
const std::string appName
Definition engine.hpp:39
void initialize()
Definition engine.cpp:61
void removeWindow(int id)
Definition engine.cpp:136
float physicsTimestep
Definition engine.hpp:50
void render(Graphics &graphics)
Definition engine.cpp:118
~Engine()
Definition engine.cpp:56
Uint64 last
Definition engine.hpp:53
std::shared_ptr< Window > getWindow(int id)
Definition engine.cpp:140
void serialize(Archive &ar)
Definition engine.hpp:56
void update()
Definition engine.cpp:70
Uint64 now
Definition engine.hpp:52
void exit()
Definition engine.cpp:102
Definition graphics.hpp:26