Engine
SafiEngine::Engine is the core runtime class. It creates a window, initializes OpenGL 3.3 Core Profile, and runs the ECS-driven game loop.
Header: Core/include/Core/Engine.h
Constructor
Creates a GLFW window with an OpenGL 3.3 Core Profile context and initializes all subsystems.
Subsystem Access
These methods are available in any behavior via the engine parameter:
Camera
Returns the entity with a Camera component where isMain == true. Returns an invalid entity if no main camera exists.
Clears isMain on all Camera components, then sets isMain = true on the given entity. Use this to switch between cameras at runtime.
Timing
Returns the time elapsed since the last frame in seconds. Also available as the dt parameter in OnUpdate.
Play Mode
Controls and queries play mode state. When playing, physics, behaviors, and animations are active. When stopped, only editor systems run.
View / Projection
Get or set the current view and projection matrices. During play mode, these are set automatically by the CameraSystem from the main camera entity. During edit mode, they are set by the editor camera.
Window
Run (Standalone)
Starts the standalone game loop (used when running without the editor). Sets play mode to true and runs until the window is closed.