mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Implement new graphics, system and window functions
This commit is contained in:
1 parent
70397c6131
commit
eb0f2974ab
18 files changed
+535
-82
No files matched your search
@@ -33,6 +33,7 @@
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/RenderStates.h>
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
@@ -108,6 +109,33 @@ CSFML_GRAPHICS_API void sfRenderTexture_display(sfRenderTexture* renderTexture);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the stencil buffer to a specific value
|
||||
///
|
||||
/// The specified value is truncated to the bit width of
|
||||
/// the current stencil buffer.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clearStencil(sfRenderTexture* renderTexture, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the entire target with a single color and stencil value
|
||||
///
|
||||
/// The specified stencil value is truncated to the bit
|
||||
/// width of the current stencil buffer.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param color Fill color to use to clear the render target
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_clearColorAndStencil(sfRenderTexture* renderTexture,
|
||||
sfColor color,
|
||||
sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current active view of a render texture
|
||||
///
|
||||
@@ -148,6 +176,22 @@ CSFML_GRAPHICS_API const sfView* sfRenderTexture_getDefaultView(const sfRenderTe
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of a view, applied to this render target
|
||||
///
|
||||
/// The scissor rectangle is defined in the view as a ratio. This
|
||||
/// function simply applies this ratio to the current dimensions
|
||||
/// of the render target to calculate the pixels rectangle
|
||||
/// that the scissor rectangle actually covers in the target.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view The view for which we want to compute the scissor rectangle
|
||||
///
|
||||
/// \return Scissor rectangle, expressed in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getScissor(const sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from texture coordinates to world coordinates
|
||||
///
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
#include <CSFML/Graphics/PrimitiveType.h>
|
||||
#include <CSFML/Graphics/Rect.h>
|
||||
#include <CSFML/Graphics/RenderStates.h>
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
#include <CSFML/Graphics/Types.h>
|
||||
#include <CSFML/Graphics/Vertex.h>
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Event.h>
|
||||
#include <CSFML/Window/VideoMode.h>
|
||||
@@ -122,12 +124,18 @@ CSFML_GRAPHICS_API bool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow
|
||||
CSFML_GRAPHICS_API sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the event on top of event queue of a render window, if any, and pop it
|
||||
/// \brief Pop the event on top of event queue, if any, and return it
|
||||
///
|
||||
/// This function is not blocking: if there's no pending event then
|
||||
/// it will return false and leave \a event unmodified.
|
||||
/// Note that more than one event may be present in the event queue,
|
||||
/// thus you should always call this function in a loop
|
||||
/// to make sure that you process every pending event.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, false if event queue was empty
|
||||
/// \return true if an event was returned, or false if the event queue was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event);
|
||||
@@ -135,13 +143,28 @@ CSFML_GRAPHICS_API bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, s
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Wait for an event and return it
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param event Event to fill
|
||||
/// This function is blocking: if there's no pending event then
|
||||
/// it will wait until an event is received or until the provided
|
||||
/// timeout elapses. Only if an error or a timeout occurs the
|
||||
/// function returns `false`.
|
||||
/// This function is typically used when you have a thread that is
|
||||
/// dedicated to events handling: you want to make this thread sleep
|
||||
/// as long as no new event is received.
|
||||
/// \code
|
||||
/// while (sfRenderWindow_waitEvent(renderWindow, timeout, &event))
|
||||
/// {
|
||||
/// // process event...
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \return false if an error occurred
|
||||
/// \param renderWindow Render window object
|
||||
/// \param timeout Maximum time to wait (`sfTime_Zero` for infinite)
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, false if event queue was empty or function timed out
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event);
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfTime timeout, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a render window
|
||||
@@ -377,6 +400,31 @@ CSFML_GRAPHICS_API sfWindowHandle sfRenderWindow_getNativeHandle(const sfRenderW
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the stencil buffer to a specific value
|
||||
///
|
||||
/// The specified value is truncated to the bit width of
|
||||
/// the current stencil buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clearStencil(sfRenderWindow* renderWindow, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the entire target with a single color and stencil value
|
||||
///
|
||||
/// The specified stencil value is truncated to the bit
|
||||
/// width of the current stencil buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param color Fill color to use to clear the render target
|
||||
/// \param stencilValue Stencil value to clear to
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_clearColorAndStencil(sfRenderWindow* renderWindow, sfColor color, sfStencilValue stencilValue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current active view of a render window
|
||||
///
|
||||
@@ -417,6 +465,22 @@ CSFML_GRAPHICS_API const sfView* sfRenderWindow_getDefaultView(const sfRenderWin
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of a view, applied to this render target
|
||||
///
|
||||
/// The scissor rectangle is defined in the view as a ratio. This
|
||||
/// function simply applies this ratio to the current dimensions
|
||||
/// of the render target to calculate the pixels rectangle
|
||||
/// that the scissor rectangle actually covers in the target.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param view The view for which we want to compute the scissor rectangle
|
||||
///
|
||||
/// \return Scissor rectangle, expressed in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getScissor(const sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from window coordinates to world coordinates
|
||||
///
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the stencil test comparisons that can be performed
|
||||
///
|
||||
/// The comparisons are mapped directly to their OpenGL equivalents,
|
||||
/// specified by `glStencilFunc()`.
|
||||
////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStencilComparisonNever, //!< The stencil test never passes
|
||||
sfStencilComparisonLess, //!< The stencil test passes if the new value is less than the value in the stencil buffer
|
||||
sfStencilComparisonLessEqual, //!< The stencil test passes if the new value is less than or equal to the value in the stencil buffer
|
||||
sfStencilComparisonGreater, //!< The stencil test passes if the new value is greater than the value in the stencil buffer
|
||||
sfStencilComparisonGreaterEqual, //!< The stencil test passes if the new value is greater than or equal to the value in the stencil buffer
|
||||
sfStencilComparisonEqual, //!< The stencil test passes if the new value is strictly equal to the value in the stencil buffer
|
||||
sfStencilComparisonNotEqual, //!< The stencil test passes if the new value is strictly unequal to the value in the stencil buffer
|
||||
sfStencilComparisonAlways //!< The stencil test always passes
|
||||
} sfStencilComparison;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the stencil buffer update operations
|
||||
///
|
||||
/// The update operations are mapped directly to their OpenGL equivalents,
|
||||
/// specified by `glStencilOp()`.
|
||||
////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStencilUpdateOperationKeep, //!< If the stencil test passes, the value in the stencil buffer is not modified
|
||||
sfStencilUpdateOperationZero, //!< If the stencil test passes, the value in the stencil buffer is set to zero
|
||||
sfStencilUpdateOperationReplace, //!< If the stencil test passes, the value in the stencil buffer is set to the new value
|
||||
sfStencilUpdateOperationIncrement, //!< If the stencil test passes, the value in the stencil buffer is incremented and if required clamped
|
||||
sfStencilUpdateOperationDecrement, //!< If the stencil test passes, the value in the stencil buffer is decremented and if required clamped
|
||||
sfStencilUpdateOperationInvert, //!< If the stencil test passes, the value in the stencil buffer is bitwise inverted
|
||||
} sfStencilUpdateOperation;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/// \brief Stencil value type (also used as a mask)
|
||||
///
|
||||
////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int value; //!< The stored stencil value
|
||||
} sfStencilValue;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Stencil modes for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfStencilComparison stencilComparison; //!< The comparison we're performing the stencil test with
|
||||
sfStencilUpdateOperation stencilUpdateOperation; //!< The update operation to perform if the stencil test passes
|
||||
sfStencilValue stencilReference; //!< The reference value we're performing the stencil test with
|
||||
sfStencilValue stencilMask; //!< The mask to apply to both the reference value and the value in the stencil buffer
|
||||
bool stencilOnly; //!< Whether we should update the color buffer in addition to the stencil buffer
|
||||
} sfStencilMode;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the default values for a StencilMode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfStencilMode sfStencilMode_default;
|
||||
@@ -57,6 +57,16 @@ typedef enum
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_create(sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture
|
||||
///
|
||||
/// \param size Texture size
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgb(sfVector2u size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a file
|
||||
///
|
||||
|
||||
@@ -117,6 +117,29 @@ CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfView_setViewport(sfView* view, sfFloatRect viewport);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the target scissor rectangle
|
||||
///
|
||||
/// The scissor rectangle, expressed as a factor (between 0 and 1) of
|
||||
/// the RenderTarget, specifies the region of the RenderTarget whose
|
||||
/// pixels are able to be modified by draw or clear operations.
|
||||
/// Any pixels which lie outside of the scissor rectangle will
|
||||
/// not be modified by draw or clear operations.
|
||||
/// For example, a scissor rectangle which only allows modifications
|
||||
/// to the right side of the target would be defined
|
||||
/// with `sfView_setScissor(view, (sfFloatRect){{0.5f, 0.f}, {0.5f, 1.f}})`.
|
||||
/// By default, a view has a scissor rectangle which allows
|
||||
/// modifications to the entire target. This is equivalent to
|
||||
/// disabling the scissor test entirely. Passing the default
|
||||
/// scissor rectangle to this function will also disable
|
||||
/// scissor testing.
|
||||
///
|
||||
/// \param view View object
|
||||
/// \param scissor New scissor rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfView_setScissor(sfView* view, sfFloatRect scissor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the center of a view
|
||||
///
|
||||
@@ -157,6 +180,16 @@ CSFML_GRAPHICS_API float sfView_getRotation(const sfView* view);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfView_getViewport(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the scissor rectangle of the view
|
||||
///
|
||||
/// \param view View object
|
||||
///
|
||||
/// \return Scissor rectangle, expressed as a factor of the target size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFloatRect sfView_getScissor(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move a view relatively to its current position
|
||||
///
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef enum
|
||||
sfEvtMouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton)
|
||||
sfEvtMouseButtonReleased, ///< A mouse button was released (data in event.mouseButton)
|
||||
sfEvtMouseMoved, ///< The mouse cursor moved (data in event.mouseMove)
|
||||
sfEvtMouseMovedRaw, ///< The mouse cursor moved (data in event.mouseMove)
|
||||
sfEvtMouseEntered, ///< The mouse cursor entered the area of the window (no data)
|
||||
sfEvtMouseLeft, ///< The mouse cursor left the area of the window (no data)
|
||||
sfEvtJoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton)
|
||||
@@ -100,10 +101,19 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
int x;
|
||||
int y;
|
||||
sfVector2i position;
|
||||
} sfMouseMoveEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse move raw event parameters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
sfVector2i delta;
|
||||
} sfMouseMoveRawEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse buttons events parameters
|
||||
///
|
||||
@@ -112,8 +122,7 @@ typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
sfMouseButton button;
|
||||
int x;
|
||||
int y;
|
||||
sfVector2i position;
|
||||
} sfMouseButtonEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -125,8 +134,7 @@ typedef struct
|
||||
sfEventType type;
|
||||
sfMouseWheel wheel;
|
||||
float delta;
|
||||
int x;
|
||||
int y;
|
||||
sfVector2i position;
|
||||
} sfMouseWheelScrollEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -168,9 +176,8 @@ typedef struct
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
sfEventType type;
|
||||
sfVector2u size;
|
||||
} sfSizeEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -181,8 +188,7 @@ typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
unsigned int finger;
|
||||
int x;
|
||||
int y;
|
||||
sfVector2i position;
|
||||
} sfTouchEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -193,9 +199,7 @@ typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
sfSensorType sensorType;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
sfVector3f value;
|
||||
} sfSensorEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -209,6 +213,7 @@ typedef union
|
||||
sfKeyEvent key; ///< Key event parameters
|
||||
sfTextEvent text; ///< Text event parameters
|
||||
sfMouseMoveEvent mouseMove; ///< Mouse move event parameters
|
||||
sfMouseMoveRawEvent mouseMoveRaw; ///< Mouse move raw event parameters
|
||||
sfMouseButtonEvent mouseButton; ///< Mouse button event parameters
|
||||
sfMouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters
|
||||
sfJoystickMoveEvent joystickMove; ///< Joystick move event parameters
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Window/Export.h>
|
||||
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Event.h>
|
||||
#include <CSFML/Window/Types.h>
|
||||
@@ -201,7 +202,7 @@ CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow* window);
|
||||
/// to make sure that you process every pending event.
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param event Event to be returned
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, or false if the event queue was empty
|
||||
///
|
||||
@@ -212,20 +213,27 @@ CSFML_WINDOW_API bool sfWindow_pollEvent(sfWindow* window, sfEvent* event);
|
||||
/// \brief Wait for an event and return it
|
||||
///
|
||||
/// This function is blocking: if there's no pending event then
|
||||
/// it will wait until an event is received.
|
||||
/// After this function returns (and no error occurred),
|
||||
/// the \a event object is always valid and filled properly.
|
||||
/// This function is typically used when you have a thread that
|
||||
/// is dedicated to events handling: you want to make this thread
|
||||
/// sleep as long as no new event is received.
|
||||
/// it will wait until an event is received or until the provided
|
||||
/// timeout elapses. Only if an error or a timeout occurs the
|
||||
/// function returns `false`.
|
||||
/// This function is typically used when you have a thread that is
|
||||
/// dedicated to events handling: you want to make this thread sleep
|
||||
/// as long as no new event is received.
|
||||
/// \code
|
||||
/// while (sfWindow_waitEvent(window, timeout, &event))
|
||||
/// {
|
||||
/// // process event...
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param event Event to be returned
|
||||
/// \param window Window object
|
||||
/// \param timeout Maximum time to wait (`sfTime_Zero` for infinite)
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return false if any error occurred
|
||||
/// \return true if an event was returned, false if event queue was empty or function timed out
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API bool sfWindow_waitEvent(sfWindow* window, sfEvent* event);
|
||||
CSFML_WINDOW_API bool sfWindow_waitEvent(sfWindow* window, sfTime timeout, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a window
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Window/Export.h>
|
||||
|
||||
#include <CSFML/System/Time.h>
|
||||
#include <CSFML/System/Vector2.h>
|
||||
#include <CSFML/Window/Event.h>
|
||||
#include <CSFML/Window/Types.h>
|
||||
@@ -157,7 +158,7 @@ CSFML_WINDOW_API bool sfWindowBase_isOpen(const sfWindowBase* windowBase);
|
||||
/// to make sure that you process every pending event.
|
||||
///
|
||||
/// \param windowBase Window object
|
||||
/// \param event Event to be returned
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return true if an event was returned, or false if the event queue was empty
|
||||
///
|
||||
@@ -168,20 +169,27 @@ CSFML_WINDOW_API bool sfWindowBase_pollEvent(sfWindowBase* windowBase, sfEvent*
|
||||
/// \brief Wait for an event and return it
|
||||
///
|
||||
/// This function is blocking: if there's no pending event then
|
||||
/// it will wait until an event is received.
|
||||
/// After this function returns (and no error occurred),
|
||||
/// the \a event object is always valid and filled properly.
|
||||
/// This function is typically used when you have a thread that
|
||||
/// is dedicated to events handling: you want to make this thread
|
||||
/// sleep as long as no new event is received.
|
||||
/// it will wait until an event is received or until the provided
|
||||
/// timeout elapses. Only if an error or a timeout occurs the
|
||||
/// function returns `false`.
|
||||
/// This function is typically used when you have a thread that is
|
||||
/// dedicated to events handling: you want to make this thread sleep
|
||||
/// as long as no new event is received.
|
||||
/// \code
|
||||
/// while (sfWindowBase_waitEvent(windowBase, timeout, &event))
|
||||
/// {
|
||||
/// // process event...
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \param windowBase Window object
|
||||
/// \param event Event to be returned
|
||||
/// \param windowBase Window base object
|
||||
/// \param timeout Maximum time to wait (`sfTime_Zero` for infinite)
|
||||
/// \param event Event to fill, if any
|
||||
///
|
||||
/// \return false if any error occurred
|
||||
/// \return true if an event was returned, false if event queue was empty or function timed out
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfEvent* event);
|
||||
CSFML_WINDOW_API bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfTime timeout, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a window
|
||||
|
||||
+31
-34
@@ -27,6 +27,8 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/System/ConvertVector2.hpp>
|
||||
#include <CSFML/System/ConvertVector3.hpp>
|
||||
#include <CSFML/Window/Event.h>
|
||||
|
||||
#include <SFML/Window/Event.hpp>
|
||||
@@ -48,9 +50,8 @@
|
||||
}
|
||||
else if (const auto* resized = sfmlEvent->getIf<sf::Event::Resized>())
|
||||
{
|
||||
event->type = sfEvtResized;
|
||||
event->size.width = resized->size.x;
|
||||
event->size.height = resized->size.y;
|
||||
event->type = sfEvtResized;
|
||||
event->size.size = convertVector2(resized->size);
|
||||
}
|
||||
else if (sfmlEvent->is<sf::Event::FocusLost>())
|
||||
{
|
||||
@@ -87,31 +88,32 @@
|
||||
}
|
||||
else if (const auto* mouseWheelScrolled = sfmlEvent->getIf<sf::Event::MouseWheelScrolled>())
|
||||
{
|
||||
event->type = sfEvtMouseWheelScrolled;
|
||||
event->mouseWheelScroll.wheel = static_cast<sfMouseWheel>(mouseWheelScrolled->wheel);
|
||||
event->mouseWheelScroll.delta = mouseWheelScrolled->delta;
|
||||
event->mouseWheelScroll.x = mouseWheelScrolled->position.x;
|
||||
event->mouseWheelScroll.y = mouseWheelScrolled->position.y;
|
||||
event->type = sfEvtMouseWheelScrolled;
|
||||
event->mouseWheelScroll.wheel = static_cast<sfMouseWheel>(mouseWheelScrolled->wheel);
|
||||
event->mouseWheelScroll.delta = mouseWheelScrolled->delta;
|
||||
event->mouseWheelScroll.position = convertVector2(mouseWheelScrolled->position);
|
||||
}
|
||||
else if (const auto* mouseButtonPressed = sfmlEvent->getIf<sf::Event::MouseButtonPressed>())
|
||||
{
|
||||
event->type = sfEvtMouseButtonPressed;
|
||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonPressed->button);
|
||||
event->mouseButton.x = mouseButtonPressed->position.x;
|
||||
event->mouseButton.y = mouseButtonPressed->position.y;
|
||||
event->type = sfEvtMouseButtonPressed;
|
||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonPressed->button);
|
||||
event->mouseButton.position = convertVector2(mouseButtonPressed->position);
|
||||
}
|
||||
else if (const auto* mouseButtonReleased = sfmlEvent->getIf<sf::Event::MouseButtonReleased>())
|
||||
{
|
||||
event->type = sfEvtMouseButtonReleased;
|
||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonReleased->button);
|
||||
event->mouseButton.x = mouseButtonReleased->position.x;
|
||||
event->mouseButton.y = mouseButtonReleased->position.y;
|
||||
event->type = sfEvtMouseButtonReleased;
|
||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonReleased->button);
|
||||
event->mouseButton.position = convertVector2(mouseButtonReleased->position);
|
||||
}
|
||||
else if (const auto* mouseMoved = sfmlEvent->getIf<sf::Event::MouseMoved>())
|
||||
{
|
||||
event->type = sfEvtMouseMoved;
|
||||
event->mouseMove.x = mouseMoved->position.x;
|
||||
event->mouseMove.y = mouseMoved->position.y;
|
||||
event->type = sfEvtMouseMoved;
|
||||
event->mouseMove.position = convertVector2(mouseMoved->position);
|
||||
}
|
||||
else if (const auto* mouseMovedRaw = sfmlEvent->getIf<sf::Event::MouseMovedRaw>())
|
||||
{
|
||||
event->type = sfEvtMouseMovedRaw;
|
||||
event->mouseMoveRaw.delta = convertVector2(mouseMovedRaw->delta);
|
||||
}
|
||||
else if (sfmlEvent->is<sf::Event::MouseEntered>())
|
||||
{
|
||||
@@ -152,32 +154,27 @@
|
||||
}
|
||||
else if (const auto* touchBegan = sfmlEvent->getIf<sf::Event::TouchBegan>())
|
||||
{
|
||||
event->type = sfEvtTouchBegan;
|
||||
event->touch.finger = touchBegan->finger;
|
||||
event->touch.x = touchBegan->position.x;
|
||||
event->touch.y = touchBegan->position.y;
|
||||
event->type = sfEvtTouchBegan;
|
||||
event->touch.finger = touchBegan->finger;
|
||||
event->touch.position = convertVector2(touchBegan->position);
|
||||
}
|
||||
else if (const auto* touchMoved = sfmlEvent->getIf<sf::Event::TouchMoved>())
|
||||
{
|
||||
event->type = sfEvtTouchMoved;
|
||||
event->touch.finger = touchMoved->finger;
|
||||
event->touch.x = touchMoved->position.x;
|
||||
event->touch.y = touchMoved->position.y;
|
||||
event->type = sfEvtTouchMoved;
|
||||
event->touch.finger = touchMoved->finger;
|
||||
event->touch.position = convertVector2(touchMoved->position);
|
||||
}
|
||||
else if (const auto* touchEnded = sfmlEvent->getIf<sf::Event::TouchEnded>())
|
||||
{
|
||||
event->type = sfEvtTouchEnded;
|
||||
event->touch.finger = touchEnded->finger;
|
||||
event->touch.x = touchEnded->position.x;
|
||||
event->touch.y = touchEnded->position.y;
|
||||
event->type = sfEvtTouchEnded;
|
||||
event->touch.finger = touchEnded->finger;
|
||||
event->touch.position = convertVector2(touchEnded->position);
|
||||
}
|
||||
else if (const auto* sensorChanged = sfmlEvent->getIf<sf::Event::SensorChanged>())
|
||||
{
|
||||
event->type = sfEvtSensorChanged;
|
||||
event->sensor.sensorType = static_cast<sfSensorType>(sensorChanged->type);
|
||||
event->sensor.x = sensorChanged->value.x;
|
||||
event->sensor.y = sensorChanged->value.y;
|
||||
event->sensor.z = sensorChanged->value.z;
|
||||
event->sensor.value = convertVector3(sensorChanged->value);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -14,6 +14,7 @@ set(SRC
|
||||
${SRCROOT}/ConvertColor.hpp
|
||||
${SRCROOT}/ConvertRect.hpp
|
||||
${SRCROOT}/ConvertRenderStates.hpp
|
||||
${SRCROOT}/ConvertStencil.hpp
|
||||
${SRCROOT}/ConvertTransform.hpp
|
||||
${SRCROOT}/ConvexShape.cpp
|
||||
${SRCROOT}/ConvexShapeStruct.hpp
|
||||
@@ -47,6 +48,8 @@ set(SRC
|
||||
${SRCROOT}/Sprite.cpp
|
||||
${SRCROOT}/SpriteStruct.hpp
|
||||
${INCROOT}/Sprite.h
|
||||
${INCROOT}/StencilMode.h
|
||||
${SRCROOT}/StencilMode.cpp
|
||||
${SRCROOT}/Text.cpp
|
||||
${SRCROOT}/TextStruct.hpp
|
||||
${INCROOT}/Text.h
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
|
||||
#include <SFML/Graphics/StencilMode.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Convert sf::StencilValue to sfStencilValue
|
||||
////////////////////////////////////////////////////////////
|
||||
[[nodiscard]] inline sfStencilValue convertStencilValue(const sf::StencilValue value)
|
||||
{
|
||||
return {value.value};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Convert sfStencilValue to sf::StencilValue
|
||||
////////////////////////////////////////////////////////////
|
||||
[[nodiscard]] inline sf::StencilValue convertStencilValue(const sfStencilValue value)
|
||||
{
|
||||
return {value.value};
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Convert sf::StencilMode to sfStencilMode
|
||||
////////////////////////////////////////////////////////////
|
||||
[[nodiscard]] inline sfStencilMode convertStencilMode(const sf::StencilMode value)
|
||||
{
|
||||
return {static_cast<sfStencilComparison>(value.stencilComparison),
|
||||
static_cast<sfStencilUpdateOperation>(value.stencilUpdateOperation),
|
||||
convertStencilValue(value.stencilReference),
|
||||
convertStencilValue(value.stencilMask),
|
||||
value.stencilOnly};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Convert sfStencilMode to sf::StencilMode
|
||||
////////////////////////////////////////////////////////////
|
||||
[[nodiscard]] inline sf::StencilMode convertStencilMode(const sfStencilMode value)
|
||||
{
|
||||
return {static_cast<sf::StencilComparison>(value.stencilComparison),
|
||||
static_cast<sf::StencilUpdateOperation>(value.stencilUpdateOperation),
|
||||
convertStencilValue(value.stencilReference),
|
||||
convertStencilValue(value.stencilMask),
|
||||
value.stencilOnly};
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <CSFML/Graphics/ConvertColor.hpp>
|
||||
#include <CSFML/Graphics/ConvertRect.hpp>
|
||||
#include <CSFML/Graphics/ConvertRenderStates.hpp>
|
||||
#include <CSFML/Graphics/ConvertStencil.hpp>
|
||||
#include <CSFML/Graphics/ConvexShapeStruct.hpp>
|
||||
#include <CSFML/Graphics/RectangleShapeStruct.hpp>
|
||||
#include <CSFML/Graphics/RenderTexture.h>
|
||||
@@ -108,6 +109,22 @@ void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderTexture_clearStencil(sfRenderTexture* renderTexture, sfStencilValue stencilValue)
|
||||
{
|
||||
assert(renderTexture);
|
||||
renderTexture->This.clearStencil(convertStencilValue(stencilValue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderTexture_clearColorAndStencil(sfRenderTexture* renderTexture, sfColor color, sfStencilValue stencilValue)
|
||||
{
|
||||
assert(renderTexture);
|
||||
renderTexture->This.clear(convertColor(color), convertStencilValue(stencilValue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderTexture_setView(sfRenderTexture* renderTexture, const sfView* view)
|
||||
{
|
||||
@@ -143,6 +160,15 @@ sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, cons
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIntRect sfRenderTexture_getScissor(const sfRenderTexture* renderTexture, const sfView* view)
|
||||
{
|
||||
assert(renderTexture);
|
||||
assert(view);
|
||||
return convertRect(renderTexture->This.getScissor(view->This));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2f sfRenderTexture_mapPixelToCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <CSFML/Graphics/ConvertColor.hpp>
|
||||
#include <CSFML/Graphics/ConvertRect.hpp>
|
||||
#include <CSFML/Graphics/ConvertRenderStates.hpp>
|
||||
#include <CSFML/Graphics/ConvertStencil.hpp>
|
||||
#include <CSFML/Graphics/ConvexShapeStruct.hpp>
|
||||
#include <CSFML/Graphics/ImageStruct.hpp>
|
||||
#include <CSFML/Graphics/RectangleShapeStruct.hpp>
|
||||
@@ -149,11 +150,11 @@ bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event)
|
||||
bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfTime timeout, sfEvent* event)
|
||||
{
|
||||
assert(renderWindow);
|
||||
assert(event);
|
||||
return convertEvent(renderWindow->This.waitEvent(), event);
|
||||
return convertEvent(renderWindow->This.waitEvent(sf::microseconds(timeout.microseconds)), event);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +335,22 @@ void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_clearStencil(sfRenderWindow* renderWindow, sfStencilValue stencilValue)
|
||||
{
|
||||
assert(renderWindow);
|
||||
renderWindow->This.clearStencil(convertStencilValue(stencilValue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_clearColorAndStencil(sfRenderWindow* renderWindow, sfColor color, sfStencilValue stencilValue)
|
||||
{
|
||||
assert(renderWindow);
|
||||
renderWindow->This.clear(convertColor(color), convertStencilValue(stencilValue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view)
|
||||
{
|
||||
@@ -369,6 +386,15 @@ sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const s
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIntRect sfRenderWindow_getScissor(const sfRenderWindow* renderWindow, const sfView* view)
|
||||
{
|
||||
assert(renderWindow);
|
||||
assert(view);
|
||||
return convertRect(renderWindow->This.getScissor(view->This));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2f sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2024 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <CSFML/Graphics/StencilMode.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfStencilMode sfStencilMode_default = {sfStencilComparisonAlways, sfStencilUpdateOperationKeep, {0}, {~0u}, false};
|
||||
@@ -48,6 +48,17 @@ sfTexture* sfTexture_create(sfVector2u size)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfTexture* sfTexture_createSrgb(sfVector2u size)
|
||||
{
|
||||
auto texture = std::make_unique<sfTexture>();
|
||||
if (!texture->This->resize(convertVector2(size), true))
|
||||
return nullptr;
|
||||
|
||||
return texture.release();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area)
|
||||
{
|
||||
|
||||
@@ -92,6 +92,14 @@ void sfView_setViewport(sfView* view, sfFloatRect viewport)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfView_setScissor(sfView* view, sfFloatRect scissor)
|
||||
{
|
||||
assert(view);
|
||||
view->This.setScissor(convertRect(scissor));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2f sfView_getCenter(const sfView* view)
|
||||
{
|
||||
@@ -124,6 +132,14 @@ sfFloatRect sfView_getViewport(const sfView* view)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFloatRect sfView_getScissor(const sfView* view)
|
||||
{
|
||||
assert(view);
|
||||
return convertRect(view->This.getScissor());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfView_move(sfView* view, sfVector2f offset)
|
||||
{
|
||||
|
||||
@@ -123,11 +123,11 @@ bool sfWindow_pollEvent(sfWindow* window, sfEvent* event)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfWindow_waitEvent(sfWindow* window, sfEvent* event)
|
||||
bool sfWindow_waitEvent(sfWindow* window, sfTime timeout, sfEvent* event)
|
||||
{
|
||||
assert(window);
|
||||
assert(event);
|
||||
return convertEvent(window->This.waitEvent(), event);
|
||||
return convertEvent(window->This.waitEvent(sf::microseconds(timeout.microseconds)), event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -102,11 +102,11 @@ bool sfWindowBase_pollEvent(sfWindowBase* windowBase, sfEvent* event)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfEvent* event)
|
||||
bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfTime timeout, sfEvent* event)
|
||||
{
|
||||
assert(windowBase);
|
||||
assert(event);
|
||||
return convertEvent(windowBase->This.waitEvent(), event);
|
||||
return convertEvent(windowBase->This.waitEvent(sf::microseconds(timeout.microseconds)), event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user