aboutsummaryrefslogtreecommitdiff
path: root/src/doc
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-24 22:12:31 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-24 22:12:31 +0100
commit24e3f0ea7c5ce90af1276dca49644b5e1ac799f6 (patch)
tree465dd020c1700511a1697267268b3d975caefd48 /src/doc
parent6287d4e9068d8bd27a9e62643f54adb69e84befd (diff)
parentbe5ccbe24086d5d4fb407f268c649dcbc36eda6b (diff)
merge
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/feature/gameobject.dox18
-rw-r--r--src/doc/feature/scene.dox65
-rw-r--r--src/doc/feature/script.dox62
-rw-r--r--src/doc/features.dox10
-rw-r--r--src/doc/index.dox10
-rw-r--r--src/doc/installing.dox9
-rw-r--r--src/doc/internal/component.dox41
-rw-r--r--src/doc/internal/resource.dox12
-rw-r--r--src/doc/internal/style.dox9
-rw-r--r--src/doc/internal/system.dox26
-rw-r--r--src/doc/internals.dox10
-rw-r--r--src/doc/layout.xml255
-rw-r--r--src/doc/style.css6
13 files changed, 533 insertions, 0 deletions
diff --git a/src/doc/feature/gameobject.dox b/src/doc/feature/gameobject.dox
new file mode 100644
index 0000000..c561874
--- /dev/null
+++ b/src/doc/feature/gameobject.dox
@@ -0,0 +1,18 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup feature_gameobject GameObjects
+\ingroup feature
+\brief GameObject to create a Scene
+
+GameObjects are the fundamental building blocks of a Scene. They represent entities
+in the game world and can have various components attached to them to define their
+behavior and properties. GameObjects can be created and modified within the
+Scene, allowing for a flexible and dynamic game environment.
+
+\see Component
+\see Scene
+
+*/
+}
diff --git a/src/doc/feature/scene.dox b/src/doc/feature/scene.dox
new file mode 100644
index 0000000..d81df4c
--- /dev/null
+++ b/src/doc/feature/scene.dox
@@ -0,0 +1,65 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup feature_scene Scenes
+\ingroup feature
+\brief User-defined scenes
+
+Scenes can be used to implement game environments, and allow arbitrary game objects to be organized
+as part of the game structure. Scenes are implemented as derivative classes of Scene, which are
+added to the game using the SceneManager. Scenes describe the start of a Scene and cannot modify
+GameObjects during runtime of a Scene (use \ref feature_script "Scripting" for this purpose).
+
+\see SceneManager
+\see GameObject
+\see Script
+\see Scene
+
+\par Example
+
+This example demonstrates how to define and add scenes to the loop/scene manager in the `crepe` framework.
+Each concrete scene should be derived from Scene. In the example below, the concrete scene is named MyScene.
+A concrete scene should, at least, implement (override) two methods, namely load_scene() and get_name(). The
+scene is build (using GameObjects) in the load_scene() method. GameObjects should be made using the
+component_manager::new_object(). In the example below, two GameObjects (named object1 and object2) are added
+to MyScene. object1 and object2 do not have any non-default Components attached to them, however, if needed,
+this should also be done in load_scene(). Each concrete scene must have a unique name. This unique name is
+used to load a new concrete scene (via a Script). The unique name is set using the get_name() method. In the
+example below, MyScene's unique name is my_scene.
+After setting up one or more concrete scene(s), the concrete scene(s) should be added to the loop/scene manager.
+This is done in your main(). Firstly, the LoopManager should be instantiated. Than, all the concrete scene(s)
+should be added to the loop/scene manger via loop_mgr::add_scene<>(). The templated argument should define the
+concrete scene to be added.
+
+```cpp
+#include <crepe/api/LoopManager.h>
+#include <crepe/api/GameObject.h>
+#include <crepe/api/Scene.h>
+#include <crepe/types.h>
+
+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);
+ }
+
+ string get_name() const { return "my_scene"; }
+};
+
+int main() {
+ LoopManager loop_mgr;
+
+ // Add the scenes to the loop manager
+ loop_mgr.add_scene<MyScene>();
+
+ loop_mgr.start();
+}
+```
+
+*/
+}
diff --git a/src/doc/feature/script.dox b/src/doc/feature/script.dox
new file mode 100644
index 0000000..d25a63b
--- /dev/null
+++ b/src/doc/feature/script.dox
@@ -0,0 +1,62 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup feature_script Scripting
+\ingroup feature
+\brief User-defined scripts for game objects
+
+Scripts can be used to implement game behavior, and allow arbitrary code to run
+as part of the game loop. Scripts are implemented as derivative classes of
+Script, which are added to game objects using the BehaviorScript \ref Component
+"component".
+
+\todo This section is incomplete:
+- Utility functions to get components/events/etc inside script
+- How to listen for events
+- Extensions of script (keylistener)
+
+\see Script
+\see BehaviorScript
+\see GameObject
+
+\par Example
+
+First, define a class that inherits from Script. This 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*.
+
+```cpp
+#include <crepe/api/Script.h>
+#include <crepe/api/BehaviorScript.h>
+
+class MyScript : public crepe::Script {
+ void init() {
+ // called once
+ }
+ void update() {
+ // called on fixed update
+ }
+};
+```
+
+Concrete scripts can be instantiated and attached to \ref GameObject
+"game objects" using the BehaviorScript \ref Component "component".
+
+```cpp
+using namespace crepe;
+GameObject obj = component_manager.new_object("name");
+
+// create BehaviorScript instance
+BehaviorScript & behavior_script = obj.add_component<BehaviorScript>();
+// attach (and instantiate) MyScript to behavior_script
+behavior_script.set_script<MyScript>();
+
+// the above can also be done in a single call for convenience:
+obj.add_component<BehaviorScript>().set_script<MyScript>();
+```
+
+*/
+}
diff --git a/src/doc/features.dox b/src/doc/features.dox
new file mode 100644
index 0000000..4786bed
--- /dev/null
+++ b/src/doc/features.dox
@@ -0,0 +1,10 @@
+// vim:ft=doxygen
+/**
+
+\defgroup feature Features
+\brief Engine components
+
+This page lists engine features and contains usage instructions for each
+feature.
+
+*/
diff --git a/src/doc/index.dox b/src/doc/index.dox
new file mode 100644
index 0000000..5ec7889
--- /dev/null
+++ b/src/doc/index.dox
@@ -0,0 +1,10 @@
+// vim:ft=doxygen
+/**
+
+\mainpage crêpe game engine
+
+Welcome to the documentation for the crêpe game engine.
+
+\see feature
+
+*/
diff --git a/src/doc/installing.dox b/src/doc/installing.dox
new file mode 100644
index 0000000..48b27d7
--- /dev/null
+++ b/src/doc/installing.dox
@@ -0,0 +1,9 @@
+// vim:ft=doxygen
+/**
+
+\defgroup install Installation
+\brief Engine installation instructions
+
+\todo This entire page
+
+*/
diff --git a/src/doc/internal/component.dox b/src/doc/internal/component.dox
new file mode 100644
index 0000000..0dd4cb5
--- /dev/null
+++ b/src/doc/internal/component.dox
@@ -0,0 +1,41 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup internal_component Components
+\ingroup internal
+\brief ECS Components
+
+Components are attached to GameObject instances and are composed by the game
+programmer to create specific entities in the game world. While they are
+implemented as C++ classes, components should be treated as C-style structs,
+meaning all members are public and they do not contain functions.
+
+A basic component has the following structure:
+```cpp
+#include <crepe/Component.h>
+
+class MyComponent : public crepe::Component {
+public:
+ // Add your custom component's ininitializer properties after the `id`
+ // parameter. The first parameter is controlled by GameObject::add_component,
+ // while all other parameters are forwarded using std::forward.
+ MyComponent(game_object_id_t id, ...);
+
+ // Optionally define the `get_instances_max` method to limit the amount of
+ // instances of this component per GameObject. The default implementation for
+ // this function returns -1, which means the instance count does not have an
+ // upper limit:
+ virtual int get_instances_max() const { return -1; }
+
+ // Properties
+ // ...
+};
+```
+
+Generally, components are "handled" by \ref internal_system "systems", which may
+optionally change the components' state. Components' state may also be
+controlled by the game programmer through \ref feature_script "scripts".
+
+*/
+}
diff --git a/src/doc/internal/resource.dox b/src/doc/internal/resource.dox
new file mode 100644
index 0000000..56f1de0
--- /dev/null
+++ b/src/doc/internal/resource.dox
@@ -0,0 +1,12 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup internal_resource Resources
+\ingroup internal
+\brief Concrete resources
+
+\todo This section is incomplete
+
+*/
+}
diff --git a/src/doc/internal/style.dox b/src/doc/internal/style.dox
new file mode 100644
index 0000000..dad2df0
--- /dev/null
+++ b/src/doc/internal/style.dox
@@ -0,0 +1,9 @@
+// vim:ft=doxygen
+/**
+
+\defgroup internal_style Code style
+\ingroup internal
+\brief Coding conventions
+\include{doc} contributing.md
+
+*/
diff --git a/src/doc/internal/system.dox b/src/doc/internal/system.dox
new file mode 100644
index 0000000..17a101e
--- /dev/null
+++ b/src/doc/internal/system.dox
@@ -0,0 +1,26 @@
+// vim:ft=doxygen
+namespace crepe {
+/**
+
+\defgroup internal_system Systems
+\ingroup internal
+\brief ECS Systems
+
+\todo This section is incomplete
+
+A system is responsible for processing the data stored in \ref
+internal_component "components".
+
+A basic system has the following structure:
+```cpp
+#include <crepe/system/System.h>
+
+class MySystem : public System {
+public:
+ using System::System;
+ void update() override;
+};
+```
+
+*/
+}
diff --git a/src/doc/internals.dox b/src/doc/internals.dox
new file mode 100644
index 0000000..2d2ca56
--- /dev/null
+++ b/src/doc/internals.dox
@@ -0,0 +1,10 @@
+// vim:ft=doxygen
+/**
+
+\defgroup internal Internals
+\brief Internal engine structure and other conventions
+
+\todo This page is incomplete
+\todo Anything about Contexts?
+
+*/
diff --git a/src/doc/layout.xml b/src/doc/layout.xml
new file mode 100644
index 0000000..fb4cc0c
--- /dev/null
+++ b/src/doc/layout.xml
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<doxygenlayout version="1.0">
+ <navindex>
+ <tab type="mainpage" visible="yes" title="Intro"/>
+ <tab type="user" url="@ref install" title="Installation"/>
+ <tab type="user" url="@ref feature" title="Features"/>
+ <tab type="user" url="@ref internal" title="Internals"/>
+ <tab type="pages" visible="no" title="" intro=""/>
+ <tab type="topics" visible="no" title="" intro=""/>
+ <tab type="modules" visible="no" title="" intro="">
+ <tab type="modulelist" visible="yes" title="" intro=""/>
+ <tab type="modulemembers" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="namespaces" visible="no" title="">
+ <tab type="namespacelist" visible="yes" title="" intro=""/>
+ <tab type="namespacemembers" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="concepts" visible="no" title="">
+ </tab>
+ <tab type="interfaces" visible="no" title="">
+ <tab type="interfacelist" visible="yes" title="" intro=""/>
+ <tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
+ <tab type="interfacehierarchy" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="classes" visible="yes" title="">
+ <tab type="classlist" visible="yes" title="" intro=""/>
+ <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
+ <tab type="hierarchy" visible="yes" title="" intro=""/>
+ <tab type="classmembers" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="structs" visible="no" title="">
+ <tab type="structlist" visible="yes" title="" intro=""/>
+ <tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
+ </tab>
+ <tab type="exceptions" visible="no" title="">
+ <tab type="exceptionlist" visible="yes" title="" intro=""/>
+ <tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
+ <tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="files" visible="no" title="">
+ <tab type="filelist" visible="yes" title="" intro=""/>
+ <tab type="globals" visible="yes" title="" intro=""/>
+ </tab>
+ <tab type="examples" visible="no" title="" intro=""/>
+ </navindex>
+ <class>
+ <briefdescription visible="yes"/>
+ <detaileddescription title=""/>
+ <includes visible="$SHOW_HEADERFILE"/>
+ <inheritancegraph visible="yes"/>
+ <collaborationgraph visible="yes"/>
+ <memberdecl>
+ <nestedclasses visible="yes" title=""/>
+ <publictypes title=""/>
+ <services title=""/>
+ <interfaces title=""/>
+ <publicslots title=""/>
+ <signals title=""/>
+ <publicmethods title=""/>
+ <publicstaticmethods title=""/>
+ <publicattributes title=""/>
+ <publicstaticattributes title=""/>
+ <protectedtypes title=""/>
+ <protectedslots title=""/>
+ <protectedmethods title=""/>
+ <protectedstaticmethods title=""/>
+ <protectedattributes title=""/>
+ <protectedstaticattributes title=""/>
+ <packagetypes title=""/>
+ <packagemethods title=""/>
+ <packagestaticmethods title=""/>
+ <packageattributes title=""/>
+ <packagestaticattributes title=""/>
+ <properties title=""/>
+ <events title=""/>
+ <privatetypes title=""/>
+ <privateslots title=""/>
+ <privatemethods title=""/>
+ <privatestaticmethods title=""/>
+ <privateattributes title=""/>
+ <privatestaticattributes title=""/>
+ <friends title=""/>
+ <related title="" subtitle=""/>
+ <membergroups visible="yes"/>
+ </memberdecl>
+ <memberdef>
+ <inlineclasses title=""/>
+ <typedefs title=""/>
+ <enums title=""/>
+ <services title=""/>
+ <interfaces title=""/>
+ <constructors title=""/>
+ <functions title=""/>
+ <related title=""/>
+ <variables title=""/>
+ <properties title=""/>
+ <events title=""/>
+ </memberdef>
+ <allmemberslink visible="yes"/>
+ <usedfiles visible="$SHOW_USED_FILES"/>
+ <authorsection visible="yes"/>
+ </class>
+ <namespace>
+ <briefdescription visible="yes"/>
+ <memberdecl>
+ <nestednamespaces visible="yes" title=""/>
+ <constantgroups visible="yes" title=""/>
+ <interfaces visible="yes" title=""/>
+ <classes visible="yes" title=""/>
+ <concepts visible="yes" title=""/>
+ <structs visible="yes" title=""/>
+ <exceptions visible="yes" title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <properties title=""/>
+ <membergroups visible="yes"/>
+ </memberdecl>
+ <detaileddescription title=""/>
+ <memberdef>
+ <inlineclasses title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <properties title=""/>
+ </memberdef>
+ <authorsection visible="yes"/>
+ </namespace>
+ <concept>
+ <briefdescription visible="yes"/>
+ <includes visible="$SHOW_HEADERFILE"/>
+ <definition visible="yes" title=""/>
+ <detaileddescription title=""/>
+ <authorsection visible="yes"/>
+ </concept>
+ <file>
+ <briefdescription visible="yes"/>
+ <includes visible="$SHOW_INCLUDE_FILES"/>
+ <includegraph visible="yes"/>
+ <includedbygraph visible="yes"/>
+ <sourcelink visible="yes"/>
+ <memberdecl>
+ <interfaces visible="yes" title=""/>
+ <classes visible="yes" title=""/>
+ <structs visible="yes" title=""/>
+ <exceptions visible="yes" title=""/>
+ <namespaces visible="yes" title=""/>
+ <concepts visible="yes" title=""/>
+ <constantgroups visible="yes" title=""/>
+ <defines title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <properties title=""/>
+ <membergroups visible="yes"/>
+ </memberdecl>
+ <detaileddescription title=""/>
+ <memberdef>
+ <inlineclasses title=""/>
+ <defines title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <properties title=""/>
+ </memberdef>
+ <authorsection/>
+ </file>
+ <group>
+ <detaileddescription title=""/>
+ <groupgraph visible="yes"/>
+ <memberdecl>
+ <nestedgroups visible="yes" title=""/>
+ <modules visible="yes" title=""/>
+ <dirs visible="yes" title=""/>
+ <files visible="yes" title=""/>
+ <namespaces visible="yes" title=""/>
+ <concepts visible="yes" title=""/>
+ <classes visible="yes" title=""/>
+ <defines title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <enumvalues title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <signals title=""/>
+ <publicslots title=""/>
+ <protectedslots title=""/>
+ <privateslots title=""/>
+ <events title=""/>
+ <properties title=""/>
+ <friends title=""/>
+ <membergroups visible="yes"/>
+ </memberdecl>
+ <memberdef>
+ <pagedocs/>
+ <inlineclasses title=""/>
+ <defines title=""/>
+ <typedefs title=""/>
+ <sequences title=""/>
+ <dictionaries title=""/>
+ <enums title=""/>
+ <enumvalues title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <signals title=""/>
+ <publicslots title=""/>
+ <protectedslots title=""/>
+ <privateslots title=""/>
+ <events title=""/>
+ <properties title=""/>
+ <friends title=""/>
+ </memberdef>
+ <authorsection visible="yes"/>
+ </group>
+ <module>
+ <briefdescription visible="yes"/>
+ <exportedmodules visible="yes"/>
+ <memberdecl>
+ <concepts visible="yes" title=""/>
+ <classes visible="yes" title=""/>
+ <enums title=""/>
+ <typedefs title=""/>
+ <functions title=""/>
+ <variables title=""/>
+ <membergroups title=""/>
+ </memberdecl>
+ <detaileddescription title=""/>
+ <memberdecl>
+ <files visible="yes"/>
+ </memberdecl>
+ </module>
+ <directory>
+ <briefdescription visible="yes"/>
+ <directorygraph visible="yes"/>
+ <memberdecl>
+ <dirs visible="yes"/>
+ <files visible="yes"/>
+ </memberdecl>
+ <detaileddescription title=""/>
+ </directory>
+</doxygenlayout>
diff --git a/src/doc/style.css b/src/doc/style.css
new file mode 100644
index 0000000..daabd39
--- /dev/null
+++ b/src/doc/style.css
@@ -0,0 +1,6 @@
+#titlearea,
+address {
+ display: none;
+}
+
+h2.groupheader { margin-top: revert; }