From b845376e270c060730d4f8b9b0946a63908871da Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 9 Dec 2024 11:22:35 +0100 Subject: feature_config --- src/doc/feature/config.dox | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/doc/feature/config.dox (limited to 'src/doc/feature/config.dox') diff --git a/src/doc/feature/config.dox b/src/doc/feature/config.dox new file mode 100644 index 0000000..85d6803 --- /dev/null +++ b/src/doc/feature/config.dox @@ -0,0 +1,61 @@ +// vim:ft=doxygen +namespace crepe { +/** + +\defgroup feature_config Engine configuration +\ingroup feature +\brief Configure default values and global options + +Default values and options that apply to the engine globally are read from a +singleton struct named Config. + +\see Config + +\par Example + +Configuration options may be set individually or by assigning a [designated +initializer list][desginit]. All of Config's members have default values and can +safely be omitted from initializer lists. + +[desginit]: https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated_initializers + +```cpp +#include + +int main() { + auto & config = crepe::Config::get_instance(); + + // Designated initializer list + config = { + // specify options here + }; + + // Reset default options + config = {}; + + // Set specific option + config.log.color = false; +} +``` + +\par Options + +\noop Display config properties in monospace font +\htmlonly + +\endhtmlonly + +|Option|Description| +|-|-| +|\ref Config::asset::root_pattern ".asset.root_pattern"|\copybrief Config::asset::root_pattern| +|\ref Config::log::color ".log.color"|\copybrief Config::log::color| +|\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| + +*/ +} -- cgit v1.2.3 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 --- Doxyfile | 2 ++ 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 +++--- src/doc/index.dox | 9 ++++++++- src/doc/layout.xml | 4 ++-- 7 files changed, 32 insertions(+), 22 deletions(-) (limited to 'src/doc/feature/config.dox') diff --git a/Doxyfile b/Doxyfile index 07c86d1..78f486b 100644 --- a/Doxyfile +++ b/Doxyfile @@ -20,6 +20,8 @@ TAB_SIZE = 2 HTML_INDEX_NUM_ENTRIES = 999 HTML_EXTRA_STYLESHEET = src/doc/style.css SHOW_HEADERFILE = NO +DISABLE_INDEX = NO +GENERATE_TREEVIEW = NO REPEAT_BRIEF = NO 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); } } }; diff --git a/src/doc/index.dox b/src/doc/index.dox index 7796f34..342db98 100644 --- a/src/doc/index.dox +++ b/src/doc/index.dox @@ -5,7 +5,14 @@ Welcome to the documentation for the crêpe game engine. -\see feature +\see \ref install "Engine installation instructions" +\see \ref feature "Example code and usage instructions" +\see [API documentation](annotated.html) + +\noop No bold links in "See also" section +\htmlonly + +\endhtmlonly */ diff --git a/src/doc/layout.xml b/src/doc/layout.xml index 6038249..c98c790 100644 --- a/src/doc/layout.xml +++ b/src/doc/layout.xml @@ -4,7 +4,7 @@ - + @@ -22,7 +22,7 @@ - + -- cgit v1.2.3