Add more doc comments

This commit is contained in:
Rob Loach
2022-01-24 01:50:01 -05:00
parent 3c52680506
commit 8e5d204e7b
4 changed files with 57 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -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));