22 Commits
Author SHA1 Message Date
Zachariah Brown 2e272c187f Merge pull request #75 from SFML/feature/2.3_prep
Bumped version number to 2.3 and updated readme.txt
2015-05-21 12:45:47 -04:00
Zachariah Brown 910bcc86d0 Merge pull request #80 from vonagam/fix_rpath_for_os_x
Fix rpath for OS X
2015-05-21 12:44:48 -04:00
Dmitry Maganov 448949ef7a fix rpath for OS X 2015-05-19 22:42:38 +06:00
Zachariah Brown 33bf91a1da Bumped version number to 2.3 and updated readme.txt 2015-05-07 08:43:08 -04:00
Laurent Gomila 9f4c4abaca Merge pull request #77 from Gyscos/master
Use size_t instead of unsigned int to follow SFML change
2015-05-02 10:12:59 +02:00
Laurent Gomila 4069448128 Merge pull request #78 from BlaXpirit/feature/color_subtract
Added subtract function for Colors
2015-05-01 22:21:06 +02:00
Alexandre Bury 4720e109b6 Use size_t instead of unsigned int in Graphics
Also use sfUint64 for sampleCount in sfSoundBuffer_createFromSamples
2015-05-01 13:20:43 -07:00
Laurent Gomila f3153dc9c1 Merge pull request #79 from SFML/feature/precise_mouse_events
Added support for the MouseWheelScrolled event
2015-05-01 22:20:19 +02:00
Zachariah Brown a424e91a54 Added support for the MouseWheelScrolled event 2015-05-01 15:20:45 -04:00
Oleh Prypin 1d0d7164c8 Added subtract function for Colors 2015-05-01 21:09:52 +03:00
Laurent Gomila 1486a30e2f Merge pull request #74 from LaurentGomila/feature/gl_improvements
Added support for context creation flags and texture/shader native handles
2015-03-31 15:08:25 +02:00
Zachariah Brown 88a59374bc Added support for context creation flags and texture/shader native handles 2015-03-31 08:14:32 -04:00
Laurent Gomila 78eea7face Merge pull request #76 from LaurentGomila/bugfix/missing_headers
Added missing headers to the general headers
2015-03-30 22:42:52 +02:00
Zachariah Brown 90b168aaaf Added missing includes to the general headers 2015-03-30 15:42:08 -04:00
Laurent Gomila 2ca7fbfb61 Merge pull request #71 from LaurentGomila/feature/color_int_ctor
Added the ctor to create a sfColor from an sfUint32
2015-03-22 22:39:29 +01:00
Zachariah Brown 2d9ae6cd04 Added the ctor to create a sfColor from an sfUint32 2015-03-22 14:48:16 -04:00
Laurent Gomila 0fe078ec8a Merge pull request #72 from LaurentGomila/feature/partial_send
Added support for patial TCP sends
2015-03-22 18:41:29 +01:00
Laurent Gomila 10d785df80 Merge pull request #73 from LaurentGomila/bugfix/sample_count_type
Changed getSampleCount return type to sfUint64 to better match SFML
2015-03-22 18:40:39 +01:00
Zachariah Brown 728a0e0002 Changed getSampleCount return type to sfUint64 to better match SFML 2015-03-22 07:05:47 -04:00
Zachariah Brown 3de58bfef4 Added support for patial TCP sends 2015-03-22 07:01:05 -04:00
Laurent Gomila 57d3ee0d89 Merge pull request #69 from jcowgill/fix-conversion-null
Fix pointer conversion warning when compiling without NDEBUG on Linux
2015-03-04 18:45:04 +01:00
James Cowgill e5c4b0927d Fix pointer conversion warning when compiling without NDEBUG on Linux 2015-03-03 22:43:34 +00:00
40 changed files with 270 additions and 56 deletions

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
# define a macro that helps defining an option
macro(csfml_set_option var default type docstring)
@@ -21,7 +21,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
# setup version numbers
set(VERSION_MAJOR 2)
set(VERSION_MINOR 2)
set(VERSION_MINOR 3)
set(VERSION_PATCH 0)
# add the CSFML header path
+8
View File
@@ -56,6 +56,14 @@ macro(csfml_add_library target)
# link the target to its external dependencies (C++ SFML libraries)
target_link_libraries(${target} ${THIS_DEPENDS})
# build dylibs
if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS)
# adapt install directory to allow distributing dylibs in user’s application bundle
set_target_properties(${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@rpath")
endif()
# add the install rule
install(TARGETS ${target}
RUNTIME DESTINATION bin COMPONENT bin
+2
View File
@@ -36,6 +36,8 @@
#include <SFML/Audio/SoundBuffer.h>
#include <SFML/Audio/SoundBufferRecorder.h>
#include <SFML/Audio/SoundRecorder.h>
#include <SFML/Audio/SoundStatus.h>
#include <SFML/Audio/SoundStream.h>
#endif // SFML_AUDIO_H
+2 -2
View File
@@ -92,7 +92,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
/// \return A new sfSoundBuffer object (NULL if failed)
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Create a new sound buffer by copying an existing one
@@ -152,7 +152,7 @@ CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* sou
/// \return Number of samples
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
CSFML_AUDIO_API sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of a sound buffer
+1 -1
View File
@@ -30,7 +30,7 @@
// Define the CSFML version
////////////////////////////////////////////////////////////
#define CSFML_VERSION_MAJOR 2
#define CSFML_VERSION_MINOR 2
#define CSFML_VERSION_MINOR 3
#define CSFML_VERSION_PATCH 0
+2 -1
View File
@@ -35,14 +35,15 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/ConvexShape.h>
#include <SFML/Graphics/Font.h>
#include <SFML/Graphics/FontInfo.h>
#include <SFML/Graphics/Glyph.h>
#include <SFML/Graphics/Image.h>
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/RectangleShape.h>
#include <SFML/Graphics/RenderStates.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/RenderTexture.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/Shader.h>
#include <SFML/Graphics/Shape.h>
#include <SFML/Graphics/Sprite.h>
+4 -3
View File
@@ -34,6 +34,7 @@
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape*
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape);
CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a circle shape
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the radius of a circle
@@ -393,7 +394,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRadius(const sfCircleShape* shape);
/// \param count New number of points of the circle
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count);
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a circle shape
+29
View File
@@ -80,6 +80,24 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 b
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);
////////////////////////////////////////////////////////////
/// \brief Construct the color from 32-bit unsigned integer
///
/// \param color Number containing the RGBA components (in that order)
///
/// \return sfColor constructed from the 32-bit unsigned integer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfColor_fromInteger(sfUint32 color);
////////////////////////////////////////////////////////////
/// \brief Convert a color to a 32-bit unsigned integer
///
/// \return Color represented as a 32-bit unsigned integer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfUint32 sfColor_toInteger(sfColor color);
////////////////////////////////////////////////////////////
/// \brief Add two colors
///
@@ -91,6 +109,17 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2);
////////////////////////////////////////////////////////////
/// \brief Subtract two colors
///
/// \param color1 First color
/// \param color2 Second color
///
/// \return Component-wise saturated subtraction of the two colors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfColor_subtract(sfColor color1, sfColor color2);
////////////////////////////////////////////////////////////
/// \brief Modulate two colors
///
+5 -4
View File
@@ -34,6 +34,7 @@
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape*
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape);
CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a convex shape
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the number of points of a convex shap
@@ -376,7 +377,7 @@ CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape,
/// \param count New number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count);
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count);
////////////////////////////////////////////////////////////
/// \brief Set the position of a point in a convex shape
@@ -392,7 +393,7 @@ CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsign
/// \param point New point
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a convex shape
+3 -2
View File
@@ -34,6 +34,7 @@
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleS
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfRectangleShape_getPointCount(const sfRectangleShape* shape);
CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a rectangle shape
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfRectangleShape_getPointCount(const sfRectangle
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the size of a rectangle shape
+2 -1
View File
@@ -36,6 +36,7 @@
#include <SFML/Graphics/RenderStates.h>
#include <SFML/Graphics/Vertex.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -216,7 +217,7 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderT
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states);
////////////////////////////////////////////////////////////
+2 -1
View File
@@ -40,6 +40,7 @@
#include <SFML/Window/WindowHandle.h>
#include <SFML/Window/Window.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -441,7 +442,7 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states);
////////////////////////////////////////////////////////////
+14
View File
@@ -349,6 +349,20 @@ CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const cha
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the shader.
///
/// You shouldn't need to use this function, unless you have
/// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed.
///
/// \param shader Shader object
///
/// \return OpenGL handle of the shader or 0 if not yet loaded
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
////////////////////////////////////////////////////////////
/// \brief Bind a shader for rendering (activate it)
///
+5 -4
View File
@@ -34,10 +34,11 @@
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of the callback used to get a point of a shape
typedef size_t (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
typedef sfVector2f (*sfShapeGetPointCallback)(size_t, void*); ///< Type of the callback used to get a point of a shape
////////////////////////////////////////////////////////////
/// \brief Create a new shape
@@ -351,7 +352,7 @@ CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a shape
@@ -364,7 +365,7 @@ CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a shape
+14
View File
@@ -229,6 +229,20 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the texture.
///
/// You shouldn't need to use this function, unless you have
/// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed.
///
/// \param texture The texture object
///
/// \return OpenGL handle of the texture or 0 if not yet created
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Bind a texture for rendering
///
+4 -3
View File
@@ -33,6 +33,7 @@
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Vertex.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -69,7 +70,7 @@ CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray);
/// \return Number of vertices in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
CSFML_GRAPHICS_API size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
////////////////////////////////////////////////////////////
/// \brief Get access to a vertex by its index
@@ -84,7 +85,7 @@ CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray
/// \return Pointer to the index-th vertex
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index);
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index);
////////////////////////////////////////////////////////////
/// \brief Clear a vertex array
@@ -112,7 +113,7 @@ CSFML_GRAPHICS_API void sfVertexArray_clear(sfVertexArray* vertexArray);
/// \param vertexCount New size of the array (number of vertices)
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount);
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount);
////////////////////////////////////////////////////////////
/// \brief Add a vertex to a vertex array array
+1
View File
@@ -35,6 +35,7 @@
#include <SFML/Network/IpAddress.h>
#include <SFML/Network/Packet.h>
#include <SFML/Network/SocketSelector.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/TcpListener.h>
#include <SFML/Network/TcpSocket.h>
#include <SFML/Network/UdpSocket.h>
+1
View File
@@ -34,6 +34,7 @@ typedef enum
{
sfSocketDone, ///< The socket has sent / received the data
sfSocketNotReady, ///< The socket is not ready to send / receive data yet
sfSocketPartial, ///< The socket sent a part of the data
sfSocketDisconnected, ///< The TCP socket has been disconnected
sfSocketError ///< An unexpected error happened
+22
View File
@@ -150,6 +150,9 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Send raw data to the remote peer of a TCP socket
///
/// To be able to handle partial sends over non-blocking
/// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, std::size_t, size_t*)
/// overload instead.
/// This function will fail if the socket is not connected.
///
/// \param socket TCP socket object
@@ -161,6 +164,21 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size);
////////////////////////////////////////////////////////////
/// \brief Send raw data to the remote peer
///
/// This function will fail if the socket is not connected.
///
/// \param socket TCP socket object
/// \param data Pointer to the sequence of bytes to send
/// \param size Number of bytes to send
/// \param sent The number of bytes sent will be written here
///
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent);
////////////////////////////////////////////////////////////
/// \brief Receive raw data from the remote peer of a TCP socket
///
@@ -181,6 +199,10 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void*
////////////////////////////////////////////////////////////
/// \brief Send a formatted packet of data to the remote peer of a TCP socket
///
/// In non-blocking mode, if this function returns sfSocketPartial,
/// you must retry sending the same unmodified packet before sending
/// anything else in order to guarantee the packet arrives at the remote
/// peer uncorrupted.
/// This function will fail if the socket is not connected.
///
/// \param socket TCP socket object
+1
View File
@@ -35,6 +35,7 @@
#include <SFML/System/Mutex.h>
#include <SFML/System/Sleep.h>
#include <SFML/System/Thread.h>
#include <SFML/System/Time.h>
#include <SFML/System/Vector2.h>
#include <SFML/System/Vector3.h>
+3
View File
@@ -33,8 +33,11 @@
#include <SFML/Window/Context.h>
#include <SFML/Window/Event.h>
#include <SFML/Window/Joystick.h>
#include <SFML/Window/JoystickIdentification.h>
#include <SFML/Window/Keyboard.h>
#include <SFML/Window/Mouse.h>
#include <SFML/Window/Sensor.h>
#include <SFML/Window/Touch.h>
#include <SFML/Window/VideoMode.h>
#include <SFML/Window/Window.h>
+18 -3
View File
@@ -48,7 +48,8 @@ typedef enum
sfEvtTextEntered, ///< A character was entered (data in event.text)
sfEvtKeyPressed, ///< A key was pressed (data in event.key)
sfEvtKeyReleased, ///< A key was released (data in event.key)
sfEvtMouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel)
sfEvtMouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
sfEvtMouseWheelScrolled, ///< The mouse wheel was scrolled (data in event.mouseWheelScroll)
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)
@@ -116,7 +117,7 @@ typedef struct
} sfMouseButtonEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse wheel events parameters
/// \brief Mouse wheel events parameters (deprecated)
///
////////////////////////////////////////////////////////////
typedef struct
@@ -127,6 +128,19 @@ typedef struct
int y;
} sfMouseWheelEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse wheel events parameters
///
////////////////////////////////////////////////////////////
typedef struct
{
sfEventType type;
sfMouseWheel wheel;
float delta;
int x;
int y;
} sfMouseWheelScrollEvent;
////////////////////////////////////////////////////////////
/// \brief Joystick axis move event parameters
///
@@ -208,7 +222,8 @@ typedef union
sfTextEvent text; ///< Text event parameters
sfMouseMoveEvent mouseMove; ///< Mouse move event parameters
sfMouseButtonEvent mouseButton; ///< Mouse button event parameters
sfMouseWheelEvent mouseWheel; ///< Mouse wheel event parameters
sfMouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (deprecated)
sfMouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters
sfJoystickMoveEvent joystickMove; ///< Joystick move event parameters
sfJoystickButtonEvent joystickButton; ///< Joystick button event parameters
sfJoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters
+10
View File
@@ -48,6 +48,16 @@ typedef enum
sfMouseButtonCount ///< Keep last -- the total number of mouse buttons
} sfMouseButton;
////////////////////////////////////////////////////////////
/// \brief Mouse wheels
///
////////////////////////////////////////////////////////////
typedef enum
{
sfMouseVerticalWheel, ///< The vertical mouse wheel
sfMouseHorizontalWheel ///< The horizontal mouse wheel
} sfMouseWheel;
////////////////////////////////////////////////////////////
/// \brief Check if a mouse button is pressed
+13
View File
@@ -51,6 +51,18 @@ typedef enum
} sfWindowStyle;
////////////////////////////////////////////////////////////
/// \brief Enumeration of the context attribute flags
///
////////////////////////////////////////////////////////////
typedef enum
{
sfContextDefault = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
sfContextCore = 1 << 0, ///< Core attribute
sfContextDebug = 1 << 2 ///< Debug attribute
} sfContextAttribute;
////////////////////////////////////////////////////////////
/// \brief Structure defining the window's creation settings
///
@@ -62,6 +74,7 @@ typedef struct
unsigned int antialiasingLevel; ///< Level of antialiasing
unsigned int majorVersion; ///< Major number of the context version to create
unsigned int minorVersion; ///< Minor number of the context version to create
sfUint32 attributeFlags; ///< The attribute flags to create the context with
} sfContextSettings;
+7 -6
View File
@@ -1,20 +1,21 @@
CSFML - Simple and Fast Multimedia Library for C
================================================
SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics,
audio and network.
SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing,
graphics, audio and network.
It is originally written in C++, and this project is its official binding for the C language.
Authors
-------
Laurent Gomila - main developer (laurent@sfml-dev.org)
Zachariah Brown - active maintainer (crazyzprogrammer@hotmail.com)
Download
--------
You can get the latest official release on SFML website (http://www.sfml-dev.org/download/csfml).
You can also get the current development version from the git repository (https://github.com/LaurentGomila/CSFML).
You can also get the current development version from the git repository (https://github.com/SFML/CSFML).
Learn
-----
@@ -22,8 +23,8 @@ Learn
There is no tutorial for CSFML, but since it's a binding you can use the C++ resources:
* The official tutorials (http://www.sfml-dev.org/tutorials/)
* The online API documentation (http://www.sfml-dev.org/documentation/)
* The community wiki (https://github.com/LaurentGomila/SFML/wiki/)
* The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for french people)
* The community wiki (https://github.com/SFML/SFML/wiki/)
* The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for French people)
Of course, you can also find the CSFM API documentation in the SDK.
@@ -37,5 +38,5 @@ Contribute
SFML and CSFML are open-source projects, and they need your help to go on growing and improving.
Don't hesitate to post suggestions or bug reports on the forum (http://en.sfml-dev.org/forums/),
submit patches by e-mail, or post new bugs/features requests on the task tracker (https://github.com/LaurentGomila/CSFML/issues/).
or post new bugs/features requests on the task tracker (https://github.com/SFML/CSFML/issues/).
You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work.
+2 -2
View File
@@ -80,7 +80,7 @@ sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream)
////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, size_t sampleCount, unsigned int channelCount, unsigned int sampleRate)
sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate)
{
sfSoundBuffer* buffer = new sfSoundBuffer;
@@ -125,7 +125,7 @@ const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer)
////////////////////////////////////////////////////////////
size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer)
sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer)
{
CSFML_CALL_RETURN(soundBuffer, getSampleCount(), 0);
}
+8 -1
View File
@@ -33,7 +33,7 @@
////////////////////////////////////////////////////////////
// Define a function to convert a sf::Event ot a sfEvent
// Define a function to convert a sf::Event to a sfEvent
////////////////////////////////////////////////////////////
inline void convertEvent(const sf::Event& SFMLEvent, sfEvent* event)
{
@@ -67,6 +67,13 @@ inline void convertEvent(const sf::Event& SFMLEvent, sfEvent* event)
event->mouseWheel.y = SFMLEvent.mouseWheel.y;
break;
case sfEvtMouseWheelScrolled :
event->mouseWheelScroll.wheel = static_cast<sfMouseWheel>(SFMLEvent.mouseWheelScroll.wheel);
event->mouseWheelScroll.delta = SFMLEvent.mouseWheelScroll.delta;
event->mouseWheelScroll.x = SFMLEvent.mouseWheelScroll.x;
event->mouseWheelScroll.y = SFMLEvent.mouseWheelScroll.y;
break;
case sfEvtMouseButtonPressed :
case sfEvtMouseButtonReleased :
event->mouseButton.button = static_cast<sfMouseButton>(SFMLEvent.mouseButton.button);
+3 -3
View File
@@ -277,14 +277,14 @@ float sfCircleShape_getOutlineThickness(const sfCircleShape* shape)
////////////////////////////////////////////////////////////
unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape)
size_t sfCircleShape_getPointCount(const sfCircleShape* shape)
{
CSFML_CALL_RETURN(shape, getPointCount(), 0);
}
////////////////////////////////////////////////////////////
sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index)
sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index)
{
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
@@ -312,7 +312,7 @@ float sfCircleShape_getRadius(const sfCircleShape* shape)
////////////////////////////////////////////////////////////
void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count)
void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count)
{
CSFML_CALL(shape, setPointCount(count));
}
+34
View File
@@ -63,6 +63,25 @@ sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha
}
////////////////////////////////////////////////////////////
sfColor sfColor_fromInteger(sfUint32 color)
{
sfUint8 red = (color & 0xff000000) >> 24;
sfUint8 green = (color & 0x00ff0000) >> 16;
sfUint8 blue = (color & 0x0000ff00) >> 8;
sfUint8 alpha = (color & 0x000000ff) >> 0;
return sfColor_fromRGBA(red, green, blue, alpha);
}
////////////////////////////////////////////////////////////
sfUint32 sfColor_toInteger(sfColor color)
{
return (color.r << 24) | (color.g << 16) | (color.b << 8) | color.a;
}
////////////////////////////////////////////////////////////
sfColor sfColor_add(sfColor color1, sfColor color2)
{
@@ -78,6 +97,21 @@ sfColor sfColor_add(sfColor color1, sfColor color2)
}
////////////////////////////////////////////////////////////
sfColor sfColor_subtract(sfColor color1, sfColor color2)
{
int red = std::max(color1.r - color2.r, 0);
int green = std::max(color1.g - color2.g, 0);
int blue = std::max(color1.b - color2.b, 0);
int alpha = std::max(color1.a - color2.a, 0);
return sfColor_fromRGBA(static_cast<sfUint8>(red),
static_cast<sfUint8>(green),
static_cast<sfUint8>(blue),
static_cast<sfUint8>(alpha));
}
////////////////////////////////////////////////////////////
sfColor sfColor_modulate(sfColor color1, sfColor color2)
{
+4 -4
View File
@@ -274,14 +274,14 @@ float sfConvexShape_getOutlineThickness(const sfConvexShape* shape)
////////////////////////////////////////////////////////////
unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape)
size_t sfConvexShape_getPointCount(const sfConvexShape* shape)
{
CSFML_CALL_RETURN(shape, getPointCount(), 0);
}
////////////////////////////////////////////////////////////
sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index)
sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index)
{
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
@@ -295,14 +295,14 @@ sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index
////////////////////////////////////////////////////////////
void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count)
void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count)
{
CSFML_CALL(shape, setPointCount(count));
}
////////////////////////////////////////////////////////////
void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point)
void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point)
{
CSFML_CALL(shape, setPoint(index, sf::Vector2f(point.x, point.y)));
}
+2 -2
View File
@@ -274,14 +274,14 @@ float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape)
////////////////////////////////////////////////////////////
unsigned int sfRectangleShape_getPointCount(const sfRectangleShape* shape)
size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape)
{
CSFML_CALL_RETURN(shape, getPointCount(), 0);
}
////////////////////////////////////////////////////////////
sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, unsigned int index)
sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index)
{
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
+2 -2
View File
@@ -218,7 +218,7 @@ void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVer
////////////////////////////////////////////////////////////
void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states)
{
CSFML_CALL(renderTexture, draw(reinterpret_cast<const sf::Vertex*>(vertices), vertexCount,
@@ -280,4 +280,4 @@ void sfRenderTexture_setRepeated(sfRenderTexture* renderTexture, sfBool repeated
sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture)
{
CSFML_CALL_RETURN(renderTexture, isRepeated(), sfFalse);
}
}
+5 -1
View File
@@ -56,6 +56,7 @@ sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUin
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -82,6 +83,7 @@ sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* t
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -106,6 +108,7 @@ sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfC
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -151,6 +154,7 @@ sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow)
settings.antialiasingLevel = params.antialiasingLevel;
settings.majorVersion = params.majorVersion;
settings.minorVersion = params.minorVersion;
settings.attributeFlags = params.attributeFlags;
return settings;
}
@@ -471,7 +475,7 @@ void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertex
////////////////////////////////////////////////////////////
void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states)
{
CSFML_CALL(renderWindow, draw(reinterpret_cast<const sf::Vertex*>(vertices), vertexCount,
+7
View File
@@ -217,6 +217,13 @@ void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name)
}
////////////////////////////////////////////////////////////
unsigned int sfShader_getNativeHandle(const sfShader* shader)
{
CSFML_CALL_RETURN(shader, getNativeHandle(), 0);
}
////////////////////////////////////////////////////////////
void sfShader_bind(const sfShader* shader)
{
+2 -2
View File
@@ -267,14 +267,14 @@ float sfShape_getOutlineThickness(const sfShape* shape)
////////////////////////////////////////////////////////////
unsigned int sfShape_getPointCount(const sfShape* shape)
size_t sfShape_getPointCount(const sfShape* shape)
{
CSFML_CALL_RETURN(shape, getPointCount(), 0);
}
////////////////////////////////////////////////////////////
sfVector2f sfShape_getPoint(const sfShape* shape, unsigned int index)
sfVector2f sfShape_getPoint(const sfShape* shape, size_t index)
{
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
+2 -2
View File
@@ -51,12 +51,12 @@ public :
{
}
virtual unsigned int getPointCount() const
virtual std::size_t getPointCount() const
{
return myGetPointCountCallback(myUserData);
}
virtual sf::Vector2f getPoint(unsigned int index) const
virtual sf::Vector2f getPoint(std::size_t index) const
{
sfVector2f point = myGetPointCallback(index, myUserData);
return sf::Vector2f(point.x, point.y);
+7
View File
@@ -242,6 +242,13 @@ sfBool sfTexture_isRepeated(const sfTexture* texture)
}
////////////////////////////////////////////////////////////
unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
{
CSFML_CALL_PTR_RETURN(texture, getNativeHandle(), 0);
}
////////////////////////////////////////////////////////////
void sfTexture_bind(const sfTexture* texture)
{
+3 -3
View File
@@ -54,14 +54,14 @@ void sfVertexArray_destroy(sfVertexArray* vertexArray)
////////////////////////////////////////////////////////////
unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray)
size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray)
{
CSFML_CALL_RETURN(vertexArray, getVertexCount(), 0);
}
////////////////////////////////////////////////////////////
sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index)
sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index)
{
CSFML_CHECK_RETURN(vertexArray, NULL);
@@ -78,7 +78,7 @@ void sfVertexArray_clear(sfVertexArray* vertexArray)
////////////////////////////////////////////////////////////
void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount)
void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount)
{
CSFML_CALL(vertexArray, resize(vertexCount));
}
+9
View File
@@ -115,6 +115,15 @@ sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t si
}
////////////////////////////////////////////////////////////
sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent)
{
CSFML_CHECK_RETURN(socket, sfSocketError);
return static_cast<sfSocketStatus>(socket->This.send(data, size, *sent));
}
////////////////////////////////////////////////////////////
sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived)
{
+5 -1
View File
@@ -46,6 +46,7 @@ sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, c
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -70,6 +71,7 @@ sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -92,6 +94,7 @@ sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettin
params.antialiasingLevel = settings->antialiasingLevel;
params.majorVersion = settings->majorVersion;
params.minorVersion = settings->minorVersion;
params.attributeFlags = settings->attributeFlags;
}
// Create the window
@@ -134,6 +137,7 @@ sfContextSettings sfWindow_getSettings(const sfWindow* window)
settings.antialiasingLevel = params.antialiasingLevel;
settings.majorVersion = params.majorVersion;
settings.minorVersion = params.minorVersion;
settings.attributeFlags = params.attributeFlags;
return settings;
}
@@ -317,7 +321,7 @@ void sfWindow_setJoystickThreshold(sfWindow* window, float threshold)
////////////////////////////////////////////////////////////
sfWindowHandle sfWindow_getSystemHandle(const sfWindow* window)
{
CSFML_CHECK_RETURN(window, NULL);
CSFML_CHECK_RETURN(window, 0);
return (sfWindowHandle)window->This.getSystemHandle();
}