From 8e5d204e7b6960d4808e2be81d60902de6947fbb Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 24 Jan 2022 01:50:01 -0500 Subject: [PATCH] Add more doc comments --- include/AudioDevice.hpp | 2 ++ include/AudioStream.hpp | 2 ++ include/Font.hpp | 35 +++++++++++++++++++++++++++++++++++ include/Image.hpp | 18 ++++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/include/AudioDevice.hpp b/include/AudioDevice.hpp index 2c3e56d..352af46 100644 --- a/include/AudioDevice.hpp +++ b/include/AudioDevice.hpp @@ -15,6 +15,8 @@ class AudioDevice { * Initialize audio device and context. * * @param lateInit Whether or not to post-pone initializing the context. + * + * @throws raylib::RaylibException Throws if the AudioDevice failed to initialize. */ AudioDevice(bool lateInit = false) { if (!lateInit) { diff --git a/include/AudioStream.hpp b/include/AudioStream.hpp index 40bc605..f70c6a7 100644 --- a/include/AudioStream.hpp +++ b/include/AudioStream.hpp @@ -24,6 +24,8 @@ class AudioStream : public ::AudioStream { /** * Init audio stream (to stream raw audio pcm data) + * + * @throws raylib::RaylibException Throws if the AudioStream failed to load. */ AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels = 2) { if (!Load(SampleRate, SampleSize, Channels)) { diff --git a/include/Font.hpp b/include/Font.hpp index 60a09af..75d4577 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -30,12 +30,28 @@ class Font : public ::Font { set(font); } + /** + * Loads a Font from the given file. + * + * @param fileName The file name of the font to load. + * + * @throws raylib::RaylibException Throws if the given font failed to initialize. + */ Font(const std::string& fileName) { if (!Load(fileName)) { throw RaylibException("Failed to load Font from file"); } } + /** + * Loads a Font from the given file, with generation parameters. + * + * @param fileName The file name of the font to load. + * + * @throws raylib::RaylibException Throws if the given font failed to initialize. + * + * @see ::LoadFontEx + */ Font(const std::string& fileName, int fontSize, int* fontChars, int charCount) { if (!Load(fileName, fontSize, fontChars, charCount)) { throw RaylibException("Failed to load font from font with extras"); @@ -108,11 +124,30 @@ class Font : public ::Font { return *this; } + /** + * Loads a font from a given file. + * + * @param fileName The filename of the font to load. + * + * @return True of false depending on if the font loaded successfully. + * + * @see ::LoadFont() + */ bool Load(const std::string& fileName) { set(::LoadFont(fileName.c_str())); return baseSize > 0; } + /** + * Loads a font from a given file with generation parameters. + * + * @param fileName The filename of the font to load. + * @param fontSize The desired size of the font. + * + * @return True of false depending on if the font loaded successfully. + * + * @see ::LoadFontEx() + */ bool Load(const std::string& fileName, int fontSize, int* fontChars, int charCount) { set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount)); return baseSize > 0; diff --git a/include/Image.hpp b/include/Image.hpp index e0687d1..055782f 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -222,6 +222,10 @@ class Image : public ::Image { /** * Load image from file into CPU memory (RAM) + * + * @return Whether or not the image was loaded successfully. + * + * @see ::LoadImage() */ bool Load(const std::string& fileName) { set(::LoadImage(fileName.c_str())); @@ -230,6 +234,10 @@ class Image : public ::Image { /** * Load image from RAW file data. + * + * @return Whether or not the raw image data was loaded successfully. + * + * @see ::LoadImageRaw() */ bool Load(const std::string& fileName, int width, int height, int format, int headerSize) { set(::LoadImageRaw(fileName.c_str(), width, height, format, headerSize)); @@ -238,6 +246,10 @@ class Image : public ::Image { /** * Load image sequence from file (frames appended to image.data). + * + * @return Whether or not the image animation was loaded successfully. + * + * @see ::LoadImageAnim() */ bool Load(const std::string& fileName, int* frames) { set(::LoadImageAnim(fileName.c_str(), frames)); @@ -246,6 +258,10 @@ class Image : public ::Image { /** * Load image from memory buffer, fileType refers to extension: i.e. "png". + * + * @return Whether or not the image data was loaded successfully. + * + * @see ::LoadImageFromMemory() */ bool Load( const std::string& fileType, @@ -259,6 +275,8 @@ class Image : public ::Image { * Load an image from the given file. * * @return True or false depending on whether or not the image was loaded from the texture. + * + * @see ::LoadImageFromTexture() */ bool Load(const ::Texture2D& texture) { set(::LoadImageFromTexture(texture));