docs: more comments

This commit is contained in:
Martin Prokoph
2025-02-07 15:54:33 +01:00
parent c813274a6c
commit 813e47a25e
10 changed files with 166 additions and 6 deletions

View File

@@ -11,7 +11,22 @@ private:
BlockSettings settings;
public:
/**
* Constructs a block with the given identifier, encoding and settings.
*
* @param id The (unique) identifier of the block.
* @param encoding The encoding of the block, which is the character used to represent it in the game world.
* @param settings The settings of the block, which define how the block behaves in the game world.
*/
Block(Identifier id, char encoding, BlockSettings settings) : Block(id, encoding, Color::RESET, settings) {};
/**
* Constructs a block with the given identifier, encoding, color and settings.
*
* @param id The (unique) identifier of the block.
* @param encoding The encoding of the block, which is the character used to represent it in the game world.
* @param color The color of the block.
* @param settings The settings of the block, which define how the block behaves in the game world.
*/
Block(Identifier id, char encoding, Color color, BlockSettings settings) {
this->id = id;
this->encoding = encoding;
@@ -19,19 +34,55 @@ public:
this->settings = settings;
};
/**
* Returns the settings associated with the block.
*
* @return The settings of the block, including solidity, pushability, and more.
*/
BlockSettings getSettings() {
return settings;
}
/**
* Gets the identifier of the block.
*
* This identifier is used by the game to uniquely identify the block.
*
* @return The identifier of the block.
*/
Identifier getId() {
return id;
}
/**
* Returns the color of the block.
*
* The color is used when drawing the block in the world.
*
* @return The color of the block.
*/
Color getColor() {
return color;
}
/**
* Returns the character encoding of the block.
*
* This character is used in the text file as well as the terminal to represent the block.
*
* @return The character encoding of the block.
*/
char getEncoding() {
return encoding;
}
/**
* Sets the character encoding for the block.
*
* This encoding is used to represent the block in text files and the terminal.
*
* @param encoding The character encoding to set for the block.
*/
void setEncoding(char encoding) {
this->encoding = encoding;
}