Deprecated capture(), added mouse grabbing API.

Deprecated: sfImage* sfRenderWindow_capture(const sfRenderWindow*);

Added: sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow*, sfBool);
Added: sfWindow_setMouseCursorGrabbed(sfWindow*, sfBool);

Also reordered some functions according to order in SFML.
This commit is contained in:
Alec Iverson committed 2016-08-10 11:34:51 -07:00
1 parent 21e8e0523f
commit ce5e3a3891
4 files changed
+119 -66

No files matched your search

+54 -30
View File
@@ -208,6 +208,15 @@ CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, uns
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible);
////////////////////////////////////////////////////////////
/// \brief Enable / disable vertical synchronization on a render window
///
/// \param renderWindow Render window object
/// \param enabled sfTrue to enable v-sync, sfFalse to deactivate
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);
////////////////////////////////////////////////////////////
/// \brief Show or hide the mouse cursor on a render window
///
@@ -218,13 +227,19 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow,
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show);
////////////////////////////////////////////////////////////
/// \brief Enable / disable vertical synchronization on a render window
/// \brief Grab or release the mouse cursor
///
/// \param renderWindow Render window object
/// \param enabled sfTrue to enable v-sync, sfFalse to deactivate
/// If set, grabs the mouse cursor inside this window's client
/// area so it may no longer be moved outside its bounds.
/// Note that grabbing is only active while the window has
/// focus and calling this function for fullscreen windows
/// won't have any effect (fullscreen windows always grab the
/// cursor).
///
/// \param grabbed sfTrue to enable, sfFalse to disable
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat for keydown events
@@ -237,6 +252,24 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* re
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency for a render window
///
/// \param renderWindow Render window object
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);
////////////////////////////////////////////////////////////
/// \brief Change the joystick threshold, ie. the value below which no move event will be generated
///
/// \param renderWindow Render window object
/// \param threshold New threshold, in range [0, 100]
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate a render window as the current target for rendering
///
@@ -282,24 +315,6 @@ CSFML_GRAPHICS_API sfBool sfRenderWindow_hasFocus(const sfRenderWindow* renderWi
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency for a render window
///
/// \param renderWindow Render window object
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);
////////////////////////////////////////////////////////////
/// \brief Change the joystick threshold, ie. the value below which no move event will be generated
///
/// \param renderWindow Render window object
/// \param threshold New threshold, in range [0, 100]
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
////////////////////////////////////////////////////////////
/// \brief Retrieve the OS-specific handle of a render window
///
@@ -494,22 +509,31 @@ CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow)
CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Copy the current contents of a render window to an image
/// \brief Copy the current contents of the window to an image
///
/// \deprecated
/// Use a sfTexture and its
/// sfTexture_updateFromRenderWindow(sfTexture*, const sfRenderWindow*, unsigned int, unsigned int)
/// function and copy its contents into an sfImage instead.
/// \code
/// sfVector2u windowSize = sfRenderWindow_getSize(window);
/// sfTexture* texture = sfTexture_create(windowSize.x, windowSize.y);
/// sfTexture_updateFromRenderWindow(texture, window, windowSize.x, windowSize.y);
/// sfImage* screenshot = sfTexture_copyToImage(texture);
/// \endcode
///
/// This is a slow operation, whose main purpose is to make
/// screenshots of the application. If you want to update an
/// image with the contents of the window and then use it for
/// drawing, you should rather use a sfTexture and its
/// update(sfWindow*) function.
/// drawing, you should rather use a sfTexture and the
/// sfTexture_updateFromWindow(sfTexture*, const sfWindow*, unsigned int, unsigned int) function.
/// You can also draw things directly to a texture with the
/// sfRenderWindow class.
/// sfRenderTexture class.
///
/// \param renderWindow Render window object
///
/// \return New image containing the captured contents
/// \return sfImage containing the captured contents.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
CSFML_GRAPHICS_API CSFML_DEPRECATED sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the mouse relative to a render-window
+49 -34
View File
@@ -315,15 +315,6 @@ CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, uns
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setVisible(sfWindow* window, sfBool visible);
////////////////////////////////////////////////////////////
/// \brief Show or hide the mouse cursor
///
/// \param window Window object
/// \param visible sfTrue to show, sfFalse to hide
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible);
////////////////////////////////////////////////////////////
/// \brief Enable or disable vertical synchronization
///
@@ -338,6 +329,30 @@ CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool vi
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled);
////////////////////////////////////////////////////////////
/// \brief Show or hide the mouse cursor
///
/// \param window Window object
/// \param visible sfTrue to show, sfFalse to hide
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible);
////////////////////////////////////////////////////////////
/// \brief Grab or release the mouse cursor
///
/// If set, grabs the mouse cursor inside this window's client
/// area so it may no longer be moved outside its bounds.
/// Note that grabbing is only active while the window has
/// focus and calling this function for fullscreen windows
/// won't have any effect (fullscreen windows always grab the
/// cursor).
///
/// \param grabbed sfTrue to enable, sfFalse to disable
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat
///
@@ -353,6 +368,31 @@ CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool e
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency
///
/// If a limit is set, the window will use a small delay after
/// each call to sfWindow_display to ensure that the current frame
/// lasted long enough to match the framerate limit.
///
/// \param window Window object
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
////////////////////////////////////////////////////////////
/// \brief Change the joystick threshold
///
/// The joystick threshold is the value below which
/// no JoyMoved event will be generated.
///
/// \param window Window object
/// \param threshold New threshold, in the range [0, 100]
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow* window, float threshold);
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate a window as the current target
/// for OpenGL rendering
@@ -411,31 +451,6 @@ CSFML_WINDOW_API sfBool sfWindow_hasFocus(const sfWindow* window);
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_display(sfWindow* window);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency
///
/// If a limit is set, the window will use a small delay after
/// each call to sfWindow_display to ensure that the current frame
/// lasted long enough to match the framerate limit.
///
/// \param window Window object
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
////////////////////////////////////////////////////////////
/// \brief Change the joystick threshold
///
/// The joystick threshold is the value below which
/// no JoyMoved event will be generated.
///
/// \param window Window object
/// \param threshold New threshold, in the range [0, 100]
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow* window, float threshold);
////////////////////////////////////////////////////////////
/// \brief Get the OS-specific handle of the window
///
+9 -2
View File
@@ -272,6 +272,13 @@ void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible)
}
////////////////////////////////////////////////////////////
void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled)
{
CSFML_CALL(renderWindow, setVerticalSyncEnabled(enabled == sfTrue));
}
////////////////////////////////////////////////////////////
void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool visible)
{
@@ -280,9 +287,9 @@ void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool v
////////////////////////////////////////////////////////////
void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled)
void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed)
{
CSFML_CALL(renderWindow, setVerticalSyncEnabled(enabled == sfTrue));
CSFML_CALL(renderWindow, setMouseCursorGrabbed(grabbed == sfTrue));
}
+7
View File
@@ -262,6 +262,13 @@ void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible)
}
////////////////////////////////////////////////////////////
void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed)
{
CSFML_CALL(window, setMouseCursorGrabbed(grabbed == sfTrue));
}
////////////////////////////////////////////////////////////
void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled)
{