Merge pull request #102 from dabbertorres/2.4

Update to 2.4
This commit is contained in:
Laurent Gomila authored and GitHub committed 2016-09-29 11:17:42 +02:00
commit 0e8c6379f0
27 files changed
+1207 -190

No files matched your search

+28
View File
@@ -185,5 +185,33 @@ CSFML_AUDIO_API sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder,
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder);
////////////////////////////////////////////////////////////
/// \brief Set the channel count of the audio capture device
///
/// This method allows you to specify the number of channels
/// used for recording. Currently only 16-bit mono and
/// 16-bit stereo are supported.
///
/// \param channelCount Number of channels. Currently only
/// mono (1) and stereo (2) are supported.
///
/// \see sfSoundRecorder_getChannelCount
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount);
////////////////////////////////////////////////////////////
/// \brief Get the number of channels used by this recorder
///
/// Currently only mono and stereo are supported, so the
/// value is either 1 (for mono) or 2 (for stereo).
///
/// \return Number of channels
///
/// \see sfSoundRecorder_setChannelCount
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder);
#endif // SFML_SOUNDRECORDER_H
+36
View File
@@ -110,6 +110,42 @@
#endif
////////////////////////////////////////////////////////////
// Cross-platform warning for deprecated functions and classes
//
// Usage:
// struct CSFML_DEPRECATED MyStruct
// {
// ...
// };
//
// CSFML_DEPRECATED void globalFunc();
////////////////////////////////////////////////////////////
#if defined(CSFML_NO_DEPRECATED_WARNINGS)
// User explicitly requests to disable deprecation warnings
#define CSFML_DEPRECATED
#elif defined(_MSC_VER)
// Microsoft C++ compiler
// Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
// trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
#define CSFML_DEPRECATED __declspec(deprecated)
#elif defined(__GNUC__)
// g++ and Clang
#define CSFML_DEPRECATED __attribute__ ((deprecated))
#else
// Other compilers are not supported, leave class or function as-is.
// With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
#pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team")
#define CSFML_DEPRECATED
#endif
////////////////////////////////////////////////////////////
// Define a portable boolean type
+3 -2
View File
@@ -56,8 +56,9 @@ typedef enum
////////////////////////////////////////////////////////////
typedef enum
{
sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor
sfBlendEquationSubtract ///< Pixel = Src * SrcFactor - Dst * DstFactor
sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor
sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
sfBlendEquationReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor
} sfBlendEquation;
+6 -5
View File
@@ -88,15 +88,16 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
////////////////////////////////////////////////////////////
/// \brief Get a glyph in a font
///
/// \param font Source font
/// \param codePoint Unicode code point of the character to get
/// \param characterSize Character size, in pixels
/// \param bold Retrieve the bold version or the regular one?
/// \param font Source font
/// \param codePoint Unicode code point of the character to get
/// \param characterSize Character size, in pixels
/// \param bold Retrieve the bold version or the regular one?
/// \param outlineThickness Thickness of outline (when != 0 the glyph will not be filled)
///
/// \return The corresponding glyph
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold);
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness);
////////////////////////////////////////////////////////////
/// \brief Get the kerning value corresponding to a given pair of characters in a font
+97
View File
@@ -0,0 +1,97 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#ifndef SFML_GLSL_H
#define SFML_GLSL_H
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Color.h>
#include <SFML/System/Vector2.h>
#include <SFML/System/Vector3.h>
// 2D vectors
typedef sfVector2f sfGlslVec2;
typedef sfVector2i sfGlslIvec2;
typedef struct
{
bool x;
bool y;
} sfGlslBvec2;
// 3D vectors
typedef sfVector3f sfGlslVec3;
typedef struct
{
int x;
int y;
int z;
} sfGlslIvec3;
typedef struct
{
bool x;
bool y;
bool z;
} sfGlslBvec3;
// 4D vectors
typedef struct
{
float x;
float y;
float z;
float w;
} sfGlslVec4;
typedef struct
{
int x;
int y;
int z;
int w;
} sfGlslIvec4;
typedef struct
{
bool x;
bool y;
bool z;
bool w;
} sfGlslBvec4;
// matrices
typedef struct
{
float array[3 * 3];
} sfGlslMat3;
typedef struct
{
float array[4 * 4];
} sfGlslMat4;
#endif // SFML_GLSL_H
+11 -7
View File
@@ -41,13 +41,17 @@
////////////////////////////////////////////////////////////
typedef enum
{
sfPoints, ///< List of individual points
sfLines, ///< List of individual lines
sfLinesStrip, ///< List of connected lines, a point uses the previous point to form a line
sfTriangles, ///< List of individual triangles
sfTrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
sfTrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
sfQuads ///< List of individual quads
sfPoints, ///< List of individual points
sfLines, ///< List of individual lines
sfLineStrip, ///< List of connected lines, a point uses the previous point to form a line
sfTriangles, ///< List of individual triangles
sfTriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
sfTriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
sfQuads, ///< List of individual quads
sfLinesStrip = sfLineStrip, ///< \deprecated Use sfLineStrip instead
sfTrianglesStrp = sfTriangleStrip, ///< \deprecated Use sfTriangleStrip instead
sfTrianglesFan = sfTriangleFan ///< \deprecated Use sfTriangleFan instead
} sfPrimitiveType;
+17
View File
@@ -316,4 +316,21 @@ CSFML_GRAPHICS_API void sfRenderTexture_setRepeated(sfRenderTexture* renderTextu
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// \brief Generate a mipmap using the current texture data
///
/// This function is similar to sfTexture_generateMipmap and operates
/// on the texture used as the target for drawing.
/// Be aware that any draw operation may modify the base level image data.
/// For this reason, calling this function only makes sense after all
/// drawing is completed and display has been called. Not calling display
/// after subsequent drawing will lead to undefined behavior if a mipmap
/// had been previously generated.
///
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture);
#endif // SFML_RENDERTEXTURE_H
+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
+338 -25
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Glsl.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/InputStream.h>
@@ -38,61 +39,64 @@
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from files
/// \brief Load the vertex, geometry and fragment shaders from files
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// This function loads the vertex, geometry and fragment
/// shaders. Pass NULL if you don't want to load
/// a specific shader.
/// The sources must be text files containing valid shaders
/// in GLSL language. GLSL is a C-like language dedicated to
/// OpenGL shaders; you'll probably need to read a good documentation
/// for it before writing your own shaders.
///
/// \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader
/// \param geometryShaderFilename Path of the geometry shader file to load, or NULL to skip this shader
/// \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader
///
/// \return A new sfShader object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* fragmentShaderFilename);
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from source codes in memory
/// \brief Load the vertex, geometry and fragment shaders from source code in memory
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// This function loads the vertex, geometry and fragment
/// shaders. Pass NULL if you don't want to load
/// a specific shader.
/// The sources must be valid shaders in GLSL language. GLSL is
/// a C-like language dedicated to OpenGL shaders; you'll
/// probably need to read a good documentation for it before
/// writing your own shaders.
///
/// \param vertexShader String containing the source code of the vertex shader, or NULL to skip this shader
/// \param geometryShader String containing the source code of the geometry shader, or NULL to skip this shader
/// \param fragmentShader String containing the source code of the fragment shader, or NULL to skip this shader
///
/// \return A new sfShader object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* fragmentShader);
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from custom streams
/// \brief Load the vertex, geometry and fragment shaders from custom streams
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// This function loads the vertex, geometry and fragment
/// shaders. Pass NULL if you don't want to load
/// a specific shader.
/// The source codes must be valid shaders in GLSL language.
/// GLSL is a C-like language dedicated to OpenGL shaders;
/// you'll probably need to read a good documentation for
/// it before writing your own shaders.
///
/// \param vertexShaderStream Source stream to read the vertex shader from, or NULL to skip this shader
/// \param geometryShaderStream Source stream to read the geometry shader from, or NULL to skip this shader
/// \param fragmentShaderStream Source stream to read the fragment shader from, or NULL to skip this shader
///
/// \return A new sfShader object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* fragmentShaderStream);
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing shader
@@ -102,6 +106,297 @@ CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShad
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p float uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param x Value of the float scalar
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p vec2 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the vec2 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p vec3 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the vec3 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p vec4 uniform
///
/// sfColor objects can be passed to this function via
/// the use of sfGlslVec4_fromsfColor(sfColor);
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the vec4 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p vec4 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param color Value of the vec4 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p int uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param x Value of the integer scalar
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p ivec2 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the ivec2 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p ivec3 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the ivec3 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p ivec4 uniform
///
/// sfColor objects can be passed to this function via
/// the use of sfGlslIvec4_fromsfColor(sfColor);
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the ivec4 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p ivec4 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param color Value of the ivec4 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p bool uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param x Value of the bool scalar
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p bvec2 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the bvec2 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p Bvec3 uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the Bvec3 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p bvec4 uniform
///
/// sfColor objects can be passed to this function via
/// the use of sfGlslIvec4_fromsfColor(sfColor);
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vector Value of the bvec4 vector
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p mat3 matrix
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param matrix Value of the mat3 matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix);
////////////////////////////////////////////////////////////
/// \brief Specify value for \p mat4 matrix
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param matrix Value of the mat4 matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix);
////////////////////////////////////////////////////////////
/// \brief Specify a texture as \p sampler2D uniform
///
/// \a name is the name of the variable to change in the shader.
/// The corresponding parameter in the shader must be a 2D texture
/// (\p sampler2D GLSL type).
///
/// Example:
/// \code
/// uniform sampler2D the_texture; // this is the variable in the shader
/// \endcode
/// \code
/// sfTexture texture;
/// ...
/// sfShader_setTextureUniform(shader, "the_texture", &texture);
/// \endcode
/// It is important to note that \a texture must remain alive as long
/// as the shader uses it, no copy is made internally.
///
/// To use the texture of the object being drawn, which cannot be
/// known in advance, you can pass the special value
/// sf::Shader::CurrentTexture:
/// \code
/// shader.setUniform("the_texture", sf::Shader::CurrentTexture).
/// \endcode
///
/// \param shader Shader object
/// \param name Name of the texture in the shader
/// \param texture Texture to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Specify current texture as \p sampler2D uniform
///
/// This overload maps a shader texture variable to the
/// texture of the object being drawn, which cannot be
/// known in advance.
/// The corresponding parameter in the shader must be a 2D texture
/// (\p sampler2D GLSL type).
///
/// Example:
/// \code
/// uniform sampler2D current; // this is the variable in the shader
/// \endcode
/// \code
/// sfShader_setCurrentTextureUniform(shader, "current");
/// \endcode
///
/// \param shader Shader object
/// \param name Name of the texture in the shader
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p float[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param scalarArray pointer to array of \p float values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p vec2[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vectorArray pointer to array of \p vec2 values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p vec3[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vectorArray pointer to array of \p vec3 values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p vec4[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param vectorArray pointer to array of \p vec4 values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p mat3[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param matrixArray pointer to array of \p mat3 values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Specify values for \p mat4[] array uniform
///
/// \param shader Shader object
/// \param name Name of the uniform variable in GLSL
/// \param matrixArray pointer to array of \p mat4 values
/// \param length Number of elements in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length);
////////////////////////////////////////////////////////////
/// \brief Change a float parameter of a shader
///
@@ -122,7 +417,7 @@ CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
/// \param x Value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
////////////////////////////////////////////////////////////
/// \brief Change a 2-components vector parameter of a shader
@@ -145,7 +440,7 @@ CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char*
/// \param y Second component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
////////////////////////////////////////////////////////////
/// \brief Change a 3-components vector parameter of a shader
@@ -169,7 +464,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char
/// \param z Third component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
////////////////////////////////////////////////////////////
/// \brief Change a 4-components vector parameter of a shader
@@ -194,7 +489,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char
/// \param w Fourth component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
////////////////////////////////////////////////////////////
/// \brief Change a 2-components vector parameter of a shader
@@ -217,7 +512,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
////////////////////////////////////////////////////////////
/// \brief Change a 3-components vector parameter of a shader
@@ -240,7 +535,7 @@ CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const cha
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
////////////////////////////////////////////////////////////
/// \brief Change a color parameter of a shader
@@ -268,7 +563,7 @@ CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const cha
/// \param color Color to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Change a matrix parameter of a shader
@@ -291,7 +586,7 @@ CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char*
/// \param transform Transform to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of a shader
@@ -324,7 +619,7 @@ CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const c
/// \param texture Texture to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of a shader
@@ -347,7 +642,7 @@ CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const cha
/// \param name Name of the texture in the shader
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the shader.
@@ -398,5 +693,23 @@ CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports geometry shaders
///
/// This function should always be called before using
/// the geometry shader features. If it returns false, then
/// any attempt to use sfShader geometry shader features will fail.
///
/// This function can only return true if isAvailable() would also
/// return true, since shaders in general have to be supported in
/// order for geometry shaders to be supported as well.
///
/// Note: The first call to this function, whether by your
/// code or SFML will result in a context switch.
///
/// \return True if geometry shaders are supported, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfShader_isGeometryAvailable(void);
#endif // SFML_SHADER_H
+82 -5
View File
@@ -290,16 +290,60 @@ CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size)
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
////////////////////////////////////////////////////////////
/// \brief Set the global color of a text
/// \brief Set the fill color of a text
///
/// By default, the text's color is opaque white.
/// By default, the text's fill color is opaque white.
/// Setting the fill color to a transparent color with an outline
/// will cause the outline to be displayed in the fill area of the text.
///
/// \param text Text object
/// \param color New color of the text
/// \param color New fill color of the text
///
/// \deprecated This function is deprecated and may be removed in future releases.
/// Use sfText_setFillColor instead.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Set the fill color of a text
///
/// By default, the text's fill color is opaque white.
/// Setting the fill color to a transparent color with an outline
/// will cause the outline to be displayed in the fill area of the text.
///
/// \param text Text object
/// \param color New fill color of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setFillColor(sfText* text, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Set the outline color of the text
///
/// By default, the text's outline color is opaque black.
///
/// \param text Text object
/// \param color New outline color of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setOutlineColor(sfText* text, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Set the thickness of the text's outline
///
/// By default, the outline thickness is 0.
///
/// Be aware that using a negative value for the outline
/// thickness will cause distorted rendering.
///
/// \param thickness New outline thickness, in pixels
///
/// \see getOutlineThickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setOutlineThickness(sfText* text, float thickness);
////////////////////////////////////////////////////////////
/// \brief Get the string of a text (returns an ANSI string)
///
@@ -355,15 +399,48 @@ CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the global color of a text
/// \brief Get the fill color of a text
///
/// \param text Text object
///
/// \return Global color of the text
/// \return Fill color of the text
///
/// \deprecated This function is deprecated and may be removed in future releases.
/// Use sfText_getFillColor instead.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the fill color of a text
///
/// \param text Text object
///
/// \return Fill color of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfText_getFillColor(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the outline color of a text
///
/// \param text Text object
///
/// \return Outline color of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfText_getOutlineColor(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the outline thickness of a text
///
/// \param text Text object
///
/// \return Outline thickness of a text, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfText_getOutlineThickness(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Return the position of the \a index-th character in a text
///
+60
View File
@@ -196,6 +196,41 @@ CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Enable or disable conversion from sRGB
///
/// When providing texture data from an image file or memory, it can
/// either be stored in a linear color space or an sRGB color space.
/// Most digital images account for gamma correction already, so they
/// would need to be "uncorrected" back to linear color space before
/// being processed by the hardware. The hardware can automatically
/// convert it from the sRGB color space to a linear color space when
/// it gets sampled. When the rendered image gets output to the final
/// framebuffer, it gets converted back to sRGB.
///
/// After enabling or disabling sRGB conversion, make sure to reload
/// the texture data in order for the setting to take effect.
///
/// This option is only useful in conjunction with an sRGB capable
/// framebuffer. This can be requested during window creation.
///
/// \param sRgb True to enable sRGB conversion, false to disable it
///
/// \see sfTexture_isSrgb
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_setSrgb(sfTexture* texture, sfBool sRgb);
////////////////////////////////////////////////////////////
/// \brief Tell whether the texture source is converted from sRGB or not
///
/// \return True if the texture source is converted from sRGB, false if not
///
/// \see sfTexture_setSrgb
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Enable or disable repeating for a texture
///
@@ -229,6 +264,31 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Generate a mipmap using the current texture data
///
/// Mipmaps are pre-computed chains of optimized textures. Each
/// level of texture in a mipmap is generated by halving each of
/// the previous level's dimensions. This is done until the final
/// level has the size of 1x1. The textures generated in this process may
/// make use of more advanced filters which might improve the visual quality
/// of textures when they are applied to objects much smaller than they are.
/// This is known as minification. Because fewer texels (texture elements)
/// have to be sampled from when heavily minified, usage of mipmaps
/// can also improve rendering performance in certain scenarios.
///
/// Mipmap generation relies on the necessary OpenGL extension being
/// available. If it is unavailable or generation fails due to another
/// reason, this function will return false. Mipmap data is only valid from
/// the time it is generated until the next time the base level image is
/// modified, at which point this function will have to be called again to
/// regenerate it.
///
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the texture.
///
+6
View File
@@ -48,6 +48,12 @@ typedef struct
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_None;
////////////////////////////////////////////////////////////
/// \brief Value representing any address (0.0.0.0)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Any;
////////////////////////////////////////////////////////////
/// \brief Local host IP address (127.0.0.1, or "localhost")
///
+5 -1
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Network/Export.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/IpAddress.h>
#include <SFML/Network/Types.h>
@@ -98,13 +99,16 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
/// If the socket was previously listening to another port,
/// it will be stopped first and bound to the new port.
///
/// If there is no specific address to listen to, pass sfIpAddress_Any
///
/// \param listener TCP listener object
/// \param port Port to listen for new connections
/// \param address Address of the interface to listen on
///
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port);
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Accept a new connection
+6 -3
View File
@@ -101,13 +101,16 @@ CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* soc
/// system to automatically pick an available port, and then
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
///
/// \param socket UDP socket object
/// \param port Port to bind the socket to
/// If there is no specific address to listen to, pass sfIpAddress_Any
///
/// \param socket UDP socket object
/// \param port Port to bind the socket to
/// \param address Address of the interface to bind to
///
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port);
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Unbind a UDP socket from the local port to which it is bound
+18 -15
View File
@@ -117,10 +117,13 @@ typedef struct
} sfMouseButtonEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse wheel events parameters (deprecated)
/// \brief Mouse wheel events parameters
///
/// \deprecated
/// Use sfMouseWheelScrollEvent instead.
///
////////////////////////////////////////////////////////////
typedef struct
typedef struct CSFML_DEPRECATED
{
sfEventType type;
int delta;
@@ -216,19 +219,19 @@ typedef struct
////////////////////////////////////////////////////////////
typedef union
{
sfEventType type; ///< Type of the event
sfSizeEvent size; ///< Size event parameters
sfKeyEvent key; ///< Key event parameters
sfTextEvent text; ///< Text event parameters
sfMouseMoveEvent mouseMove; ///< Mouse move event parameters
sfMouseButtonEvent mouseButton; ///< Mouse button 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
sfTouchEvent touch; ///< Touch events parameters
sfSensorEvent sensor; ///< Sensor event parameters
sfEventType type; ///< Type of the event
sfSizeEvent size; ///< Size event parameters
sfKeyEvent key; ///< Key event parameters
sfTextEvent text; ///< Text event parameters
sfMouseMoveEvent mouseMove; ///< Mouse move event parameters
sfMouseButtonEvent mouseButton; ///< Mouse button 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
sfTouchEvent touch; ///< Touch events parameters
sfSensorEvent sensor; ///< Sensor event parameters
} sfEvent;
+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
///
+17
View File
@@ -102,6 +102,7 @@ const char** sfSoundRecorder_getAvailableDevices(size_t* count)
return !cstringDevices.empty() ? &cstringDevices[0] : NULL;
}
////////////////////////////////////////////////////////////
const char* sfSoundRecorder_getDefaultDevice()
{
@@ -110,12 +111,14 @@ const char* sfSoundRecorder_getDefaultDevice()
return !defaultDevice.empty() ? defaultDevice.c_str() : NULL;
}
////////////////////////////////////////////////////////////
sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name)
{
CSFML_CALL_RETURN(soundRecorder, setDevice(name), sfFalse);
}
////////////////////////////////////////////////////////////
const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder)
{
@@ -125,3 +128,17 @@ const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder)
return soundRecorder->DeviceName.c_str();
}
////////////////////////////////////////////////////////////
void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount)
{
CSFML_CALL(soundRecorder, setChannelCount(channelCount));
}
////////////////////////////////////////////////////////////
unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder)
{
CSFML_CALL_RETURN(soundRecorder, getChannelCount(), 0);
}
+2 -2
View File
@@ -93,12 +93,12 @@ void sfFont_destroy(sfFont* font)
////////////////////////////////////////////////////////////
sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold)
sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness)
{
sfGlyph glyph = {0, {0, 0, 0, 0}, {0, 0, 0, 0}};
CSFML_CHECK_RETURN(font, glyph);
sf::Glyph SFMLGlyph = font->This.getGlyph(codePoint, characterSize, bold == sfTrue);
sf::Glyph SFMLGlyph = font->This.getGlyph(codePoint, characterSize, bold == sfTrue, outlineThickness);
glyph.advance = SFMLGlyph.advance;
glyph.bounds.left = SFMLGlyph.bounds.left;
+7
View File
@@ -281,3 +281,10 @@ sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture)
{
CSFML_CALL_RETURN(renderTexture, isRepeated(), sfFalse);
}
////////////////////////////////////////////////////////////
sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture)
{
CSFML_CALL_RETURN(renderTexture, generateMipmap(), sfFalse);
}
+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));
}
+265 -53
View File
@@ -34,26 +34,34 @@
////////////////////////////////////////////////////////////
sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* fragmentShaderFilename)
sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename)
{
bool success = false;
sfShader* shader = new sfShader;
if (vertexShaderFilename || fragmentShaderFilename)
if (vertexShaderFilename || geometryShaderFilename || fragmentShaderFilename)
{
if (!vertexShaderFilename)
if (!geometryShaderFilename)
{
// fragment shader only
success = shader->This.loadFromFile(fragmentShaderFilename, sf::Shader::Fragment);
}
else if (!fragmentShaderFilename)
{
// vertex shader only
success = shader->This.loadFromFile(vertexShaderFilename, sf::Shader::Vertex);
if (!vertexShaderFilename)
{
// fragment shader only
success = shader->This.loadFromFile(fragmentShaderFilename, sf::Shader::Fragment);
}
else if (!fragmentShaderFilename)
{
// vertex shader only
success = shader->This.loadFromFile(vertexShaderFilename, sf::Shader::Vertex);
}
else
{
// vertex + fragment shaders
success = shader->This.loadFromFile(vertexShaderFilename, fragmentShaderFilename);
}
}
else
{
// vertex + fragment shaders
success = shader->This.loadFromFile(vertexShaderFilename, fragmentShaderFilename);
// vertex + geometry + fragment shaders
success = shader->This.loadFromFile(vertexShaderFilename, geometryShaderFilename, fragmentShaderFilename);
}
}
@@ -68,26 +76,34 @@ sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char*
////////////////////////////////////////////////////////////
sfShader* sfShader_createFromMemory(const char* vertexShader, const char* fragmentShader)
sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader)
{
bool success = false;
sfShader* shader = new sfShader;
if (vertexShader || fragmentShader)
if (vertexShader || geometryShader || fragmentShader)
{
if (!vertexShader)
if (!geometryShader)
{
// fragment shader only
success = shader->This.loadFromMemory(fragmentShader, sf::Shader::Fragment);
}
else if (!fragmentShader)
{
// vertex shader only
success = shader->This.loadFromMemory(vertexShader, sf::Shader::Vertex);
if (!vertexShader)
{
// fragment shader only
success = shader->This.loadFromMemory(fragmentShader, sf::Shader::Fragment);
}
else if (!fragmentShader)
{
// vertex shader only
success = shader->This.loadFromMemory(vertexShader, sf::Shader::Vertex);
}
else
{
// vertex + fragment shaders
success = shader->This.loadFromMemory(vertexShader, fragmentShader);
}
}
else
{
// vertex + fragment shaders
success = shader->This.loadFromMemory(vertexShader, fragmentShader);
// vertex + geometry + fragment shaders
success = shader->This.loadFromMemory(vertexShader, geometryShader, fragmentShader);
}
}
@@ -102,30 +118,41 @@ sfShader* sfShader_createFromMemory(const char* vertexShader, const char* fragme
////////////////////////////////////////////////////////////
sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* fragmentShaderStream)
sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream)
{
bool success = false;
sfShader* shader = new sfShader;
if (vertexShaderStream || fragmentShaderStream)
if (vertexShaderStream || geometryShaderStream || fragmentShaderStream)
{
if (!vertexShaderStream)
if (!geometryShaderStream)
{
// fragment shader only
CallbackStream stream(fragmentShaderStream);
success = shader->This.loadFromStream(stream, sf::Shader::Fragment);
}
else if (!fragmentShaderStream)
{
// vertex shader only
CallbackStream stream(vertexShaderStream);
success = shader->This.loadFromStream(stream, sf::Shader::Vertex);
if (!vertexShaderStream)
{
// fragment shader only
CallbackStream stream(fragmentShaderStream);
success = shader->This.loadFromStream(stream, sf::Shader::Fragment);
}
else if (!fragmentShaderStream)
{
// vertex shader only
CallbackStream stream(vertexShaderStream);
success = shader->This.loadFromStream(stream, sf::Shader::Vertex);
}
else
{
// vertex + fragment shaders
CallbackStream vertexStream(vertexShaderStream);
CallbackStream fragmentStream(fragmentShaderStream);
success = shader->This.loadFromStream(vertexStream, fragmentStream);
}
}
else
{
// vertex + fragment shaders
// vertex + geometry + fragment shaders
CallbackStream vertexStream(vertexShaderStream);
CallbackStream geometryStream(geometryShaderStream);
CallbackStream fragmentStream(fragmentShaderStream);
success = shader->This.loadFromStream(vertexStream, fragmentStream);
success = shader->This.loadFromStream(vertexStream, geometryStream, fragmentStream);
}
}
@@ -142,97 +169,282 @@ sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputSt
////////////////////////////////////////////////////////////
void sfShader_destroy(sfShader* shader)
{
delete shader;
delete shader;
}
////////////////////////////////////////////////////////////
void sfShader_setFloatUniform(sfShader* shader, const char* name, float x)
{
CSFML_CALL(shader, setUniform(name, x));
}
////////////////////////////////////////////////////////////
void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec2(vector.x, vector.y)));
}
////////////////////////////////////////////////////////////
void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec3(vector.x, vector.y, vector.z)));
}
////////////////////////////////////////////////////////////
void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec4(vector.x, vector.y, vector.z, vector.w)));
}
////////////////////////////////////////////////////////////
void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color)
{
sfGlslVec4 vec4;
vec4.x = color.r / 255.f;
vec4.y = color.g / 255.f;
vec4.z = color.b / 255.f;
vec4.w = color.a / 255.f;
sfShader_setVec4Uniform(shader, name, vec4);
}
////////////////////////////////////////////////////////////
void sfShader_setIntUniform(sfShader* shader, const char* name, int x)
{
CSFML_CALL(shader, setUniform(name, x));
}
////////////////////////////////////////////////////////////
void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec2(vector.x, vector.y)));
}
////////////////////////////////////////////////////////////
void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec3(vector.x, vector.y, vector.z)));
}
////////////////////////////////////////////////////////////
void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec4(vector.x, vector.y, vector.z, vector.w)));
}
////////////////////////////////////////////////////////////
void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color)
{
sfGlslIvec4 ivec4;
ivec4.x = (int)color.r;
ivec4.y = (int)color.g;
ivec4.z = (int)color.b;
ivec4.w = (int)color.a;
sfShader_setIvec4Uniform(shader, name, ivec4);
}
////////////////////////////////////////////////////////////
void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x)
{
CSFML_CALL(shader, setUniform(name, x));
}
////////////////////////////////////////////////////////////
void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec2(vector.x, vector.y)));
}
////////////////////////////////////////////////////////////
void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec3(vector.x, vector.y, vector.z)));
}
////////////////////////////////////////////////////////////
void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec4(vector.x, vector.y, vector.z, vector.w)));
}
////////////////////////////////////////////////////////////
void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Mat3(matrix->array)));
}
////////////////////////////////////////////////////////////
void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix)
{
CSFML_CALL(shader, setUniform(name, sf::Glsl::Mat4(matrix->array)));
}
////////////////////////////////////////////////////////////
void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture)
{
CSFML_CALL(shader, setUniform(name, *texture->This));
}
////////////////////////////////////////////////////////////
void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name)
{
CSFML_CALL(shader, setUniform(name, sf::Shader::CurrentTexture));
}
////////////////////////////////////////////////////////////
void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, scalarArray, length));
}
////////////////////////////////////////////////////////////
void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, reinterpret_cast<const sf::Glsl::Vec2*>(vectorArray), length));
}
////////////////////////////////////////////////////////////
void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, reinterpret_cast<const sf::Glsl::Vec3*>(vectorArray), length));
}
////////////////////////////////////////////////////////////
void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, reinterpret_cast<const sf::Glsl::Vec4*>(vectorArray), length));
}
////////////////////////////////////////////////////////////
void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, reinterpret_cast<const sf::Glsl::Mat3*>(matrixArray), length));
}
////////////////////////////////////////////////////////////
void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length)
{
CSFML_CALL(shader, setUniformArray(name, reinterpret_cast<const sf::Glsl::Mat4*>(matrixArray), length));
}
////////////////////////////////////////////////////////////
void sfShader_setFloatParameter(sfShader* shader, const char* name, float x)
{
CSFML_CALL(shader, setParameter(name, x));
CSFML_CALL(shader, setParameter(name, x));
}
////////////////////////////////////////////////////////////
void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y)
{
CSFML_CALL(shader, setParameter(name, x, y));
CSFML_CALL(shader, setParameter(name, x, y));
}
////////////////////////////////////////////////////////////
void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z)
{
CSFML_CALL(shader, setParameter(name, x, y, z));
CSFML_CALL(shader, setParameter(name, x, y, z));
}
////////////////////////////////////////////////////////////
void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w)
{
CSFML_CALL(shader, setParameter(name, x, y, z, w));
CSFML_CALL(shader, setParameter(name, x, y, z, w));
}
////////////////////////////////////////////////////////////
void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector)
{
CSFML_CALL(shader, setParameter(name, sf::Vector2f(vector.x, vector.y)));
CSFML_CALL(shader, setParameter(name, sf::Vector2f(vector.x, vector.y)));
}
////////////////////////////////////////////////////////////
void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector)
{
CSFML_CALL(shader, setParameter(name, sf::Vector3f(vector.x, vector.y, vector.z)));
CSFML_CALL(shader, setParameter(name, sf::Vector3f(vector.x, vector.y, vector.z)));
}
////////////////////////////////////////////////////////////
void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color)
{
CSFML_CALL(shader, setParameter(name, sf::Color(color.r, color.g, color.b, color.a)));
CSFML_CALL(shader, setParameter(name, sf::Color(color.r, color.g, color.b, color.a)));
}
////////////////////////////////////////////////////////////
void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform)
{
CSFML_CALL(shader, setParameter(name, convertTransform(transform)));
CSFML_CALL(shader, setParameter(name, convertTransform(transform)));
}
////////////////////////////////////////////////////////////
void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture)
{
CSFML_CHECK(texture);
CSFML_CALL(shader, setParameter(name, *texture->This));
CSFML_CHECK(texture);
CSFML_CALL(shader, setParameter(name,*texture->This));
}
////////////////////////////////////////////////////////////
void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name)
{
CSFML_CALL(shader, setParameter(name, sf::Shader::CurrentTexture));
CSFML_CALL(shader, setParameter(name, sf::Shader::CurrentTexture));
}
////////////////////////////////////////////////////////////
unsigned int sfShader_getNativeHandle(const sfShader* shader)
{
CSFML_CALL_RETURN(shader, getNativeHandle(), 0);
CSFML_CALL_RETURN(shader, getNativeHandle(), 0);
}
////////////////////////////////////////////////////////////
void sfShader_bind(const sfShader* shader)
{
sf::Shader::bind(shader ? &shader->This : NULL);
sf::Shader::bind(shader ? &shader->This : NULL);
}
////////////////////////////////////////////////////////////
sfBool sfShader_isAvailable(void)
{
return sf::Shader::isAvailable() ? sfTrue : sfFalse;
return sf::Shader::isAvailable() ? sfTrue : sfFalse;
}
////////////////////////////////////////////////////////////
sfBool sfShader_isGeometryAvailable(void)
{
return sf::Shader::isGeometryAvailable() ? sfTrue : sfFalse;
}
+53 -2
View File
@@ -219,7 +219,28 @@ void sfText_setStyle(sfText* text, sfUint32 style)
////////////////////////////////////////////////////////////
void sfText_setColor(sfText* text, sfColor color)
{
CSFML_CALL(text, setColor(sf::Color(color.r, color.g, color.b, color.a)));
sfText_setFillColor(text, color);
}
////////////////////////////////////////////////////////////
void sfText_setFillColor(sfText* text, sfColor color)
{
CSFML_CALL(text, setFillColor(sf::Color(color.r, color.g, color.b, color.a)));
}
////////////////////////////////////////////////////////////
void sfText_setOutlineColor(sfText* text, sfColor color)
{
CSFML_CALL(text, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a)));
}
////////////////////////////////////////////////////////////
void sfText_setOutlineThickness(sfText* text, float thickness)
{
CSFML_CALL(text, setOutlineThickness(thickness));
}
@@ -268,11 +289,18 @@ sfUint32 sfText_getStyle(const sfText* text)
////////////////////////////////////////////////////////////
sfColor sfText_getColor(const sfText* text)
{
return sfText_getFillColor(text);
}
////////////////////////////////////////////////////////////
sfColor sfText_getFillColor(const sfText* text)
{
sfColor color = {0, 0, 0, 0};
CSFML_CHECK_RETURN(text, color);
sf::Color sfmlColor = text->This.getColor();
sf::Color sfmlColor = text->This.getFillColor();
color.r = sfmlColor.r;
color.g = sfmlColor.g;
color.b = sfmlColor.b;
@@ -282,6 +310,29 @@ sfColor sfText_getColor(const sfText* text)
}
////////////////////////////////////////////////////////////
sfColor sfText_getOutlineColor(const sfText* text)
{
sfColor color = { 0, 0, 0, 0 };
CSFML_CHECK_RETURN(text, color);
sf::Color sfmlColor = text->This.getOutlineColor();
color.r = sfmlColor.r;
color.g = sfmlColor.g;
color.b = sfmlColor.b;
color.a = sfmlColor.a;
return color;
}
////////////////////////////////////////////////////////////
float sfText_getOutlineThickness(const sfText* text)
{
CSFML_CALL_RETURN(text, getOutlineThickness(), 0.f);
}
////////////////////////////////////////////////////////////
sfVector2f sfText_findCharacterPos(const sfText* text, size_t index)
{
+21
View File
@@ -225,6 +225,20 @@ sfBool sfTexture_isSmooth(const sfTexture* texture)
}
////////////////////////////////////////////////////////////
void sfTexture_setSrgb(sfTexture* texture, sfBool sRgb)
{
CSFML_CALL_PTR(texture, setSrgb(sRgb == sfTrue));
}
////////////////////////////////////////////////////////////
sfBool sfTexture_isSrgb(const sfTexture* texture)
{
CSFML_CALL_PTR_RETURN(texture, isSrgb(), sfFalse);
}
////////////////////////////////////////////////////////////
void sfTexture_setRepeated(sfTexture* texture, sfBool repeated)
{
@@ -242,6 +256,13 @@ sfBool sfTexture_isRepeated(const sfTexture* texture)
}
////////////////////////////////////////////////////////////
sfBool sfTexture_generateMipmap(sfTexture* texture)
{
CSFML_CALL_PTR_RETURN(texture, generateMipmap(), sfFalse);
}
////////////////////////////////////////////////////////////
unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
{
+4
View File
@@ -53,6 +53,10 @@ namespace
const sfIpAddress sfIpAddress_None = sfIpAddress_fromBytes(0, 0, 0, 0);
////////////////////////////////////////////////////////////
const sfIpAddress sfIpAddress_Any = sfIpAddress_fromBytes(0, 0, 0, 0);
////////////////////////////////////////////////////////////
const sfIpAddress sfIpAddress_LocalHost = sfIpAddress_fromBytes(127, 0, 0, 1);
+3 -2
View File
@@ -67,11 +67,12 @@ unsigned short sfTcpListener_getLocalPort(const sfTcpListener* listener)
////////////////////////////////////////////////////////////
sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port)
sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address)
{
CSFML_CHECK_RETURN(listener, sfSocketError);
return static_cast<sfSocketStatus>(listener->This.listen(port));
sf::IpAddress sfmlAddress(address.address);
return static_cast<sfSocketStatus>(listener->This.listen(port, sfmlAddress));
}
+3 -2
View File
@@ -68,11 +68,12 @@ unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* socket)
////////////////////////////////////////////////////////////
sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port)
sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address)
{
CSFML_CHECK_RETURN(socket, sfSocketError);
return static_cast<sfSocketStatus>(socket->This.bind(port));
sf::IpAddress sfmlAddress(address.address);
return static_cast<sfSocketStatus>(socket->This.bind(port, sfmlAddress));
}
+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)
{