CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 3.0.0
Loading...
Searching...
No Matches
Shape.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Graphics/Export.h>
31
32#include <CSFML/Graphics/Color.h>
33#include <CSFML/Graphics/Rect.h>
34#include <CSFML/Graphics/Transform.h>
35#include <CSFML/Graphics/Types.h>
36#include <CSFML/System/Vector2.h>
37
38#include <stddef.h>
39
40
41 typedef size_t (*sfShapeGetPointCountCallback)(void*);
42 typedef sfVector2f (*sfShapeGetPointCallback)(size_t, void*);
43
54 CSFML_GRAPHICS_API sfShape* sfShape_create(sfShapeGetPointCountCallback getPointCount,
55 sfShapeGetPointCallback getPoint,
56 void* userData);
57
64 CSFML_GRAPHICS_API void sfShape_destroy(const sfShape* shape);
65
77 CSFML_GRAPHICS_API void sfShape_setPosition(sfShape* shape, sfVector2f position);
78
90 CSFML_GRAPHICS_API void sfShape_setRotation(sfShape* shape, float angle);
91
103 CSFML_GRAPHICS_API void sfShape_setScale(sfShape* shape, sfVector2f scale);
104
119 CSFML_GRAPHICS_API void sfShape_setOrigin(sfShape* shape, sfVector2f origin);
120
129 CSFML_GRAPHICS_API sfVector2f sfShape_getPosition(const sfShape* shape);
130
141 CSFML_GRAPHICS_API float sfShape_getRotation(const sfShape* shape);
142
151 CSFML_GRAPHICS_API sfVector2f sfShape_getScale(const sfShape* shape);
152
161 CSFML_GRAPHICS_API sfVector2f sfShape_getOrigin(const sfShape* shape);
162
173 CSFML_GRAPHICS_API void sfShape_move(sfShape* shape, sfVector2f offset);
174
185 CSFML_GRAPHICS_API void sfShape_rotate(sfShape* shape, float angle);
186
197 CSFML_GRAPHICS_API void sfShape_scale(sfShape* shape, sfVector2f factors);
198
207 CSFML_GRAPHICS_API sfTransform sfShape_getTransform(const sfShape* shape);
208
217 CSFML_GRAPHICS_API sfTransform sfShape_getInverseTransform(const sfShape* shape);
218
238 CSFML_GRAPHICS_API void sfShape_setTexture(sfShape* shape, const sfTexture* texture, bool resetRect);
239
251 CSFML_GRAPHICS_API void sfShape_setTextureRect(sfShape* shape, sfIntRect rect);
252
267 CSFML_GRAPHICS_API void sfShape_setFillColor(sfShape* shape, sfColor color);
268
279 CSFML_GRAPHICS_API void sfShape_setOutlineColor(sfShape* shape, sfColor color);
280
292 CSFML_GRAPHICS_API void sfShape_setOutlineThickness(sfShape* shape, float thickness);
293
306 CSFML_GRAPHICS_API const sfTexture* sfShape_getTexture(const sfShape* shape);
307
316 CSFML_GRAPHICS_API sfIntRect sfShape_getTextureRect(const sfShape* shape);
317
326 CSFML_GRAPHICS_API sfColor sfShape_getFillColor(const sfShape* shape);
327
336 CSFML_GRAPHICS_API sfColor sfShape_getOutlineColor(const sfShape* shape);
337
346 CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
347
356 CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
357
369 CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
370
383 CSFML_GRAPHICS_API sfVector2f sfShape_getGeometricCenter(const sfShape* shape);
384
399 CSFML_GRAPHICS_API sfFloatRect sfShape_getLocalBounds(const sfShape* shape);
400
415 CSFML_GRAPHICS_API sfFloatRect sfShape_getGlobalBounds(const sfShape* shape);
416
425 CSFML_GRAPHICS_API void sfShape_update(sfShape* shape);
Color.h
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:42
Types.h
sfTexture
struct sfTexture sfTexture
Definition Graphics/Types.h:39
sfShape
struct sfShape sfShape
Definition Graphics/Types.h:36
Rect.h
sfShape_update
void sfShape_update(sfShape *shape)
Recompute the internal geometry of a shape.
sfShape_getPoint
sfVector2f sfShape_getPoint(const sfShape *shape, size_t index)
Get a point of a shape.
sfShape_setOutlineThickness
void sfShape_setOutlineThickness(sfShape *shape, float thickness)
Set the thickness of a shape's outline.
sfShape_getTextureRect
sfIntRect sfShape_getTextureRect(const sfShape *shape)
Get the sub-rectangle of the texture displayed by a shape.
sfShape_scale
void sfShape_scale(sfShape *shape, sfVector2f factors)
Scale a shape.
sfShape_rotate
void sfShape_rotate(sfShape *shape, float angle)
Rotate a shape.
sfShape_getTransform
sfTransform sfShape_getTransform(const sfShape *shape)
Get the combined transform of a shape.
sfShape_getFillColor
sfColor sfShape_getFillColor(const sfShape *shape)
Get the fill color of a shape.
sfShapeGetPointCallback
sfVector2f(* sfShapeGetPointCallback)(size_t, void *)
Type of the callback used to get a point of a shape.
Definition Shape.h:42
sfShape_getInverseTransform
sfTransform sfShape_getInverseTransform(const sfShape *shape)
Get the inverse of the combined transform of a shape.
sfShape_setFillColor
void sfShape_setFillColor(sfShape *shape, sfColor color)
Set the fill color of a shape.
sfShape_setOutlineColor
void sfShape_setOutlineColor(sfShape *shape, sfColor color)
Set the outline color of a shape.
sfShape_getRotation
float sfShape_getRotation(const sfShape *shape)
Get the orientation of a shape.
sfShape_move
void sfShape_move(sfShape *shape, sfVector2f offset)
Move a shape by a given offset.
sfShape_getPointCount
size_t sfShape_getPointCount(const sfShape *shape)
Get the total number of points of a shape.
sfShape_getPosition
sfVector2f sfShape_getPosition(const sfShape *shape)
Get the position of a shape.
sfShape_getOrigin
sfVector2f sfShape_getOrigin(const sfShape *shape)
Get the local origin of a shape.
sfShape_destroy
void sfShape_destroy(const sfShape *shape)
Destroy an existing shape.
sfShape_getGlobalBounds
sfFloatRect sfShape_getGlobalBounds(const sfShape *shape)
Get the global bounding rectangle of a shape.
sfShape_getLocalBounds
sfFloatRect sfShape_getLocalBounds(const sfShape *shape)
Get the local bounding rectangle of a shape.
sfShape_setTexture
void sfShape_setTexture(sfShape *shape, const sfTexture *texture, bool resetRect)
Change the source texture of a shape.
sfShape_setTextureRect
void sfShape_setTextureRect(sfShape *shape, sfIntRect rect)
Set the sub-rectangle of the texture that a shape will display.
sfShapeGetPointCountCallback
size_t(* sfShapeGetPointCountCallback)(void *)
Type of the callback used to get the number of points in a shape.
Definition Shape.h:41
sfShape_setOrigin
void sfShape_setOrigin(sfShape *shape, sfVector2f origin)
Set the local origin of a shape.
sfShape_setRotation
void sfShape_setRotation(sfShape *shape, float angle)
Set the orientation of a shape.
sfShape_create
sfShape * sfShape_create(sfShapeGetPointCountCallback getPointCount, sfShapeGetPointCallback getPoint, void *userData)
Create a new shape.
sfShape_getGeometricCenter
sfVector2f sfShape_getGeometricCenter(const sfShape *shape)
Get the geometric center of the shape.
sfShape_getTexture
const sfTexture * sfShape_getTexture(const sfShape *shape)
Get the source texture of a shape.
sfShape_getOutlineThickness
float sfShape_getOutlineThickness(const sfShape *shape)
Get the outline thickness of a shape.
sfShape_getOutlineColor
sfColor sfShape_getOutlineColor(const sfShape *shape)
Get the outline color of a shape.
sfShape_setScale
void sfShape_setScale(sfShape *shape, sfVector2f scale)
Set the scale factors of a shape.
sfShape_setPosition
void sfShape_setPosition(sfShape *shape, sfVector2f position)
Set the position of a shape.
sfShape_getScale
sfVector2f sfShape_getScale(const sfShape *shape)
Get the current scale of a shape.
Transform.h
Vector2.h
sfColor
Utility class for manpulating RGBA colors.
Definition Color.h:38
sfFloatRect
sfFloatRect and sfIntRect are utility classes for manipulating rectangles.
Definition Rect.h:40
sfIntRect
Definition Rect.h:46
sfTransform
Encapsulate a 3x3 transform matrix.
Definition Transform.h:42
sfVector2f
2-component vector of floats
Definition Vector2.h:60