Brunot
Loading...
Searching...
No Matches
Guides

Setting up Doxygen

  • Ensure Doxygen is installed. Open up windows terminal and run winget install --id=DimitriVanHeesch.Doxygen -v 1.15.0 -e
    • Doxygen needs to be version 1.15.0
  • Ensure Graphvis is installed.
    • download from here
    • when running the install, make sure you select the option to add graphviz to the PATH
  • if you've already installed both of those, start here:
  • launch doxywizard
  • go to file > open, and select the doxyfile in the Documentation folder of the repository
  • At the top of doxywizard, select the working directory to be /path/to/repository/Documentation
  • go to the run tab
  • hit run doxygen
  • wait lmao
  • hit Show html output
  • don't push any files in the Documentation/doxygen folder to the repository

Initializing submodules

to update/initialize submodules (like when cloning the repo, use the commmand

git submodule update --init

Using Messaging

The Messaging class has 3 functions for the public interface that you will be calling

1: connect

This function lets add a function to the Messaging system. Specifically, it will be called whenever the specified event is broadcasted

Full definition:

template <typename classType>
void connect(
const std::string& eventName,
void (classType::*functionToLink)(const Message&),
const std::string& functionName,
classType* pointerToSelf
)
Definition Message.h:34

Although this function looks pretty scary at first, it's actually not that bad once you break it down.

Parameter 0 / typename classType: this is the name of the class that has the function you are linking. Since you are connecting a function that belongs to a specific instance of a class, just pass in the type of the class the object is.

Parameter 1 / const std::string& eventName: This is the name of the event that you want to connect the function to.

Parameter 2 / void (classType::*functionToLink)(const Message&): Okay this is the scariest one. However, it's just a function pointer to a function that returns void and takes a const Message& parameter.

Parameter 3 / const std::string& functionName: This is the name of the function that you want to connect. This can technically be anything, but you should try and make it always match the name of the function

Parameter 4 / pointerToSelf: This is a pointer to the instance of a class that you want to be attached to the function. Basically, when the event occurs, this specific instance will receive it.

example call:

messagingSystem->connect<ScoringSystem> (
"PlayerScored",
&ScoringSystem::updateScore,
"updatePlayerScore",
scoringSystemInstance
);

2: remove

This removes all functions of a given name that belong to a specific class

Full definition:

void remove(const std::string& functionToRemove, GameObject* owner);
the base class for the engine, most things inherit from this.
Definition GameObject.h:77

Parameter 1 / const std::string& functionToRemove: The name of the function that you want to be removed. This is why it's important to have the functionName in connect match the actual function name, because otherwise it's basically impossible to find it without looking for how it was connected.

Parameter 2 / GameObject* owner: The entity that the function belongs to.

Example call:

messagingSystem->remove("updatePlayerScore",scoringSystemInstance2);

3: broadcast

This function sends a message to all functions linked to the event

Full definition:

void broadcast(const std::string& eventName, const Message& message);

Parameter 1 / const std::string& eventName: The name of the event that you want to be broadcasted.

Parameter 2 / const Message& message: The message you want to send to the linked functions. You will need to create a Message. (you should create a derived class from Message that holds the data you want if one doesn't currently exist.)

Paths

For an example of how to use Paths, see the detailed description of Path