diff --git a/doc/mainpage.hpp b/doc/mainpage.hpp index bf9e91a..5ba955a 100644 --- a/doc/mainpage.hpp +++ b/doc/mainpage.hpp @@ -17,7 +17,7 @@ /// /// int main() /// { -/// sfVideoMode mode = {800, 600, 32}; +/// sfVideoMode mode = {{800, 600}, 32}; /// sfRenderWindow* window; /// sfTexture* texture; /// sfSprite* sprite; diff --git a/examples/example.c b/examples/example.c index 0432ca7..9e07297 100644 --- a/examples/example.c +++ b/examples/example.c @@ -6,7 +6,7 @@ int main(void) { // Create the main window - const sfVideoMode mode = {800, 600, 32}; + const sfVideoMode mode = {{800, 600}, 32}; sfRenderWindow* window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, sfWindowed, NULL); if (!window) return EXIT_FAILURE; diff --git a/include/CSFML/Graphics/Image.h b/include/CSFML/Graphics/Image.h index aa9476f..f784064 100644 --- a/include/CSFML/Graphics/Image.h +++ b/include/CSFML/Graphics/Image.h @@ -42,25 +42,23 @@ /// /// This image is filled with black pixels. /// -/// \param width Width of the image -/// \param height Height of the image +/// \param size Size of the image /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfImage* sfImage_create(unsigned int width, unsigned int height); +CSFML_GRAPHICS_API sfImage* sfImage_create(sfVector2u size); //////////////////////////////////////////////////////////// /// \brief Create an image and fill it with a unique color /// -/// \param width Width of the image -/// \param height Height of the image -/// \param color Fill color +/// \param size Size of the image +/// \param color Fill color /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color); +CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(sfVector2u size, sfColor color); //////////////////////////////////////////////////////////// /// \brief Create an image from an array of pixels @@ -70,14 +68,13 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(unsigned int width, unsigned /// an undefined behaviour. /// If \a pixels is null, an empty image is created. /// -/// \param width Width of the image -/// \param height Height of the image +/// \param size Size of the image /// \param pixels Array of pixels to copy to the image /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const uint8_t* pixels); +CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(sfVector2u size, const uint8_t* pixels); //////////////////////////////////////////////////////////// /// \brief Create an image from a file on disk @@ -219,15 +216,14 @@ CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfImage* image, sfColor colo /// /// \param image Image object /// \param source Source image to copy -/// \param destX X coordinate of the destination position -/// \param destY Y coordinate of the destination position +/// \param dest Coordinates of the destination position /// \param sourceRect Sub-rectangle of the source image to copy /// \param applyAlpha Should the copy take in account the source transparency? /// /// \return True if the operation was successful, false otherwise /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API bool sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, bool applyAlpha); +CSFML_GRAPHICS_API bool sfImage_copyImage(sfImage* image, const sfImage* source, sfVector2u dest, sfIntRect sourceRect, bool applyAlpha); //////////////////////////////////////////////////////////// /// \brief Change the color of a pixel in an image @@ -236,13 +232,12 @@ CSFML_GRAPHICS_API bool sfImage_copyImage(sfImage* image, const sfImage* source, /// coordinates, using out-of-range values will result in /// an undefined behaviour. /// -/// \param image Image object -/// \param x X coordinate of pixel to change -/// \param y Y coordinate of pixel to change -/// \param color New color of the pixel +/// \param image Image object +/// \param coords Coordinates of pixel to change +/// \param color New color of the pixel /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color); +CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, sfVector2u coords, sfColor color); //////////////////////////////////////////////////////////// /// \brief Get the color of a pixel in an image @@ -251,14 +246,13 @@ CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, unsigned int x, unsigne /// coordinates, using out-of-range values will result in /// an undefined behaviour. /// -/// \param image Image object -/// \param x X coordinate of pixel to get -/// \param y Y coordinate of pixel to get +/// \param image Image object +/// \param coords Coordinates of pixel to get /// /// \return Color of the pixel at coordinates (x, y) /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, sfVector2u coords); //////////////////////////////////////////////////////////// /// \brief Get a read-only pointer to the array of pixels of an image diff --git a/include/CSFML/Graphics/Rect.h b/include/CSFML/Graphics/Rect.h index de68924..6d7a27f 100644 --- a/include/CSFML/Graphics/Rect.h +++ b/include/CSFML/Graphics/Rect.h @@ -51,15 +51,14 @@ typedef struct //////////////////////////////////////////////////////////// /// \brief Check if a point is inside a rectangle's area /// -/// \param rect Rectangle to test -/// \param x X coordinate of the point to test -/// \param y Y coordinate of the point to test +/// \param rect Rectangle to test +/// \param point Coordinates of the point to test /// /// \return true if the point is inside /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API bool sfFloatRect_contains(const sfFloatRect* rect, float x, float y); -CSFML_GRAPHICS_API bool sfIntRect_contains(const sfIntRect* rect, int x, int y); +CSFML_GRAPHICS_API bool sfFloatRect_contains(const sfFloatRect* rect, sfVector2f point); +CSFML_GRAPHICS_API bool sfIntRect_contains(const sfIntRect* rect, sfVector2i point); //////////////////////////////////////////////////////////// /// \brief Check intersection between two rectangles diff --git a/include/CSFML/Graphics/RenderTexture.h b/include/CSFML/Graphics/RenderTexture.h index 786e88c..a2687f7 100644 --- a/include/CSFML/Graphics/RenderTexture.h +++ b/include/CSFML/Graphics/RenderTexture.h @@ -42,14 +42,13 @@ //////////////////////////////////////////////////////////// /// \brief Construct a new render texture /// -/// \param width Width of the render texture -/// \param height Height of the render texture +/// \param size Size of the render texture /// \param settings Settings of the render texture /// /// \return A new sfRenderTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, const sfContextSettings* settings); +CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(sfVector2u size, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Destroy an existing render texture diff --git a/include/CSFML/Graphics/RenderWindow.h b/include/CSFML/Graphics/RenderWindow.h index cf8116a..f811d9b 100644 --- a/include/CSFML/Graphics/RenderWindow.h +++ b/include/CSFML/Graphics/RenderWindow.h @@ -201,12 +201,11 @@ CSFML_GRAPHICS_API void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWin /// \brief Change a render window's icon /// /// \param renderWindow Render window object -/// \param width Icon's width, in pixels -/// \param height Icon's height, in pixels +/// \param size Icon's size, in pixels /// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const uint8_t* pixels); +CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, sfVector2u size, const uint8_t* pixels); //////////////////////////////////////////////////////////// /// \brief Show or hide a render window diff --git a/include/CSFML/Graphics/Texture.h b/include/CSFML/Graphics/Texture.h index 232c1f6..4876a4a 100644 --- a/include/CSFML/Graphics/Texture.h +++ b/include/CSFML/Graphics/Texture.h @@ -48,13 +48,12 @@ typedef enum //////////////////////////////////////////////////////////// /// \brief Create a new texture /// -/// \param width Texture width -/// \param height Texture height +/// \param size Texture size /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int height); +CSFML_GRAPHICS_API sfTexture* sfTexture_create(sfVector2u size); //////////////////////////////////////////////////////////// /// \brief Create a new texture from a file @@ -201,13 +200,11 @@ CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture); /// /// \param texture Texture to update /// \param pixels Array of pixels to copy to the texture -/// \param width Width of the pixel region contained in \a pixels -/// \param height Height of the pixel region contained in \a pixels -/// \param x X offset in the texture where to copy the source pixels -/// \param y Y offset in the texture where to copy the source pixels +/// \param size size of the pixel region contained in \a pixels +/// \param offset Offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset); //////////////////////////////////////////////////////////// /// \brief Update a part of this texture from another texture @@ -221,44 +218,40 @@ CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const uin /// /// \param destination Destination texture to copy source texture to /// \param source Source texture to copy to destination texture -/// \param x X offset in this texture where to copy the source texture -/// \param y Y offset in this texture where to copy the source texture +/// \param offset Offset in this texture where to copy the source texture /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, sfVector2u offset); //////////////////////////////////////////////////////////// /// \brief Update a texture from an image /// /// \param texture Texture to update /// \param image Image to copy to the texture -/// \param x X offset in the texture where to copy the source pixels -/// \param y Y offset in the texture where to copy the source pixels +/// \param offset Offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, sfVector2u offset); //////////////////////////////////////////////////////////// /// \brief Update a texture from the contents of a window /// /// \param texture Texture to update /// \param window Window to copy to the texture -/// \param x X offset in the texture where to copy the source pixels -/// \param y Y offset in the texture where to copy the source pixels +/// \param offset Offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, sfVector2u offset); //////////////////////////////////////////////////////////// /// \brief Update a texture from the contents of a render-window /// /// \param texture Texture to update /// \param renderWindow Render-window to copy to the texture -/// \param x X offset in the texture where to copy the source pixels -/// \param y Y offset in the texture where to copy the source pixels +/// \param offset Offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y); +CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, sfVector2u offset); //////////////////////////////////////////////////////////// /// \brief Enable or disable the smooth filter on a texture diff --git a/include/CSFML/Graphics/Transform.h b/include/CSFML/Graphics/Transform.h index da89d85..88a26e2 100644 --- a/include/CSFML/Graphics/Transform.h +++ b/include/CSFML/Graphics/Transform.h @@ -147,11 +147,10 @@ CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTran /// \brief Combine a transform with a translation /// /// \param transform Transform object -/// \param x Offset to apply on X axis -/// \param y Offset to apply on Y axis +/// \param offset Offset to apply /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTransform_translate(sfTransform* transform, float x, float y); +CSFML_GRAPHICS_API void sfTransform_translate(sfTransform* transform, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a rotation @@ -172,21 +171,19 @@ CSFML_GRAPHICS_API void sfTransform_rotate(sfTransform* transform, float angle); /// /// \param transform Transform object /// \param angle Rotation angle, in degrees -/// \param centerX X coordinate of the center of rotation -/// \param centerY Y coordinate of the center of rotation +/// \param center Coordinates of the center of rotation /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY); +CSFML_GRAPHICS_API void sfTransform_rotateWithCenter(sfTransform* transform, float angle, sfVector2f center); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a scaling /// /// \param transform Transform object -/// \param scaleX Scaling factor on the X axis -/// \param scaleY Scaling factor on the Y axis +/// \param scale Scaling factor /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY); +CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a scaling @@ -197,13 +194,11 @@ CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX, /// [translate(-center), scale(factors), translate(center)] /// /// \param transform Transform object -/// \param scaleX Scaling factor on X axis -/// \param scaleY Scaling factor on Y axis -/// \param centerX X coordinate of the center of scaling -/// \param centerY Y coordinate of the center of scaling +/// \param scale Scaling factor +/// \param center Coordinates of the center of scaling /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY); +CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, sfVector2f scale, sfVector2f center); //////////////////////////////////////////////////////////// /// \brief Compare two transforms for equality diff --git a/include/CSFML/Window/VideoMode.h b/include/CSFML/Window/VideoMode.h index 6a0bbc6..79a3b97 100644 --- a/include/CSFML/Window/VideoMode.h +++ b/include/CSFML/Window/VideoMode.h @@ -28,6 +28,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include @@ -39,8 +40,7 @@ //////////////////////////////////////////////////////////// typedef struct { - unsigned int width; ///< Video mode width, in pixels - unsigned int height; ///< Video mode height, in pixels + sfVector2u size; ///< Video mode size, in pixels unsigned int bitsPerPixel; ///< Video mode pixel depth, in bits per pixels } sfVideoMode; diff --git a/include/CSFML/Window/Window.h b/include/CSFML/Window/Window.h index 81a1904..5975ccb 100644 --- a/include/CSFML/Window/Window.h +++ b/include/CSFML/Window/Window.h @@ -287,12 +287,11 @@ CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow* window, const sfChar32* /// in 32-bits RGBA format. /// /// \param window Window object -/// \param width Icon's width, in pixels -/// \param height Icon's height, in pixels +/// \param size Icon's size, in pixels /// \param pixels Pointer to the array of pixels in memory /// //////////////////////////////////////////////////////////// -CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const uint8_t* pixels); +CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, sfVector2u size, const uint8_t* pixels); //////////////////////////////////////////////////////////// /// \brief Show or hide a window diff --git a/include/CSFML/Window/WindowBase.h b/include/CSFML/Window/WindowBase.h index ad4deb8..1ff0787 100644 --- a/include/CSFML/Window/WindowBase.h +++ b/include/CSFML/Window/WindowBase.h @@ -250,12 +250,11 @@ CSFML_WINDOW_API void sfWindowBase_setUnicodeTitle(sfWindowBase* windowBase, con /// in 32-bits RGBA format. /// /// \param windowBase Window object -/// \param width Icon's width, in pixels -/// \param height Icon's height, in pixels +/// \param size Icon's size, in pixels /// \param pixels Pointer to the array of pixels in memory /// //////////////////////////////////////////////////////////// -CSFML_WINDOW_API void sfWindowBase_setIcon(sfWindowBase* windowBase, unsigned int width, unsigned int height, const uint8_t* pixels); +CSFML_WINDOW_API void sfWindowBase_setIcon(sfWindowBase* windowBase, sfVector2u size, const uint8_t* pixels); //////////////////////////////////////////////////////////// /// \brief Show or hide a window diff --git a/src/CSFML/Graphics/Image.cpp b/src/CSFML/Graphics/Image.cpp index 7f76e05..a9e8e7a 100644 --- a/src/CSFML/Graphics/Image.cpp +++ b/src/CSFML/Graphics/Image.cpp @@ -36,23 +36,23 @@ //////////////////////////////////////////////////////////// -sfImage* sfImage_create(unsigned int width, unsigned int height) +sfImage* sfImage_create(sfVector2u size) { - return new sfImage{sf::Image(sf::Vector2u(width, height))}; + return new sfImage{sf::Image(convertVector2(size))}; } //////////////////////////////////////////////////////////// -sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color) +sfImage* sfImage_createFromColor(sfVector2u size, sfColor color) { - return new sfImage{sf::Image({ width, height }, convertColor(color))}; + return new sfImage{sf::Image(convertVector2(size), convertColor(color))}; } //////////////////////////////////////////////////////////// -sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const uint8_t* data) +sfImage* sfImage_createFromPixels(sfVector2u size, const uint8_t* data) { - return new sfImage{sf::Image({ width, height }, data)}; + return new sfImage{sf::Image(convertVector2(size), data)}; } @@ -141,28 +141,28 @@ void sfImage_createMaskFromColor(sfImage* image, sfColor colorKey, uint8_t alpha //////////////////////////////////////////////////////////// -bool sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, bool applyAlpha) +bool sfImage_copyImage(sfImage* image, const sfImage* source, sfVector2u dest, sfIntRect sourceRect, bool applyAlpha) { CSFML_CHECK_RETURN(image, false); CSFML_CHECK_RETURN(source, false); - return image->This.copy(source->This, { destX, destY }, convertRect(sourceRect), applyAlpha); + return image->This.copy(source->This, convertVector2(dest), convertRect(sourceRect), applyAlpha); } //////////////////////////////////////////////////////////// -void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color) +void sfImage_setPixel(sfImage* image, sfVector2u coords, sfColor color) { - CSFML_CALL(image, setPixel({ x, y }, convertColor(color))); + CSFML_CALL(image, setPixel(convertVector2(coords), convertColor(color))); } //////////////////////////////////////////////////////////// -sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y) +sfColor sfImage_getPixel(const sfImage* image, sfVector2u coords) { CSFML_CHECK_RETURN(image, {}); - return convertColor(image->This.getPixel({ x, y })); + return convertColor(image->This.getPixel(convertVector2(coords))); } diff --git a/src/CSFML/Graphics/Rect.cpp b/src/CSFML/Graphics/Rect.cpp index eb7f77c..34d3064 100644 --- a/src/CSFML/Graphics/Rect.cpp +++ b/src/CSFML/Graphics/Rect.cpp @@ -28,21 +28,22 @@ #include #include #include +#include #include //////////////////////////////////////////////////////////// /// Check if a point is inside a rectangle's area //////////////////////////////////////////////////////////// -bool sfFloatRect_contains(const sfFloatRect* rect, float x, float y) +bool sfFloatRect_contains(const sfFloatRect* rect, sfVector2f point) { CSFML_CHECK_RETURN(rect, false); - return convertRect(*rect).contains({ x, y }); + return convertRect(*rect).contains(convertVector2(point)); } -bool sfIntRect_contains(const sfIntRect* rect, int x, int y) +bool sfIntRect_contains(const sfIntRect* rect, sfVector2i point) { CSFML_CHECK_RETURN(rect, false); - return convertRect(*rect).contains({ x, y }); + return convertRect(*rect).contains(convertVector2(point)); } diff --git a/src/CSFML/Graphics/RenderTexture.cpp b/src/CSFML/Graphics/RenderTexture.cpp index a416e3c..2725d1a 100644 --- a/src/CSFML/Graphics/RenderTexture.cpp +++ b/src/CSFML/Graphics/RenderTexture.cpp @@ -44,14 +44,14 @@ //////////////////////////////////////////////////////////// -sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, const sfContextSettings* settings) +sfRenderTexture* sfRenderTexture_create(sfVector2u size, const sfContextSettings* settings) { // Convert context settings const sf::ContextSettings params = settings ? convertContextSettings(*settings) : sf::ContextSettings(); // Create the render texture sf::RenderTexture renderTexture; - if (!renderTexture.resize({ width, height }, params)) + if (!renderTexture.resize(convertVector2(size), params)) return nullptr; auto* texture = new sfTexture(const_cast(&renderTexture.getTexture())); diff --git a/src/CSFML/Graphics/RenderWindow.cpp b/src/CSFML/Graphics/RenderWindow.cpp index 2e13fab..e2dcae9 100644 --- a/src/CSFML/Graphics/RenderWindow.cpp +++ b/src/CSFML/Graphics/RenderWindow.cpp @@ -220,9 +220,9 @@ void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfChar32 //////////////////////////////////////////////////////////// -void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const uint8_t* pixels) +void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, sfVector2u size, const uint8_t* pixels) { - CSFML_CALL(renderWindow, setIcon({ width, height }, pixels)); + CSFML_CALL(renderWindow, setIcon(convertVector2(size), pixels)); } diff --git a/src/CSFML/Graphics/Texture.cpp b/src/CSFML/Graphics/Texture.cpp index 173e63c..1ce8277 100644 --- a/src/CSFML/Graphics/Texture.cpp +++ b/src/CSFML/Graphics/Texture.cpp @@ -37,11 +37,11 @@ //////////////////////////////////////////////////////////// -sfTexture* sfTexture_create(unsigned int width, unsigned int height) +sfTexture* sfTexture_create(sfVector2u size) { sfTexture* texture = new sfTexture; - if (!texture->This->resize({ width, height })) + if (!texture->This->resize(convertVector2(size))) { delete texture; texture = nullptr; @@ -227,46 +227,46 @@ sfImage* sfTexture_copyToImage(const sfTexture* texture) //////////////////////////////////////////////////////////// -void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y) +void sfTexture_updateFromPixels(sfTexture* texture, const uint8_t* pixels, sfVector2u size, sfVector2u offset) { - CSFML_CALL_PTR(texture, update(pixels, { width, height }, { x, y })); + CSFML_CALL_PTR(texture, update(pixels, convertVector2(size), convertVector2(offset))); } //////////////////////////////////////////////////////////// -void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* texture, unsigned int x, unsigned int y) +void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* texture, sfVector2u offset) { CSFML_CHECK(texture); CSFML_CHECK(texture->This); - CSFML_CALL_PTR(destination, update(*texture->This, { x, y })); + CSFML_CALL_PTR(destination, update(*texture->This, convertVector2(offset))); } //////////////////////////////////////////////////////////// -void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y) +void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, sfVector2u offset) { CSFML_CHECK(image); - CSFML_CALL_PTR(texture, update(image->This, { x, y })); + CSFML_CALL_PTR(texture, update(image->This, convertVector2(offset))); } //////////////////////////////////////////////////////////// -void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y) +void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, sfVector2u offset) { CSFML_CHECK(window); - CSFML_CALL_PTR(texture, update(window->This, { x, y })); + CSFML_CALL_PTR(texture, update(window->This, convertVector2(offset))); } //////////////////////////////////////////////////////////// -void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y) +void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, sfVector2u offset) { CSFML_CHECK(renderWindow); - CSFML_CALL_PTR(texture, update(renderWindow->This, { x, y })); + CSFML_CALL_PTR(texture, update(renderWindow->This, convertVector2(offset))); } diff --git a/src/CSFML/Graphics/Transform.cpp b/src/CSFML/Graphics/Transform.cpp index bfaa25e..c24f5bc 100644 --- a/src/CSFML/Graphics/Transform.cpp +++ b/src/CSFML/Graphics/Transform.cpp @@ -102,11 +102,11 @@ void sfTransform_combine(sfTransform* transform, const sfTransform* other) //////////////////////////////////////////////////////////// -void sfTransform_translate(sfTransform* transform, float x, float y) +void sfTransform_translate(sfTransform* transform, sfVector2f offset) { CSFML_CHECK(transform); - *transform = convertTransform(convertTransform(*transform).translate({ x, y })); + *transform = convertTransform(convertTransform(*transform).translate(convertVector2(offset))); } @@ -120,29 +120,29 @@ void sfTransform_rotate(sfTransform* transform, float angle) //////////////////////////////////////////////////////////// -void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY) +void sfTransform_rotateWithCenter(sfTransform* transform, float angle, sfVector2f center) { CSFML_CHECK(transform); - *transform = convertTransform(convertTransform(*transform).rotate(sf::degrees(angle), { centerX, centerY })); + *transform = convertTransform(convertTransform(*transform).rotate(sf::degrees(angle), convertVector2(center))); } //////////////////////////////////////////////////////////// -void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY) +void sfTransform_scale(sfTransform* transform, sfVector2f scale) { CSFML_CHECK(transform); - *transform = convertTransform(convertTransform(*transform).scale({ scaleX, scaleY })); + *transform = convertTransform(convertTransform(*transform).scale(convertVector2(scale))); } //////////////////////////////////////////////////////////// -void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY) +void sfTransform_scaleWithCenter(sfTransform* transform, sfVector2f scale, sfVector2f center) { CSFML_CHECK(transform); - *transform = convertTransform(convertTransform(*transform).scale({ scaleX, scaleY }, { centerX, centerY })); + *transform = convertTransform(convertTransform(*transform).scale(convertVector2(scale), convertVector2(center))); } diff --git a/src/CSFML/Window/ConvertVideoMode.hpp b/src/CSFML/Window/ConvertVideoMode.hpp index 4dd0710..74b56c5 100644 --- a/src/CSFML/Window/ConvertVideoMode.hpp +++ b/src/CSFML/Window/ConvertVideoMode.hpp @@ -36,7 +36,7 @@ //////////////////////////////////////////////////////////// [[nodiscard]] inline sfVideoMode convertVideoMode(const sf::VideoMode& videoMode) { - return {videoMode.size.x, videoMode.size.y, videoMode.bitsPerPixel}; + return {{videoMode.size.x, videoMode.size.y}, videoMode.bitsPerPixel}; } @@ -45,5 +45,5 @@ //////////////////////////////////////////////////////////// [[nodiscard]] inline sf::VideoMode convertVideoMode(const sfVideoMode& videoMode) { - return sf::VideoMode({videoMode.width, videoMode.height}, videoMode.bitsPerPixel); + return sf::VideoMode({videoMode.size.x, videoMode.size.y}, videoMode.bitsPerPixel); } diff --git a/src/CSFML/Window/Window.cpp b/src/CSFML/Window/Window.cpp index 5f3ef04..302c9d6 100644 --- a/src/CSFML/Window/Window.cpp +++ b/src/CSFML/Window/Window.cpp @@ -192,9 +192,9 @@ void sfWindow_setUnicodeTitle(sfWindow* window, const sfChar32* title) //////////////////////////////////////////////////////////// -void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const uint8_t* pixels) +void sfWindow_setIcon(sfWindow* window, sfVector2u size, const uint8_t* pixels) { - CSFML_CALL(window, setIcon({ width, height }, pixels)); + CSFML_CALL(window, setIcon(convertVector2(size), pixels)); } diff --git a/src/CSFML/Window/WindowBase.cpp b/src/CSFML/Window/WindowBase.cpp index c8faf41..7fa599b 100644 --- a/src/CSFML/Window/WindowBase.cpp +++ b/src/CSFML/Window/WindowBase.cpp @@ -176,9 +176,9 @@ void sfWindowBase_setUnicodeTitle(sfWindowBase* windowBase, const sfChar32* titl //////////////////////////////////////////////////////////// -void sfWindowBase_setIcon(sfWindowBase* windowBase, unsigned int width, unsigned int height, const uint8_t* pixels) +void sfWindowBase_setIcon(sfWindowBase* windowBase, sfVector2u size, const uint8_t* pixels) { - CSFML_CALL(windowBase, setIcon({ width, height }, pixels)); + CSFML_CALL(windowBase, setIcon(convertVector2(size), pixels)); }