Golias Engine
A C++ 20 'game engine' built with SDL3 with wide platform support.
engine.h
Go to the documentation of this file.
1 #pragma once
3 #include "core/system/timer.h"
6 #include "core/api/engine_api.h"
7 
17 class Engine {
18 public:
19  bool initialize(int window_w, int window_h, const char* title = "Golias Engine - Window", Uint32 window_flags = SDL_WINDOW_RESIZABLE);
20 
21  void run();
22 
23  Timer& get_timer();
24 
25  Renderer* get_renderer() const;
26 
27  SDL_Window* get_window() const;
28 
30 
31  flecs::world& get_world();
32 
33  bool is_running = false;
34 
35  SDL_Event event;
36 
37  ~Engine();
38 
39 
40 private:
41  EngineConfig _config = {};
42  Timer _timer = {};
43  flecs::world _world;
44  SDL_Window* _window = nullptr;
45  Renderer* _renderer = nullptr;
46 
47 
48 };
49 
58 void engine_core_loop();
59 
60 void engine_draw_loop();
61 
73 void engine_setup_systems(flecs::world& world);
74 
75 extern std::unique_ptr<Engine> GEngine;
Definition: engine.h:17
void run()
Definition: engine.cpp:364
SDL_Window * get_window() const
Definition: engine.cpp:217
Renderer * get_renderer() const
Definition: engine.cpp:213
EngineConfig & get_config()
Definition: engine.cpp:204
bool initialize(int window_w, int window_h, const char *title="Golias Engine - Window", Uint32 window_flags=SDL_WINDOW_RESIZABLE)
Definition: engine.cpp:46
flecs::world & get_world()
Definition: engine.cpp:221
~Engine()
Definition: engine.cpp:377
Timer & get_timer()
Definition: engine.cpp:208
bool is_running
Definition: engine.h:33
SDL_Event event
Definition: engine.h:35
Definition: renderer.h:33
Definition: timer.h:14
void engine_draw_loop()
Definition: engine.cpp:226
std::unique_ptr< Engine > GEngine
Definition: engine.cpp:3
void engine_core_loop()
Core engine loop function.
Definition: engine.cpp:276
void engine_setup_systems(flecs::world &world)
Sets up the core systems in the provided Flecs world.
Engine configuration loaded from project.xml.
Definition: project_config.h:181
Timer class definition.