diff --git a/include/SFML/Audio/SoundBuffer.h b/include/SFML/Audio/SoundBuffer.h index 93c806e7..1e33f98b 100644 --- a/include/SFML/Audio/SoundBuffer.h +++ b/include/SFML/Audio/SoundBuffer.h @@ -30,6 +30,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #include #include #include @@ -84,15 +85,22 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str /// The assumed format of the audio samples is 16 bits signed integer /// (int16_t). /// -/// \param samples Pointer to the array of samples in memory -/// \param sampleCount Number of samples in the array -/// \param channelCount Number of channels (1 = mono, 2 = stereo, ...) -/// \param sampleRate Sample rate (number of samples to play per second) +/// \param samples Pointer to the array of samples in memory +/// \param sampleCount Number of samples in the array +/// \param channelCount Number of channels (1 = mono, 2 = stereo, ...) +/// \param sampleRate Sample rate (number of samples to play per second) +/// \param channelMapData Pointer to the array of channel map data +/// \param channelMapSize Size of channel map data array /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate); +CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, + uint64_t sampleCount, + unsigned int channelCount, + unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize); //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer by copying an existing one diff --git a/include/SFML/Audio/SoundChannel.h b/include/SFML/Audio/SoundChannel.h new file mode 100644 index 00000000..f4c6f124 --- /dev/null +++ b/include/SFML/Audio/SoundChannel.h @@ -0,0 +1,65 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDCHANNEL_H +#define SFML_SOUNDCHANNEL_H + + +//////////////////////////////////////////////////////////// +/// \brief Types of sound channels that can be read/written from sound buffers/files +/// +/// In multi-channel audio, each sound channel can be +/// assigned a position. The position of the channel is +/// used to determine where to place a sound when it +/// is spatialised. Assigning an incorrect sound channel +/// will result in multi-channel audio being positioned +/// incorrectly when using spatialisation. +/// +//////////////////////////////////////////////////////////// +typedef enum +{ + sfSoundChannelUnspecified, + sfSoundChannelMono, + sfSoundChannelFrontLeft, + sfSoundChannelFrontRight, + sfSoundChannelFrontCenter, + sfSoundChannelFrontLeftOfCenter, + sfSoundChannelFrontRightOfCenter, + sfSoundChannelLowFrequencyEffects, + sfSoundChannelBackLeft, + sfSoundChannelBackRight, + sfSoundChannelBackCenter, + sfSoundChannelSideLeft, + sfSoundChannelSideRight, + sfSoundChannelTopCenter, + sfSoundChannelTopFrontLeft, + sfSoundChannelTopFrontRight, + sfSoundChannelTopFrontCenter, + sfSoundChannelTopBackLeft, + sfSoundChannelTopBackRight, + sfSoundChannelTopBackCenter +} sfSoundChannel; + + +#endif // SFML_SOUNDCHANNEL_H diff --git a/include/SFML/Audio/SoundRecorder.h b/include/SFML/Audio/SoundRecorder.h index fc03081a..1cbfe46d 100644 --- a/include/SFML/Audio/SoundRecorder.h +++ b/include/SFML/Audio/SoundRecorder.h @@ -115,25 +115,6 @@ CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder //////////////////////////////////////////////////////////// CSFML_AUDIO_API bool sfSoundRecorder_isAvailable(void); -//////////////////////////////////////////////////////////// -/// \brief Set the processing interval -/// -/// The processing interval controls the period -/// between calls to the onProcessSamples function. You may -/// want to use a small interval if you want to process the -/// recorded data in real time, for example. -/// -/// Note: this is only a hint, the actual period may vary. -/// So don't rely on this parameter to implement precise timing. -/// -/// The default processing interval is 100 ms. -/// -/// \param soundRecorder Sound recorder object -/// \param interval Processing interval -/// -//////////////////////////////////////////////////////////// -CSFML_AUDIO_API void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval); - //////////////////////////////////////////////////////////// /// \brief Get a list of the names of all available audio capture devices /// diff --git a/include/SFML/Audio/SoundStream.h b/include/SFML/Audio/SoundStream.h index 47bb0063..09875f32 100644 --- a/include/SFML/Audio/SoundStream.h +++ b/include/SFML/Audio/SoundStream.h @@ -31,8 +31,10 @@ #include #include #include +#include #include #include +#include //////////////////////////////////////////////////////////// @@ -52,20 +54,24 @@ typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< T //////////////////////////////////////////////////////////// /// \brief Create a new sound stream /// -/// \param onGetData Function called when the stream needs more data (can't be NULL) -/// \param onSeek Function called when the stream seeks (can't be NULL) -/// \param channelCount Number of channels to use (1 = mono, 2 = stereo) -/// \param sampleRate Sample rate of the sound (44100 = CD quality) -/// \param userData Data to pass to the callback functions +/// \param onGetData Function called when the stream needs more data (can't be NULL) +/// \param onSeek Function called when the stream seeks (can't be NULL) +/// \param channelCount Number of channels to use (1 = mono, 2 = stereo) +/// \param sampleRate Sample rate of the sound (44100 = CD quality) +/// \param channelMapData Pointer to the array of channel map data +/// \param channelMapSize Size of channel map data array +/// \param userData Data to pass to the callback functions /// /// \return A new sfSoundStream object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData, - sfSoundStreamSeekCallback onSeek, - unsigned int channelCount, - unsigned int sampleRate, - void* userData); + sfSoundStreamSeekCallback onSeek, + unsigned int channelCount, + unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize, + void* userData); //////////////////////////////////////////////////////////// /// \brief Destroy a sound stream diff --git a/include/SFML/Window/Event.h b/include/SFML/Window/Event.h index 369de2da..4b6bf844 100644 --- a/include/SFML/Window/Event.h +++ b/include/SFML/Window/Event.h @@ -43,8 +43,8 @@ typedef enum { sfEvtClosed, ///< The window requested to be closed (no data) sfEvtResized, ///< The window was resized (data in event.size) - sfEvtLostFocus, ///< The window lost the focus (no data) - sfEvtGainedFocus, ///< The window gained the focus (no data) + sfEvtFocusLost, ///< The window lost the focus (no data) + sfEvtFocusGained, ///< The window gained the focus (no data) sfEvtTextEntered, ///< A character was entered (data in event.text) sfEvtKeyPressed, ///< A key was pressed (data in event.key) sfEvtKeyReleased, ///< A key was released (data in event.key) diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 670859e8..8b8003f7 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -80,11 +80,19 @@ sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream) //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate) +sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, + uint64_t sampleCount, + unsigned int channelCount, + unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize) { sfSoundBuffer* buffer = new sfSoundBuffer; - if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate)) + std::vector channelMap(channelMapSize); + for (std::size_t i = 0; i < channelMap.size(); ++i) + channelMap[i] = static_cast(channelMapData[i]); + if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate, channelMap)) { delete buffer; buffer = nullptr; diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp index ececd0c9..e3071c57 100644 --- a/src/SFML/Audio/SoundRecorder.cpp +++ b/src/SFML/Audio/SoundRecorder.cpp @@ -75,13 +75,6 @@ bool sfSoundRecorder_isAvailable(void) } -//////////////////////////////////////////////////////////// -void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval) -{ - CSFML_CALL(soundRecorder, setProcessingInterval(interval)); -} - - //////////////////////////////////////////////////////////// const char** sfSoundRecorder_getAvailableDevices(size_t* count) { diff --git a/src/SFML/Audio/SoundRecorderStruct.h b/src/SFML/Audio/SoundRecorderStruct.h index 5e09c43d..137dc937 100644 --- a/src/SFML/Audio/SoundRecorderStruct.h +++ b/src/SFML/Audio/SoundRecorderStruct.h @@ -51,11 +51,6 @@ public : { } - void setProcessingInterval(sfTime interval) - { - sf::SoundRecorder::setProcessingInterval(sf::microseconds(interval.microseconds)); - } - private : bool onStart() override diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 1065ec11..9fbb6e56 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -35,9 +35,11 @@ sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize, void* userData) { - return new sfSoundStream(onGetData, onSeek, channelCount, sampleRate, userData); + return new sfSoundStream(onGetData, onSeek, channelCount, sampleRate, channelMapData, channelMapSize, userData); } diff --git a/src/SFML/Audio/SoundStreamStruct.h b/src/SFML/Audio/SoundStreamStruct.h index 29ac41b1..a3beb991 100644 --- a/src/SFML/Audio/SoundStreamStruct.h +++ b/src/SFML/Audio/SoundStreamStruct.h @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -43,12 +44,17 @@ public : sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize, void* userData) : myGetDataCallback(onGetData), mySeekCallback (onSeek), myUserData (userData) { - initialize(channelCount, sampleRate); + std::vector channelMap(channelMapSize); + for (std::size_t i = 0; i < channelMap.size(); ++i) + channelMap[i] = static_cast(channelMapData[i]); + initialize(channelCount, sampleRate, channelMap); } private : @@ -88,8 +94,10 @@ struct sfSoundStream sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, + sfSoundChannel* channelMapData, + size_t channelMapSize, void* userData) : - This(onGetData, onSeek, channelCount, sampleRate, userData) + This(onGetData, onSeek, channelCount, sampleRate, channelMapData, channelMapSize, userData) { } diff --git a/src/SFML/ConvertEvent.h b/src/SFML/ConvertEvent.h index 6df4375a..9874ee21 100644 --- a/src/SFML/ConvertEvent.h +++ b/src/SFML/ConvertEvent.h @@ -37,84 +37,142 @@ //////////////////////////////////////////////////////////// inline void convertEvent(const sf::Event& sfmlEvent, sfEvent* event) { - // Convert its type - event->type = static_cast(sfmlEvent.type); - - // Fill its fields - switch (event->type) + if (sfmlEvent.is()) { - case sfEvtResized : - event->size.width = sfmlEvent.size.width; - event->size.height = sfmlEvent.size.height; - break; - - case sfEvtTextEntered : - event->text.unicode = sfmlEvent.text.unicode; - break; - - case sfEvtKeyReleased : - case sfEvtKeyPressed : - event->key.code = static_cast(sfmlEvent.key.code); - event->key.scancode = static_cast(sfmlEvent.key.scancode); - event->key.alt = sfmlEvent.key.alt; - event->key.control = sfmlEvent.key.control; - event->key.shift = sfmlEvent.key.shift; - event->key.system = sfmlEvent.key.system; - break; - - case sfEvtMouseWheelScrolled : - event->mouseWheelScroll.wheel = static_cast(sfmlEvent.mouseWheelScroll.wheel); - event->mouseWheelScroll.delta = sfmlEvent.mouseWheelScroll.delta; - event->mouseWheelScroll.x = sfmlEvent.mouseWheelScroll.x; - event->mouseWheelScroll.y = sfmlEvent.mouseWheelScroll.y; - break; - - case sfEvtMouseButtonPressed : - case sfEvtMouseButtonReleased : - event->mouseButton.button = static_cast(sfmlEvent.mouseButton.button); - event->mouseButton.x = sfmlEvent.mouseButton.x; - event->mouseButton.y = sfmlEvent.mouseButton.y; - break; - - case sfEvtMouseMoved : - event->mouseMove.x = sfmlEvent.mouseMove.x; - event->mouseMove.y = sfmlEvent.mouseMove.y; - break; - - case sfEvtJoystickButtonPressed : - case sfEvtJoystickButtonReleased : - event->joystickButton.joystickId = sfmlEvent.joystickButton.joystickId; - event->joystickButton.button = sfmlEvent.joystickButton.button; - break; - - case sfEvtJoystickMoved : - event->joystickMove.joystickId = sfmlEvent.joystickMove.joystickId; - event->joystickMove.axis = static_cast(sfmlEvent.joystickMove.axis); - event->joystickMove.position = sfmlEvent.joystickMove.position; - break; - - case sfEvtJoystickConnected : - case sfEvtJoystickDisconnected : - event->joystickConnect.joystickId = sfmlEvent.joystickConnect.joystickId; - break; - - case sfEvtTouchBegan : - case sfEvtTouchMoved : - case sfEvtTouchEnded : - event->touch.finger = sfmlEvent.touch.finger; - event->touch.x = sfmlEvent.touch.x; - event->touch.y = sfmlEvent.touch.y; - break; - - case sfEvtSensorChanged : - event->sensor.sensorType = static_cast(sfmlEvent.sensor.type); - event->sensor.x = sfmlEvent.sensor.x; - event->sensor.y = sfmlEvent.sensor.y; - event->sensor.z = sfmlEvent.sensor.z; - break; - - default : - break; + event->type = sfEvtClosed; + } + else if (const auto* resized = sfmlEvent.getIf()) + { + event->type = sfEvtResized; + event->size.width = resized->size.x; + event->size.height = resized->size.y; + } + else if (sfmlEvent.is()) + { + event->type = sfEvtFocusLost; + } + else if (sfmlEvent.is()) + { + event->type = sfEvtFocusGained; + } + else if (const auto* textEntered = sfmlEvent.getIf()) + { + event->type = sfEvtTextEntered; + event->text.unicode = textEntered->unicode; + } + else if (const auto* keyReleased = sfmlEvent.getIf()) + { + event->type = sfEvtKeyReleased; + event->key.code = static_cast(keyReleased->code); + event->key.scancode = static_cast(keyReleased->scancode); + event->key.alt = keyReleased->alt; + event->key.control = keyReleased->control; + event->key.shift = keyReleased->shift; + event->key.system = keyReleased->system; + } + else if (const auto* keyPressed = sfmlEvent.getIf()) + { + event->type = sfEvtKeyPressed; + event->key.code = static_cast(keyPressed->code); + event->key.scancode = static_cast(keyPressed->scancode); + event->key.alt = keyPressed->alt; + event->key.control = keyPressed->control; + event->key.shift = keyPressed->shift; + event->key.system = keyPressed->system; + } + else if (const auto* mouseWheelScrolled = sfmlEvent.getIf()) + { + event->type = sfEvtMouseWheelScrolled; + event->mouseWheelScroll.wheel = static_cast(mouseWheelScrolled->wheel); + event->mouseWheelScroll.delta = mouseWheelScrolled->delta; + event->mouseWheelScroll.x = mouseWheelScrolled->position.x; + event->mouseWheelScroll.y = mouseWheelScrolled->position.y; + } + else if (const auto* mouseButtonPressed = sfmlEvent.getIf()) + { + event->type = sfEvtMouseButtonPressed; + event->mouseButton.button = static_cast(mouseButtonPressed->button); + event->mouseButton.x = mouseButtonPressed->position.x; + event->mouseButton.y = mouseButtonPressed->position.y; + } + else if (const auto* mouseButtonReleased = sfmlEvent.getIf()) + { + event->type = sfEvtMouseButtonReleased; + event->mouseButton.button = static_cast(mouseButtonReleased->button); + event->mouseButton.x = mouseButtonReleased->position.x; + event->mouseButton.y = mouseButtonReleased->position.y; + } + else if (const auto* mouseMoved = sfmlEvent.getIf()) + { + event->type = sfEvtMouseMoved; + event->mouseMove.x = mouseMoved->position.x; + event->mouseMove.y = mouseMoved->position.y; + } + else if (sfmlEvent.is()) + { + event->type = sfEvtMouseEntered; + } + else if (sfmlEvent.is()) + { + event->type = sfEvtMouseLeft; + } + else if (const auto* joystickButtonPressed = sfmlEvent.getIf()) + { + event->type = sfEvtJoystickButtonPressed; + event->joystickButton.joystickId = joystickButtonPressed->joystickId; + event->joystickButton.button = joystickButtonPressed->button; + } + else if (const auto* joystickButtonReleased = sfmlEvent.getIf()) + { + event->type = sfEvtJoystickButtonReleased; + event->joystickButton.joystickId = joystickButtonReleased->joystickId; + event->joystickButton.button = joystickButtonReleased->button; + } + else if (const auto* joystickMoved = sfmlEvent.getIf()) + { + event->type = sfEvtJoystickMoved; + event->joystickMove.joystickId = joystickMoved->joystickId; + event->joystickMove.axis = static_cast(joystickMoved->axis); + event->joystickMove.position = joystickMoved->position; + } + else if (const auto* joystickConnected = sfmlEvent.getIf()) + { + event->type = sfEvtJoystickConnected; + event->joystickConnect.joystickId = joystickConnected->joystickId; + } + else if (const auto* joystickDisconnected = sfmlEvent.getIf()) + { + event->type = sfEvtJoystickDisconnected; + event->joystickConnect.joystickId = joystickDisconnected->joystickId; + } + else if (const auto* touchBegan = sfmlEvent.getIf()) + { + event->type = sfEvtTouchBegan; + event->touch.finger = touchBegan->finger; + event->touch.x = touchBegan->position.x; + event->touch.y = touchBegan->position.y; + } + else if (const auto* touchMoved = sfmlEvent.getIf()) + { + event->type = sfEvtTouchMoved; + event->touch.finger = touchMoved->finger; + event->touch.x = touchMoved->position.x; + event->touch.y = touchMoved->position.y; + } + else if (const auto* touchEnded = sfmlEvent.getIf()) + { + event->type = sfEvtTouchEnded; + event->touch.finger = touchEnded->finger; + event->touch.x = touchEnded->position.x; + event->touch.y = touchEnded->position.y; + } + else if (const auto* sensorChanged = sfmlEvent.getIf()) + { + event->type = sfEvtSensorChanged; + event->sensor.sensorType = static_cast(sensorChanged->type); + event->sensor.x = sensorChanged->value.x; + event->sensor.y = sensorChanged->value.y; + event->sensor.z = sensorChanged->value.z; } } diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index 21945def..6e74794b 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -150,11 +150,10 @@ bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = renderWindow->This.pollEvent(sfmlEvent); + const sf::Event sfmlEvent = renderWindow->This.pollEvent(); // No event, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent @@ -171,11 +170,10 @@ bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = renderWindow->This.waitEvent(sfmlEvent); + const sf::Event sfmlEvent = renderWindow->This.waitEvent(); // Error, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index bb583aaa..9844a03c 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -132,11 +132,10 @@ bool sfWindow_pollEvent(sfWindow* window, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = window->This.pollEvent(sfmlEvent); + const sf::Event sfmlEvent = window->This.pollEvent(); // No event, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent @@ -153,11 +152,10 @@ bool sfWindow_waitEvent(sfWindow* window, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = window->This.waitEvent(sfmlEvent); + const sf::Event sfmlEvent = window->This.waitEvent(); // Error, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent diff --git a/src/SFML/Window/WindowBase.cpp b/src/SFML/Window/WindowBase.cpp index 7c9ecc24..7ae4ff41 100644 --- a/src/SFML/Window/WindowBase.cpp +++ b/src/SFML/Window/WindowBase.cpp @@ -100,11 +100,10 @@ bool sfWindowBase_pollEvent(sfWindowBase* windowBase, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = windowBase->This.pollEvent(sfmlEvent); + const sf::Event sfmlEvent = windowBase->This.pollEvent(); // No event, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent @@ -121,11 +120,10 @@ bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfEvent* event) CSFML_CHECK_RETURN(event, false); // Get the event - sf::Event sfmlEvent; - bool ret = windowBase->This.waitEvent(sfmlEvent); + const sf::Event sfmlEvent = windowBase->This.waitEvent(); // Error, return - if (!ret) + if (!sfmlEvent) return false; // Convert the sf::Event event to a sfEvent