Merge pull request #319 from RobLoach/versions

Update AutomationEventList usage
This commit is contained in:
Rob Loach
2024-05-28 11:39:53 -04:00
committed by GitHub
2 changed files with 28 additions and 13 deletions

View File

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

View File

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