diff --git a/include/FileData.hpp b/include/FileData.hpp index ea51004f..664d4c24 100644 --- a/include/FileData.hpp +++ b/include/FileData.hpp @@ -10,7 +10,7 @@ namespace raylib { class FileData { -public: + public: FileData() = default; FileData(const FileData&) = delete; FileData(FileData&& other) noexcept : data(other.data), bytesRead(other.bytesRead) { @@ -44,7 +44,7 @@ class FileData { } } -private: + private: unsigned char* data{nullptr}; int bytesRead{0}; }; diff --git a/include/FileText.hpp b/include/FileText.hpp index f8f52a0f..2b411614 100644 --- a/include/FileText.hpp +++ b/include/FileText.hpp @@ -10,7 +10,7 @@ namespace raylib { class FileText { -public: + public: FileText() = default; FileText(const FileText&) = delete; FileText(FileText&& other) noexcept : data(other.data), length(other.length) { @@ -53,7 +53,7 @@ class FileText { } } -private: + private: char* data{nullptr}; unsigned int length{0}; }; diff --git a/include/Functions.hpp b/include/Functions.hpp index ae67c7f5..d79e0f05 100644 --- a/include/Functions.hpp +++ b/include/Functions.hpp @@ -21,56 +21,56 @@ namespace raylib { /** * Initialize window and OpenGL context */ - [[maybe_unused]] RLCPPAPI inline void InitWindow(int width, int height, const std::string& title = "raylib") { +[[maybe_unused]] RLCPPAPI inline void InitWindow(int width, int height, const std::string& title = "raylib") { ::InitWindow(width, height, title.c_str()); } /** * Set title for window */ - [[maybe_unused]] RLCPPAPI inline void SetWindowTitle(const std::string& title) { +[[maybe_unused]] RLCPPAPI inline void SetWindowTitle(const std::string& title) { ::SetWindowTitle(title.c_str()); } /** * Get the human-readable, UTF-8 encoded name of the primary monitor */ - [[maybe_unused]] RLCPPAPI inline std::string GetMonitorName(int monitor = 0) { +[[maybe_unused]] RLCPPAPI inline std::string GetMonitorName(int monitor = 0) { return ::GetMonitorName(monitor); } /** * Set clipboard text content */ - [[maybe_unused]] RLCPPAPI inline void SetClipboardText(const std::string& text) { +[[maybe_unused]] RLCPPAPI inline void SetClipboardText(const std::string& text) { ::SetClipboardText(text.c_str()); } /** * Get clipboard text content */ - [[maybe_unused]] RLCPPAPI inline std::string GetClipboardText() { +[[maybe_unused]] RLCPPAPI inline std::string GetClipboardText() { return ::GetClipboardText(); } /** * Takes a screenshot of current screen (saved a .png) */ - [[maybe_unused]] RLCPPAPI inline void TakeScreenshot(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline void TakeScreenshot(const std::string& fileName) { ::TakeScreenshot(fileName.c_str()); } /** * Get gamepad internal name id */ - [[maybe_unused]] RLCPPAPI inline std::string GetGamepadName(int gamepad) { +[[maybe_unused]] RLCPPAPI inline std::string GetGamepadName(int gamepad) { return ::GetGamepadName(gamepad); } /** * Load text data from file (read) */ - [[maybe_unused]] RLCPPAPI std::string LoadFileText(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI std::string LoadFileText(const std::string& fileName) { char* text = ::LoadFileText(fileName.c_str()); std::string output(text); ::UnloadFileText(text); @@ -80,77 +80,77 @@ namespace raylib { /** * Save text data to file (write) */ - [[maybe_unused]] RLCPPAPI inline bool SaveFileText(const std::string& fileName, const std::string& text) { +[[maybe_unused]] RLCPPAPI inline bool SaveFileText(const std::string& fileName, const std::string& text) { return ::SaveFileText(fileName.c_str(), const_cast(text.c_str())); } /** * Check if file exists */ - [[maybe_unused]] RLCPPAPI inline bool FileExists(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline bool FileExists(const std::string& fileName) { return ::FileExists(fileName.c_str()); } /** * Check if directory path exists */ - [[maybe_unused]] RLCPPAPI inline bool DirectoryExists(const std::string& dirPath) { +[[maybe_unused]] RLCPPAPI inline bool DirectoryExists(const std::string& dirPath) { return ::DirectoryExists(dirPath.c_str()); } /** * Check file extension (including point: .png, .wav) */ - [[maybe_unused]] RLCPPAPI inline bool IsFileExtension(const std::string& fileName, const std::string& ext) { +[[maybe_unused]] RLCPPAPI inline bool IsFileExtension(const std::string& fileName, const std::string& ext) { return ::IsFileExtension(fileName.c_str(), ext.c_str()); } /** * Get pointer to extension for a filename string (including point: ".png") */ - [[maybe_unused]] RLCPPAPI inline std::string GetFileExtension(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline std::string GetFileExtension(const std::string& fileName) { return ::GetFileExtension(fileName.c_str()); } /** * Get pointer to filename for a path string */ - [[maybe_unused]] RLCPPAPI inline std::string GetFileName(const std::string& filePath) { +[[maybe_unused]] RLCPPAPI inline std::string GetFileName(const std::string& filePath) { return ::GetFileName(filePath.c_str()); } /** * Get filename string without extension */ - [[maybe_unused]] RLCPPAPI inline std::string GetFileNameWithoutExt(const std::string& filePath) { +[[maybe_unused]] RLCPPAPI inline std::string GetFileNameWithoutExt(const std::string& filePath) { return ::GetFileNameWithoutExt(filePath.c_str()); } /** * Get full path for a given fileName with path */ - [[maybe_unused]] RLCPPAPI inline std::string GetDirectoryPath(const std::string& filePath) { +[[maybe_unused]] RLCPPAPI inline std::string GetDirectoryPath(const std::string& filePath) { return ::GetDirectoryPath(filePath.c_str()); } /** * Get previous directory path for a given path */ - [[maybe_unused]] RLCPPAPI inline std::string GetPrevDirectoryPath(const std::string& dirPath) { +[[maybe_unused]] RLCPPAPI inline std::string GetPrevDirectoryPath(const std::string& dirPath) { return ::GetPrevDirectoryPath(dirPath.c_str()); } /** * Get current working directory */ - [[maybe_unused]] RLCPPAPI inline std::string GetWorkingDirectory() { +[[maybe_unused]] RLCPPAPI inline std::string GetWorkingDirectory() { return ::GetWorkingDirectory(); } /** * Get filenames in a directory path */ - [[maybe_unused]] RLCPPAPI std::vector LoadDirectoryFiles(const std::string& dirPath) { +[[maybe_unused]] RLCPPAPI std::vector LoadDirectoryFiles(const std::string& dirPath) { FilePathList files = ::LoadDirectoryFiles(dirPath.c_str()); std::vector output(files.paths, files.paths + files.count); ::UnloadDirectoryFiles(files); @@ -160,14 +160,14 @@ namespace raylib { /** * Change working directory, return true on success */ - [[maybe_unused]] RLCPPAPI inline bool ChangeDirectory(const std::string& dir) { +[[maybe_unused]] RLCPPAPI inline bool ChangeDirectory(const std::string& dir) { return ::ChangeDirectory(dir.c_str()); } /** * Get dropped files names */ - [[maybe_unused]] RLCPPAPI std::vector LoadDroppedFiles() { +[[maybe_unused]] RLCPPAPI std::vector LoadDroppedFiles() { if (!::IsFileDropped()) { return std::vector(); } @@ -180,28 +180,28 @@ namespace raylib { /** * Get file modification time (last write time) */ - [[maybe_unused]] RLCPPAPI inline long GetFileModTime(const std::string& fileName) { // NOLINT +[[maybe_unused]] RLCPPAPI inline long GetFileModTime(const std::string& fileName) { // NOLINT return ::GetFileModTime(fileName.c_str()); } /** * Open URL with default system browser (if available) */ - [[maybe_unused]] RLCPPAPI inline void OpenURL(const std::string& url) { +[[maybe_unused]] RLCPPAPI inline void OpenURL(const std::string& url) { return ::OpenURL(url.c_str()); } /** * Load an image. */ - [[maybe_unused]] RLCPPAPI inline ::Image LoadImage(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline ::Image LoadImage(const std::string& fileName) { return ::LoadImage(fileName.c_str()); } /** * Load an image from RAW file data */ - [[maybe_unused]] RLCPPAPI inline ::Image LoadImageRaw(const std::string& fileName, +[[maybe_unused]] RLCPPAPI inline ::Image LoadImageRaw(const std::string& fileName, int width, int height, int format, int headerSize) { return ::LoadImageRaw(fileName.c_str(), width, height, format, headerSize); @@ -210,14 +210,14 @@ namespace raylib { /** * Load animated image data */ - [[maybe_unused]] RLCPPAPI inline ::Image LoadImageAnim(const std::string& fileName, int *frames) { +[[maybe_unused]] RLCPPAPI inline ::Image LoadImageAnim(const std::string& fileName, int *frames) { return ::LoadImageAnim(fileName.c_str(), frames); } /** * Load image from memory buffer, fileType refers to extension like "png" */ - [[maybe_unused]] RLCPPAPI inline ::Image LoadImageFromMemory(const std::string& fileType, +[[maybe_unused]] RLCPPAPI inline ::Image LoadImageFromMemory(const std::string& fileType, const unsigned char *fileData, int dataSize) { return ::LoadImageFromMemory(fileType.c_str(), fileData, dataSize); @@ -226,14 +226,14 @@ namespace raylib { /** * Export image data to file */ - [[maybe_unused]] RLCPPAPI inline bool ExportImage(const Image& image, const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline bool ExportImage(const Image& image, const std::string& fileName) { return ::ExportImage(image, fileName.c_str()); } /** * Export image as code file (.h) defining an array of bytes */ - [[maybe_unused]] RLCPPAPI inline bool ExportImageAsCode(const Image& image, const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline bool ExportImageAsCode(const Image& image, const std::string& fileName) { return ::ExportImageAsCode(image, fileName.c_str()); } @@ -247,7 +247,11 @@ namespace raylib { /** * Draw text (using default font) */ -[[maybe_unused]] RLCPPAPI inline void DrawText(const std::string& text, int posX, int posY, int fontSize, ::Color color) { +[[maybe_unused]] RLCPPAPI inline void DrawText( + const std::string& text, + int posX, int posY, + int fontSize, + ::Color color) { ::DrawText(text.c_str(), posX, posY, fontSize, color); } @@ -278,7 +282,7 @@ namespace raylib { /** * Draw text using Font and pro parameters (rotation) */ - [[maybe_unused]] RLCPPAPI inline void DrawTextPro(const Font& font, const std::string& text, Vector2 position, +[[maybe_unused]] RLCPPAPI inline void DrawTextPro(const Font& font, const std::string& text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, ::Color tint) { ::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, tint); } @@ -286,14 +290,17 @@ namespace raylib { /** * Load font from file (filename must include file extension) */ - [[maybe_unused]] RLCPPAPI inline ::Font LoadFont(const std::string& fileName) { +[[maybe_unused]] RLCPPAPI inline ::Font LoadFont(const std::string& fileName) { return ::LoadFont(fileName.c_str()); } /** * Load font from file (filename must include file extension) */ - [[maybe_unused]] RLCPPAPI inline ::Font LoadFontEx(const std::string& fileName, int fontSize, int *fontChars, int charsCount) { +[[maybe_unused]] RLCPPAPI inline ::Font LoadFontEx( + const std::string& fileName, + int fontSize, int *fontChars, + int charsCount) { return ::LoadFontEx(fileName.c_str(), fontSize, fontChars, charsCount); } @@ -342,14 +349,16 @@ namespace raylib { /** * Get text length, checks for '\0' ending */ - [[maybe_unused]] RLCPPAPI inline std::string TextSubtext(const std::string& text, int position, int length) { +[[maybe_unused]] RLCPPAPI inline std::string TextSubtext(const std::string& text, int position, int length) { return ::TextSubtext(text.c_str(), position, length); } /** * Replace text string */ - [[maybe_unused]] RLCPPAPI std::string TextReplace(const std::string& text, const std::string& replace, const std::string& by) { +[[maybe_unused]] RLCPPAPI std::string TextReplace( + const std::string& text, const std::string& replace, + const std::string& by) { const char* input = text.c_str(); char* output = ::TextReplace(const_cast(input), replace.c_str(), by.c_str()); if (output != NULL) { @@ -363,7 +372,7 @@ namespace raylib { /** * Insert text in a position */ - [[maybe_unused]] RLCPPAPI std::string TextInsert(const std::string& text, const std::string& insert, int position) { +[[maybe_unused]] RLCPPAPI std::string TextInsert(const std::string& text, const std::string& insert, int position) { char* output = ::TextInsert(text.c_str(), insert.c_str(), position); if (output != NULL) { std::string stringOutput(output); @@ -376,7 +385,7 @@ namespace raylib { /** * Split text into multiple strings */ - [[maybe_unused]] RLCPPAPI std::vector TextSplit(const std::string& text, char delimiter) { +[[maybe_unused]] RLCPPAPI std::vector TextSplit(const std::string& text, char delimiter) { int count; const char** split = ::TextSplit(text.c_str(), delimiter, &count); return std::vector(split, split + count); @@ -385,35 +394,35 @@ namespace raylib { /** * Find first text occurrence within a string */ - [[maybe_unused]] RLCPPAPI inline int TextFindIndex(const std::string& text, const std::string& find) { +[[maybe_unused]] RLCPPAPI inline int TextFindIndex(const std::string& text, const std::string& find) { return ::TextFindIndex(text.c_str(), find.c_str()); } /** * Get upper case version of provided string */ - [[maybe_unused]] RLCPPAPI inline std::string TextToUpper(const std::string& text) { +[[maybe_unused]] RLCPPAPI inline std::string TextToUpper(const std::string& text) { return ::TextToUpper(text.c_str()); } /** * Get lower case version of provided string */ - [[maybe_unused]] RLCPPAPI inline std::string TextToLower(const std::string& text) { +[[maybe_unused]] RLCPPAPI inline std::string TextToLower(const std::string& text) { return ::TextToLower(text.c_str()); } /** * Get Pascal case notation version of provided string */ - [[maybe_unused]] RLCPPAPI inline std::string TextToPascal(const std::string& text) { +[[maybe_unused]] RLCPPAPI inline std::string TextToPascal(const std::string& text) { return ::TextToPascal(text.c_str()); } /** * Get integer value from text (negative values not supported) */ - [[maybe_unused]] RLCPPAPI inline int TextToInteger(const std::string& text) { +[[maybe_unused]] RLCPPAPI inline int TextToInteger(const std::string& text) { return ::TextToInteger(text.c_str()); } diff --git a/include/Keyboard.hpp b/include/Keyboard.hpp index 4dc9f216..055257b3 100644 --- a/include/Keyboard.hpp +++ b/include/Keyboard.hpp @@ -56,9 +56,9 @@ namespace Keyboard { [[maybe_unused]] RLCPPAPI inline bool GetCharPressed() { return ::GetCharPressed(); } -}; -} // namespace raylib +} // namespace Keyboard +} // namespace raylib namespace RKeyboard = raylib::Keyboard; -#endif // RAYLIB_CPP_INCLUDE_KEYBOARD_HPP_ +#endif // RAYLIB_CPP_INCLUDE_KEYBOARD_HPP_ diff --git a/include/Mouse.hpp b/include/Mouse.hpp index 8bfc0b7a..5dc9a018 100644 --- a/include/Mouse.hpp +++ b/include/Mouse.hpp @@ -144,7 +144,7 @@ namespace Mouse { [[maybe_unused]] RLCPPAPI inline Ray GetRay(const ::Camera& camera) { return ::GetMouseRay(::GetMousePosition(), camera); } -}; +} // namespace Mouse } // namespace raylib namespace RMouse = raylib::Mouse; diff --git a/include/Touch.hpp b/include/Touch.hpp index c6caabde..091f847c 100644 --- a/include/Touch.hpp +++ b/include/Touch.hpp @@ -42,7 +42,7 @@ namespace Touch { [[maybe_unused]] RLCPPAPI inline int GetPointCount() { return ::GetTouchPointCount(); } -}; +} // namespace Touch } // namespace raylib namespace RTouch = raylib::Touch;