From f06be6004ec8b47e3b4b1ba4fda068b365923683 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 11 Jan 2025 22:01:53 +0100 Subject: update doxygen documentation w/ updated API --- src/doc/feature/config.dox | 4 ++-- src/doc/feature/scene.dox | 15 ++++++--------- src/doc/feature/script.dox | 14 +++++++++----- src/doc/feature/script_ecs.dox | 6 +++--- 4 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/doc/feature') diff --git a/src/doc/feature/config.dox b/src/doc/feature/config.dox index 85d6803..ae3a054 100644 --- a/src/doc/feature/config.dox +++ b/src/doc/feature/config.dox @@ -54,8 +54,8 @@ tr td:first-child { font-family: monospace; } |\ref Config::log::level ".log.level"|\copybrief Config::log::level| |\ref Config::physics::gravity ".physics.gravity"|\copybrief Config::physics::gravity| |\ref Config::savemgr::location ".savemgr.location"|\copybrief Config::savemgr::location| -|\ref Config::window::size ".window.size"|\copybrief Config::window::size| -|\ref Config::window::title ".window.title"|\copybrief Config::window::title| +|\ref Config::window_settings::default_size ".window_settings.default_size"|\copybrief Config::window_settings::default_size| +|\ref Config::window_settings::window_title ".window_settings.window_title"|\copybrief Config::window_settings::window_title| */ } diff --git a/src/doc/feature/scene.dox b/src/doc/feature/scene.dox index 4124e37..b680eec 100644 --- a/src/doc/feature/scene.dox +++ b/src/doc/feature/scene.dox @@ -40,31 +40,28 @@ added to the loop/scene manger via loop_mgr::add_scene<>(). The templated argument should define the concrete scene to be added. ```cpp -#include -#include +#include #include -#include using namespace crepe; class MyScene : public Scene { public: void load_scene() { - ComponentManager & mgr = this->component_manager; - GameObject object1 = mgr.new_object("object1", "tag_my_scene", vec2{0, 0}, 0, 1); - GameObject object2 = mgr.new_object("object2", "tag_my_scene", vec2{1, 0}, 0, 1); + GameObject object1 = new_object("object1", "tag_my_scene", vec2{0, 0}, 0, 1); + GameObject object2 = new_object("object2", "tag_my_scene", vec2{1, 0}, 0, 1); } string get_name() const { return "my_scene"; } }; int main() { - LoopManager loop_mgr; + Engine foo; // Add the scenes to the loop manager - loop_mgr.add_scene(); + foo.add_scene(); - loop_mgr.start(); + return foo.main(); } ``` diff --git a/src/doc/feature/script.dox b/src/doc/feature/script.dox index e3b5508..162b0f5 100644 --- a/src/doc/feature/script.dox +++ b/src/doc/feature/script.dox @@ -21,10 +21,10 @@ BehaviorScript \ref Component "component". \"\ref feature_gameobject\" first. First, define a class (anywhere) that inherits from Script. The Script class -acts as an interface, and has two functions (\ref Script::init "\c init()" and -\ref Script::update "\c update()"), which *may* be implemented (they are empty -by default). From now on, this derivative class will be referred to as a -*concrete script*. +acts as an interface, and has three functions (\ref Script::init "\c init()", +\ref Script::fixed_update "\c fixed_update()" and \ref Script::frame_update +"\c frame_update()"), which *may* be implemented (they are empty by default). +From now on, this derivative class will be referred to as a *concrete script*. ```cpp #include @@ -34,9 +34,13 @@ class MyScript : public crepe::Script { void init() { // called once } - void update() { + + void fixed_update(crepe::duration_t delta_time) { // called on fixed update } + void frame_update(crepe::duration_t delta_time) { + // called for every rendered frame + } }; ``` diff --git a/src/doc/feature/script_ecs.dox b/src/doc/feature/script_ecs.dox index bbe1abc..8bd3376 100644 --- a/src/doc/feature/script_ecs.dox +++ b/src/doc/feature/script_ecs.dox @@ -40,14 +40,14 @@ using namespace crepe; class MyScript : public Script { void show_self() { Metadata & own_metadata = get_component(); - Log::logf("My name is {}", own_metadata.name); + logf("My name is {}", own_metadata.name); } void list_enemies() { RefVector enemies = get_components_by_tag("enemy"); - Log::logf("There are {} enemies:", enemies.size()); + logf("There are {} enemies:", enemies.size()); for (const Metadata & enemy : enemies) { - Log::logf("- {}", enemy.name); + logf("- {}", enemy.name); } } }; -- cgit v1.2.3