Main engine class.
More...
#include <Engine.hpp>
|
| | Engine () |
| | Initialize a new engine.
|
| | ~Engine () |
| void | start_window (const char *win_name, unsigned short width, unsigned short height) |
| | Create the display, initialise the renderer (and the editor overlay when built with ImGui) and start the engine subsystems.
|
| void | stop_window () |
| | Destroy the display and release the renderer.
|
| void | set_window_title (const char *title) |
| | Change the window title.
|
| void | set_window_size (unsigned short width, unsigned short height) |
| | Resize the window.
|
| void | loop () |
| | Starts main loop.
|
| void | force_render () |
| | Force the engine to render as soon as possible.
|
| void | force_logic () |
| | Force the engine to tick as soon as possible.
|
| void | close () |
| | Stops the main loop and close the window.
|
| bool | is_simulating () const |
| | Whether scene logic (component updates) is currently running. When false the engine still renders and processes input, but the active scene is not ticked — this is the editor "edit mode".
|
| void | set_simulating (bool value) |
| | Enable/disable scene logic ticking (editor Play/Pause).
|
| script::ScriptEngine * | scripts () const |
| | The Lua scripting VM (owns the engine-API bindings).
|
| void | run_script_repl (const std::string &code) |
| | Run a line of Lua against the shared state (editor REPL). Thin forwarder so callers don't need the sol2 headers.
|
| void | on_update_tick () |
| | Tick the active scene's logic (one fixed update step).
|
| void | on_render_tick () |
| | Render the active scene (one frame).
|
| void | init_shader_library () |
| | Register the built-in shader programs/materials. Requires a GL context, so it runs from start_window after the display is created.
|
| void | init_imgui () |
| | Create the ImGui context, load the UI + monospace fonts and apply the theme. No-op when built without ImGui.
|
| | ONLYIMGUI (editor::Editor editor=editor::Editor(this)) |
|
| static const std::string | version = "0.3" |
| | Engine version.
|
| static Engine * | engine = nullptr |
| | The active engine instance (set in the constructor).
|
| static Input | input = Input() |
| | Global keyboard/mouse input state.
|
◆ Engine()
| turbo::Engine::Engine |
( |
| ) |
|
Initialize a new engine.
- Note
- Only one instance should be used at a time
- Parameters
-
| win_name | Name of the window |
| width | width of the window |
| height | height of the window |
◆ ~Engine()
| turbo::Engine::~Engine |
( |
| ) |
|
◆ close()
| void turbo::Engine::close |
( |
| ) |
|
Stops the main loop and close the window.
◆ force_logic()
| void turbo::Engine::force_logic |
( |
| ) |
|
Force the engine to tick as soon as possible.
◆ force_render()
| void turbo::Engine::force_render |
( |
| ) |
|
Force the engine to render as soon as possible.
◆ init_imgui()
| void turbo::Engine::init_imgui |
( |
| ) |
|
Create the ImGui context, load the UI + monospace fonts and apply the theme. No-op when built without ImGui.
◆ init_shader_library()
| void turbo::Engine::init_shader_library |
( |
| ) |
|
Register the built-in shader programs/materials. Requires a GL context, so it runs from start_window after the display is created.
◆ is_simulating()
| bool turbo::Engine::is_simulating |
( |
| ) |
const |
|
inline |
Whether scene logic (component updates) is currently running. When false the engine still renders and processes input, but the active scene is not ticked — this is the editor "edit mode".
◆ loop()
| void turbo::Engine::loop |
( |
| ) |
|
◆ on_render_tick()
| void turbo::Engine::on_render_tick |
( |
| ) |
|
Render the active scene (one frame).
◆ on_update_tick()
| void turbo::Engine::on_update_tick |
( |
| ) |
|
Tick the active scene's logic (one fixed update step).
◆ ONLYIMGUI()
| turbo::Engine::ONLYIMGUI |
( |
editor::Editor | editor = editor::Editor(this) | ) |
|
◆ run_script_repl()
| void turbo::Engine::run_script_repl |
( |
const std::string & | code | ) |
|
Run a line of Lua against the shared state (editor REPL). Thin forwarder so callers don't need the sol2 headers.
◆ scripts()
The Lua scripting VM (owns the engine-API bindings).
◆ set_simulating()
| void turbo::Engine::set_simulating |
( |
bool | value | ) |
|
|
inline |
Enable/disable scene logic ticking (editor Play/Pause).
◆ set_window_size()
| void turbo::Engine::set_window_size |
( |
unsigned short | width, |
|
|
unsigned short | height ) |
◆ set_window_title()
| void turbo::Engine::set_window_title |
( |
const char * | title | ) |
|
◆ start_window()
| void turbo::Engine::start_window |
( |
const char * | win_name, |
|
|
unsigned short | width, |
|
|
unsigned short | height ) |
Create the display, initialise the renderer (and the editor overlay when built with ImGui) and start the engine subsystems.
- Parameters
-
| win_name | window title |
| width | window width in pixels |
| height | window height in pixels |
◆ stop_window()
| void turbo::Engine::stop_window |
( |
| ) |
|
Destroy the display and release the renderer.
◆ engine
| Engine* turbo::Engine::engine = nullptr |
|
inlinestatic |
The active engine instance (set in the constructor).
◆ input
| Input turbo::Engine::input = Input() |
|
inlinestatic |
Global keyboard/mouse input state.
◆ logger
◆ render_tick
Fired on every rendered frame; subscribe to draw.
◆ scene_manager
Owns the registered scenes and the active scene.
◆ shaders
Engine-wide registry of shader programs and materials. Populated once the GL context exists (see start_window).
◆ update_tick
Fired on every logic tick; subscribe to run game logic.
◆ version
| const std::string turbo::Engine::version = "0.3" |
|
inlinestatic |
Engine version.
- Note
- This string is hard writter read only
The documentation for this class was generated from the following files: