diff --git a/include/AutomationEventList.hpp b/include/AutomationEventList.hpp index 477bbff9..3271aec9 100644 --- a/include/AutomationEventList.hpp +++ b/include/AutomationEventList.hpp @@ -15,12 +15,18 @@ class AutomationEventList : public ::AutomationEventList { set(automationEventList); } - AutomationEventList(unsigned int capacity = 16384, - unsigned int count = 0, - AutomationEvent *events = nullptr) : ::AutomationEventList{capacity, count, events} { - // Nothing. + /** + * Load an empty automation events list. + */ + AutomationEventList() { + set(::LoadAutomationEventList(0)); } + /** + * Load automation events list from file. + * + * @param fileName The file path to load the automation events list from. + */ AutomationEventList(const char* fileName) { Load(fileName); } @@ -82,12 +88,19 @@ class AutomationEventList : public ::AutomationEventList { * Update audio stream buffers with data */ void Unload() { - #if RAYLIB_VERSION_MAJOR >= 5 - #if RAYLIB_VERSION_MINOR == 0 - ::UnloadAutomationEventList(this); - #elif RAYLIB_VERSION_MINOR >= 1 - ::UnloadAutomationEventList(*this); - #endif + if (!IsReady()) { + return; + } + + // The function signature of UnloadAutomationEventList() changes from raylib 5.0. + #if RAYLIB_VERSION_MAJOR == 5 + #if RAYLIB_VERSION_MINOR == 0 + ::UnloadAutomationEventList(this); + #elif RAYLIB_VERSION_MINOR >= 1 + ::UnloadAutomationEventList(*this); + #endif + #else + ::UnloadAutomationEventList(*this); #endif } diff --git a/include/raylib.hpp b/include/raylib.hpp index 1fd071ca..f6d08ff7 100644 --- a/include/raylib.hpp +++ b/include/raylib.hpp @@ -15,13 +15,15 @@ extern "C" { #include RAYLIB_H_FILE // NOLINT #if !defined(RAYLIB_VERSION_MAJOR) || !defined(RAYLIB_VERSION_MINOR) -#if RAYLIB_VERSION_MAJOR < 5 -#error "raylib-cpp requires at least raylib 5.0.0" + #error "raylib-cpp requires raylib >= 5" #endif + +#if RAYLIB_VERSION_MAJOR < 5 + #error "raylib-cpp requires raylib >= 5" #endif #if RAYLIB_VERSION_MAJOR > 5 -#error "raylib-cpp targets raylib 5. Use the `next` branch for the next version of raylib." + #error "raylib-cpp requires raylib ~5.0. Use the `next` branch for the next version of raylib." #endif #ifdef __cplusplus