Update for 2.5.0

This commit is contained in:
spacechase0 committed 2018-06-05 14:05:52 -04:00
1 parent 75f95202b7
commit 7ef69e3b1c
40 files changed
+1327 -24

No files matched your search

+2 -2
View File
@@ -21,7 +21,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
# setup version numbers
set(VERSION_MAJOR 2)
set(VERSION_MINOR 4)
set(VERSION_MINOR 5)
set(VERSION_PATCH 0)
# add the CSFML header path
@@ -42,7 +42,7 @@ set(CMAKE_SKIP_BUILD_RPATH TRUE)
# define an option for choosing between static and dynamic C runtime (Windows only)
if(SFML_OS_WINDOWS)
set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
# for VC++, we can apply it globally by modifying the compiler flags
if(SFML_COMPILER_MSVC AND STATIC_STD_LIBS)
foreach(flag
+50
View File
@@ -37,6 +37,17 @@
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Structure defining a time range
///
////////////////////////////////////////////////////////////
typedef struct
{
sfTime offset; ///< The beginning offset of the time range
sfTime length; ///< The length of the time range
} sfTimeSpan;
////////////////////////////////////////////////////////////
/// \brief Create a new music and load it from a file
///
@@ -128,6 +139,45 @@ CSFML_AUDIO_API sfBool sfMusic_getLoop(const sfMusic* music);
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Get the positions of the of the sound's looping sequence
///
/// \return Loop Time position class.
///
/// \warning Since sfMusic_setLoopPoints() performs some adjustments on the
/// provided values and rounds them to internal samples, a call to
/// sfMusic_getLoopPoints() is not guaranteed to return the same times passed
/// into a previous call to sfMusic_setLoopPoints(). However, it is guaranteed
/// to return times that will map to the valid internal samples of
/// this Music if they are later passed to sfMusic_setLoopPoints().
///
/// \see setLoopPoints
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
///
/// Loop points allow one to specify a pair of positions such that, when the music
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
/// encounters the end. Valid ranges for timePoints.offset and timePoints.length are
/// [0, Dur) and (0, Dur-offset] respectively, where Dur is the value returned by sfMusic_getDuration().
/// Note that the EOF "loop point" from the end to the beginning of the stream is still honored,
/// in case the caller seeks to a point after the end of the loop range. This function can be
/// safely called at any point after a stream is opened, and will be applied to a playing sound
/// without affecting the current playing offset.
///
/// \warning Setting the loop points while the stream's status is Paused
/// will set its status to Stopped. The playing offset will be unaffected.
///
/// \param timePoints The definition of the loop. Can be any time points within the sound's length
///
/// \see getLoopPoints
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setLoopPoints(sfMusic* music, sfTimeSpan timePoints);
////////////////////////////////////////////////////////////
/// \brief Start or resume playing a music
///
+1 -1
View File
@@ -30,7 +30,7 @@
// Define the CSFML version
////////////////////////////////////////////////////////////
#define CSFML_VERSION_MAJOR 2
#define CSFML_VERSION_MINOR 4
#define CSFML_VERSION_MINOR 5
#define CSFML_VERSION_PATCH 0
+74
View File
@@ -0,0 +1,74 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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_GPUPREFERENCE_H
#define SFML_GPUPREFERENCE_H
////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.h>
////////////////////////////////////////////////////////////
/// \file
///
/// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE
///
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE
///
/// \brief A macro to encourage usage of the discrete GPU
///
/// In order to inform the Nvidia/AMD driver that an SFML
/// application could benefit from using the more powerful
/// discrete GPU, special symbols have to be publicly
/// exported from the final executable.
///
/// SFML defines a helper macro to easily do this.
///
/// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the
/// global scope of a source file that will be linked into
/// the final executable. Typically it is best to place it
/// where the main function is also defined.
///
////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS)
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \
CSFML_EXTERN_C __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \
CSFML_EXTERN_C __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1;
#else
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE
#endif
#endif // SFML_GPUPREFERENCE_H
+1
View File
@@ -53,6 +53,7 @@
#include <SFML/Graphics/Transformable.h>
#include <SFML/Graphics/Vertex.h>
#include <SFML/Graphics/VertexArray.h>
#include <SFML/Graphics/VertexBuffer.h>
#include <SFML/Graphics/View.h>
+26
View File
@@ -35,6 +35,7 @@
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/RenderStates.h>
#include <SFML/Graphics/Vertex.h>
#include <SFML/Window/Window.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
@@ -48,9 +49,24 @@
///
/// \return A new sfRenderTexture object, or NULL if it failed
///
/// \deprecated
/// Use sfRenderTexture_createWithSettings instead.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer);
////////////////////////////////////////////////////////////
/// \brief Construct a new render texture
///
/// \param width Width of the render texture
/// \param height Height of the render texture
/// \param settings Settings of the render texture
///
/// \return A new sfRenderTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_createWithSettings(unsigned int width, unsigned int height, sfContextSettings settings);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing render texture
///
@@ -205,6 +221,7 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawCircleShape(sfRenderTexture* renderT
CSFML_GRAPHICS_API void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBuffer(sfRenderTexture* renderTexture, const sfVertexBuffer* object, const sfRenderStates* states);
////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices to a render texture
@@ -278,6 +295,15 @@ CSFML_GRAPHICS_API void sfRenderTexture_resetGLStates(sfRenderTexture* renderTex
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// \brief Get the maximum anti-aliasing level supported by the system
///
/// \return The maximum anti-aliasing level supported by the system
///
////////////////////////////////////////////////////////////
unsigned int sfRenderTexture_getMaximumAntialiasingLevel();
////////////////////////////////////////////////////////////
/// \brief Enable or disable the smooth filter on a render texture
///
+20
View File
@@ -241,6 +241,25 @@ CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* ren
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed);
////////////////////////////////////////////////////////////
/// \brief Set the displayed cursor to a native system cursor
///
/// Upon window creation, the arrow cursor is used by default.
///
/// \warning The cursor must not be destroyed while in use by
/// the window.
///
/// \warning Features related to Cursor are not supported on
/// iOS and Android.
///
/// \param cursor Native system cursor type to display
///
/// \see sfCursor_createFromSystem
/// \see sfCursor_createFromPixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursor(sfRenderWindow* window, const sfCursor* cursor);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat for keydown events
///
@@ -445,6 +464,7 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWin
CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow, const sfConvexShape* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertexArray* object, const sfRenderStates* states);
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow, const sfVertexBuffer* object, const sfRenderStates* states);
////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices to a render window
+59
View File
@@ -276,6 +276,41 @@ CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
////////////////////////////////////////////////////////////
/// \brief Set the line spacing factor
///
/// The default spacing between lines is defined by the font.
/// This method enables you to set a factor for the spacing
/// between lines. By default the line spacing factor is 1.
///
/// \param text Text object
/// \param spacingFactor New line spacing factor
///
/// \see sfText_getLineSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setLineSpacing(sfText* text, float spacingFactor);
////////////////////////////////////////////////////////////
/// \brief Set the letter spacing factor
///
/// The default spacing between letters is defined by the font.
/// This factor doesn't directly apply to the existing
/// spacing between each character, it rather adds a fixed
/// space between them which is calculated from the font
/// metrics and the character size.
/// Note that factors below 1 (including negative numbers) bring
/// characters closer to each other.
/// By default the letter spacing factor is 1.
///
/// \param text Text object
/// \param spacingFactor New letter spacing factor
///
/// \see sfText_getLetterSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setLetterSpacing(sfText* text, float spacingFactor);
////////////////////////////////////////////////////////////
/// \brief Set the style of a text
///
@@ -388,6 +423,30 @@ CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the size of the letter spacing factor
///
/// \param text Text object
///
/// \return Size of the letter spacing factor
///
/// \see sfText_setLetterSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfText_getLetterSpacing(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the size of the line spacing factor
///
/// \param text Text object
///
/// \return Size of the line spacing factor
///
/// \see sfText_setLineSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float getLineSpacing(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the style of a text
///
+27
View File
@@ -144,6 +144,24 @@ CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Update a part of this texture from another texture
///
/// No additional check is performed on the size of the texture,
/// passing an invalid combination of texture size and offset
/// will lead to an undefined behavior.
///
/// This function does nothing if either texture was not
/// previously created.
///
/// \param destination Destination texture to copy source texture to
/// \param source Source texture to copy to destination texture
/// \param x X offset in this texture where to copy the source texture
/// \param y Y offset in this texture where to copy the source texture
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Update a texture from an image
///
@@ -289,6 +307,15 @@ CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Swap the contents of a texture with those of another
///
/// \param left Instance to swap from
/// \param right Instance to swap with
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the texture.
///
+13
View File
@@ -206,5 +206,18 @@ CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX,
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);
////////////////////////////////////////////////////////////
/// \brief Compare two transforms for equality
///
/// Performs an element-wise comparison of the elements of the
/// left transform with the elements of the right transform.
///
/// \param left Left operand (the first transform)
/// \param right Right operand (the second transform)
///
/// \return true if the transforms are equal, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTransform_equal(sfTransform* left, sfTransform* right);
#endif // SFML_TRANSFORM_H
+1
View File
@@ -40,6 +40,7 @@ typedef struct sfText sfText;
typedef struct sfTexture sfTexture;
typedef struct sfTransformable sfTransformable;
typedef struct sfVertexArray sfVertexArray;
typedef struct sfVertexBuffer sfVertexBuffer;
typedef struct sfView sfView;
+254
View File
@@ -0,0 +1,254 @@
////////////////////////////////////////////////////////////
//
// 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_VERTEXBUFFER_H
#define SFML_VERTEXBUFFER_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Vertex.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Usage specifiers
///
/// If data is going to be updated once or more every frame,
/// set the usage to sfVertexBufferStream. If data is going
/// to be set once and used for a long time without being
/// modified, set the usage to sfVertexBufferUsageStatic.
/// For everything else sfVertexBufferUsageDynamic should
/// be a good compromise.
///
////////////////////////////////////////////////////////////
typedef enum
{
sfVertexBufferStream, ///< Constantly changing data
sfVertexBufferDynamic, ///< Occasionally changing data
sfVertexBufferStatic ///< Rarely changing data
} sfVertexBufferUsage;
////////////////////////////////////////////////////////////
/// \brief Create a new vertex buffer with a specific
/// sfPrimitiveType and usage specifier.
///
/// Creates the vertex buffer, allocating enough graphcis
/// memory to hold \p vertexCount vertices, and sets its
/// primitive type to \p type and usage to \p usage.
///
/// \param vertexCount Amount of vertices
/// \param type Type of primitive
/// \param usage Usage specifier
///
/// \return A new sfVertexBuffer object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
////////////////////////////////////////////////////////////
/// \brief Copy an existing vertex buffer
///
/// \param vertexBuffer Vertex buffer to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing vertex buffer
///
/// \param vertexBuffer Vertex buffer to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_destroy(sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Return the vertex count
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Number of vertices in the vertex buffer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Update a part of the buffer from an array of vertices
///
/// \p offset is specified as the number of vertices to skip
/// from the beginning of the buffer.
///
/// If \p offset is 0 and \p vertexCount is equal to the size of
/// the currently created buffer, its whole contents are replaced.
///
/// If \p offset is 0 and \p vertexCount is greater than the
/// size of the currently created buffer, a new buffer is created
/// containing the vertex data.
///
/// If \p offset is 0 and \p vertexCount is less than the size of
/// the currently created buffer, only the corresponding region
/// is updated.
///
/// If \p offset is not 0 and \p offset + \p vertexCount is greater
/// than the size of the currently created buffer, the update fails.
///
/// No additional check is performed on the size of the vertex
/// array, passing invalid arguments will lead to undefined
/// behavior.
///
/// \param vertices Array of vertices to copy to the buffer
/// \param vertexCount Number of vertices to copy
/// \param offset Offset in the buffer to copy to
///
/// \return sfTrue if the update was successful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer, const sfVertex* vertices, unsigned int vertexCount, unsigned int offset);
////////////////////////////////////////////////////////////
/// \brief Copy the contents of another buffer into this buffer
///
/// \param vertexBuffer Vertex buffer object
/// \param other Vertex buffer whose contents to copy into first vertex buffer
///
/// \return sfTrue if the copy was successful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other);
////////////////////////////////////////////////////////////
/// \brief Swap the contents of this vertex buffer with those of another
///
/// \param left Instance to swap
/// \param right Instance to swap with
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the vertex buffer.
///
/// 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.
///
/// \return OpenGL handle of the vertex buffer or 0 if not yet created
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Set the type of primitives to draw
///
/// This function defines how the vertices must be interpreted
/// when it's time to draw them.
///
/// The default primitive type is sf::Points.
///
/// \param vertexBuffer Vertex buffer object
/// \param type Type of primitive
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type);
////////////////////////////////////////////////////////////
/// \brief Get the type of primitives drawn by the vertex buffer
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Primitive type
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Set the usage specifier of this vertex buffer
///
/// This function provides a hint about how this vertex buffer is
/// going to be used in terms of data update frequency.
///
/// After changing the usage specifier, the vertex buffer has
/// to be updated with new data for the usage specifier to
/// take effect.
///
/// The default primitive type is sfVertexBufferStream.
///
/// \param vertexBuffer Vertex buffer object
/// \param usage Usage specifier
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage);
////////////////////////////////////////////////////////////
/// \brief Get the usage specifier of this vertex buffer
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Usage specifier
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Bind a vertex buffer for rendering
///
/// This function is not part of the graphics API, it mustn't be
/// used when drawing SFML entities. It must be used only if you
/// mix sfVertexBuffer with OpenGL code.
///
/// \code
/// sfVertexBuffer* vb1, vb2;
/// ...
/// sfVertexBuffer_bind(vb1);
/// // draw OpenGL stuff that use vb1...
/// sfVertexBuffer_bind(vb2);
/// // draw OpenGL stuff that use vb2...
/// sfVertexBuffer_bind(NULL);
/// // draw OpenGL stuff that use no vertex buffer...
/// \endcode
///
/// \param vertexBuffer Pointer to the vertex buffer to bind, can be null to use no vertex buffer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports vertex buffers
///
/// This function should always be called before using
/// the vertex buffer features. If it returns false, then
/// any attempt to use sf::VertexBuffer will fail.
///
/// \return True if vertex buffers are supported, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_isAvailable();
#endif // SFML_VERTEXBUFFER_H
+2 -1
View File
@@ -500,11 +500,12 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFi
/// \param localFile Path of the local file to upload
/// \param remotePath Where to put to file on the server
/// \param mode Transfer mode
/// \param append Pass sfTrue to append to or sfFalse to overwrite the remote file if it already exists
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode);
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append);
////////////////////////////////////////////////////////////
/// \brief Send a command to the FTP server
+2
View File
@@ -30,7 +30,9 @@
////////////////////////////////////////////////////////////
#include <SFML/System.h>
#include <SFML/Window/Clipboard.h>
#include <SFML/Window/Context.h>
#include <SFML/Window/Cursor.h>
#include <SFML/Window/Event.h>
#include <SFML/Window/Joystick.h>
#include <SFML/Window/JoystickIdentification.h>
+85
View File
@@ -0,0 +1,85 @@
////////////////////////////////////////////////////////////
//
// 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_CLIPBOARD_H
#define SFML_CLIPBOARD_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
////////////////////////////////////////////////////////////
/// \brief Get the content of the clipboard as string data (returns an ANSI string)
///
/// This function returns the content of the clipboard
/// as a string. If the clipboard does not contain string
/// it returns an empty string.
///
/// \return Clipboard contents as a locale-dependent ANSI string
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API const char* sfClipboard_getString();
////////////////////////////////////////////////////////////
/// \brief Get the content of the clipboard as string data (returns a Unicode string)
///
/// This function returns the content of the clipboard
/// as a string. If the clipboard does not contain string
/// it returns an empty string.
///
/// \return Clipboard contents as UTF-32
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API const sfUint32* sfClipboard_getUnicodeString();
////////////////////////////////////////////////////////////
/// \brief Set the content of the clipboard as ANSI string data
///
/// This function sets the content of the clipboard as an
/// ANSI string.
///
/// \param text ANSI string containing the data to be sent
/// to the clipboard
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfClipboard_setString(const char* text);
////////////////////////////////////////////////////////////
/// \brief Set the content of the clipboard as Unicode string data
///
/// This function sets the content of the clipboard as a
/// Unicode string.
///
/// \param text Unicode string containing the data to be sent
/// to the clipboard
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfClipboard_setUnicodeString(const sfUint32* text);
#endif // SFML_CURSOR_H
+11
View File
@@ -73,4 +73,15 @@ CSFML_WINDOW_API sfBool sfContext_setActive(sfContext* context, sfBool active);
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfContextSettings sfContext_getSettings(const sfContext* context);
////////////////////////////////////////////////////////////
/// \brief Get the currently active context's ID
///
/// The context ID is used to identify contexts when
/// managing unshareable OpenGL resources.
///
/// \return The active context's ID or 0 if no context is currently active
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfUint64 sfContext_getActiveContextId();
#endif // SFML_CONTEXT_H
+132
View File
@@ -0,0 +1,132 @@
////////////////////////////////////////////////////////////
//
// 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_CURSOR_H
#define SFML_CURSOR_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Vector2.h>
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
////////////////////////////////////////////////////////////
/// \brief Enumeration of the native system cursor types
///
/// Refer to the following table to determine which cursor
/// is available on which platform.
///
/// Type | Linux | Mac OS X | Windows
/// ------------------------------------|:-----:|:--------:|:--------:
/// sfCursorArrow | yes | yes | yes
/// sfCursorArrowWait | no | no | yes
/// sfCursorWait | yes | no | yes
/// sfCursorText | yes | yes | yes
/// sfCursorHand | yes | yes | yes
/// sfCursorSizeHorizontal | yes | yes | yes
/// sfCursorSizeVertical | yes | yes | yes
/// sfCursorSizeTopLeftBottomRight | no | no | yes
/// sfCursorSizeBottomLeftTopRight | no | no | yes
/// sfCursorSizeAll | yes | no | yes
/// sfCursorCross | yes | yes | yes
/// sfCursorHelp | yes | no | yes
/// sfCursorNotAllowed | yes | yes | yes
///
////////////////////////////////////////////////////////////
typedef enum
{
sfCursorArrow, ///< Arrow cursor (default)
sfCursorArrowWait, ///< Busy arrow cursor
sfCursorWait, ///< Busy cursor
sfCursorText, ///< I-beam, cursor when hovering over a field allowing text entry
sfCursorHand, ///< Pointing hand cursor
sfCursorSizeHorizontal, ///< Horizontal double arrow cursor
sfCursorSizeVertical, ///< Vertical double arrow cursor
sfCursorSizeTopLeftBottomRight, ///< Double arrow cursor going from top-left to bottom-right
sfCursorSizeBottomLeftTopRight, ///< Double arrow cursor going from bottom-left to top-right
sfCursorSizeAll, ///< Combination of SizeHorizontal and SizeVertical
sfCursorCross, ///< Crosshair cursor
sfCursorHelp, ///< Help cursor
sfCursorNotAllowed ///< Action not allowed cursor
} sfCursorType;
////////////////////////////////////////////////////////////
/// \brief Create a cursor with the provided image
///
/// \a pixels must be an array of \a width by \a height pixels
/// in 32-bit RGBA format. If not, this will cause undefined behavior.
///
/// If \a pixels is null or either \a width or \a height are 0,
/// the current cursor is left unchanged and the function will
/// return false.
///
/// In addition to specifying the pixel data, you can also
/// specify the location of the hotspot of the cursor. The
/// hotspot is the pixel coordinate within the cursor image
/// which will be located exactly where the mouse pointer
/// position is. Any mouse actions that are performed will
/// return the window/screen location of the hotspot.
///
/// \warning On Unix, the pixels are mapped into a monochrome
/// bitmap: pixels with an alpha channel to 0 are
/// transparent, black if the RGB channel are close
/// to zero, and white otherwise.
///
/// \param pixels Array of pixels of the image
/// \param size Width and height of the image
/// \param hotspot (x,y) location of the hotspot
/// \return A new sfCursor object
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfCursor* sfCursor_createFromPixels(const sfUint8* pixels, sfVector2u size, sfVector2u hotspot);
////////////////////////////////////////////////////////////
/// \brief Create a native system cursor
///
/// Refer to the list of cursor available on each system
/// (see sfCursorType) to know whether a given cursor is
/// expected to load successfully or is not supported by
/// the operating system.
///
/// \param type Native system cursor type
/// \return A new sfCursor object
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfCursor* sfCursor_createFromSystem(sfCursorType type);
////////////////////////////////////////////////////////////
/// \brief Destroy a cursor
///
/// \param cursor Cursor to destroy
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfCursor_destroy(sfCursor* cursor);
#endif // SFML_CURSOR_H
+18 -10
View File
@@ -86,18 +86,18 @@ typedef enum
sfKeyMenu, ///< The Menu key
sfKeyLBracket, ///< The [ key
sfKeyRBracket, ///< The ] key
sfKeySemiColon, ///< The ; key
sfKeySemicolon, ///< The ; key
sfKeyComma, ///< The , key
sfKeyPeriod, ///< The . key
sfKeyQuote, ///< The ' key
sfKeySlash, ///< The / key
sfKeyBackSlash, ///< The \ key
sfKeyBackslash, ///< The \ key
sfKeyTilde, ///< The ~ key
sfKeyEqual, ///< The = key
sfKeyDash, ///< The - key
sfKeyHyphen, ///< The - key (hyphen)
sfKeySpace, ///< The Space key
sfKeyReturn, ///< The Return key
sfKeyBack, ///< The Backspace key
sfKeyEnter, ///< The Enter/Return key
sfKeyBackspace, ///< The Backspace key
sfKeyTab, ///< The Tabulation key
sfKeyPageUp, ///< The Page up key
sfKeyPageDown, ///< The Page down key
@@ -105,10 +105,10 @@ typedef enum
sfKeyHome, ///< The Home key
sfKeyInsert, ///< The Insert key
sfKeyDelete, ///< The Delete key
sfKeyAdd, ///< +
sfKeySubtract, ///< -
sfKeyMultiply, ///< *
sfKeyDivide, ///< /
sfKeyAdd, ///< The + key
sfKeySubtract, ///< The - key (minus, usually from numpad)
sfKeyMultiply, ///< The * key
sfKeyDivide, ///< The / key
sfKeyLeft, ///< Left arrow
sfKeyRight, ///< Right arrow
sfKeyUp, ///< Up arrow
@@ -140,7 +140,15 @@ typedef enum
sfKeyF15, ///< The F15 key
sfKeyPause, ///< The Pause key
sfKeyCount ///< Keep last -- the total number of keyboard keys
sfKeyCount, ///< Keep last -- the total number of keyboard keys
// Deprecated values:
sfKeyDash = sfKeyHyphen, ///< \deprecated Use Hyphen instead
sfKeyBack = sfKeyBackspace, ///< \deprecated Use Backspace instead
sfKeyBackSlash = sfKeyBackslash, ///< \deprecated Use Backslash instead
sfKeySemiColon = sfKeySemicolon, ///< \deprecated Use Semicolon instead
sfKeyReturn = sfKeyEnter ///< \deprecated Use Enter instead
} sfKeyCode;
+1
View File
@@ -27,6 +27,7 @@
typedef struct sfContext sfContext;
typedef struct sfCursor sfCursor;
typedef struct sfWindow sfWindow;
+20
View File
@@ -354,6 +354,26 @@ CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool vi
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed);
////////////////////////////////////////////////////////////
/// \brief Set the displayed cursor to a native system cursor
///
/// Upon window creation, the arrow cursor is used by default.
///
/// \warning The cursor must not be destroyed while in use by
/// the window.
///
/// \warning Features related to Cursor are not supported on
/// iOS and Android.
///
/// \param window Window object
/// \param cursor Native system cursor type to display
///
/// \see sfCursor_createFromSystem
/// \see sfCursor_createFromPixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursor(sfWindow* window, const sfCursor* cursor);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat
///
+1 -1
View File
@@ -32,4 +32,4 @@ set(SRC
# define the csfml-audio target
csfml_add_library(csfml-audio
SOURCES ${SRC}
DEPENDS ${SFML_AUDIO_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_AUDIO_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES})
DEPENDS sfml-audio)
+23
View File
@@ -107,6 +107,29 @@ sfTime sfMusic_getDuration(const sfMusic* music)
}
////////////////////////////////////////////////////////////
sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music)
{
sfTimeSpan timeSpan = {{0}, {0}};
CSFML_CHECK_RETURN(music, timeSpan);
sf::Music::TimeSpan span = music->This.getLoopPoints();
timeSpan.offset.microseconds = span.offset.asMicroseconds();
timeSpan.length.microseconds = span.length.asMicroseconds();
return timeSpan;
}
////////////////////////////////////////////////////////////
void sfMusic_setLoopPoints(sfMusic* music, sfTimeSpan timePoints)
{
CSFML_CALL(music, setLoopPoints(sf::Music::TimeSpan(sf::microseconds(timePoints.offset.microseconds),
sf::microseconds(timePoints.length.microseconds))));
}
////////////////////////////////////////////////////////////
void sfMusic_play(sfMusic* music)
{
+1 -2
View File
@@ -23,8 +23,7 @@ if(SFML_OS_WINDOWS)
add_definitions(-DSFML_STATIC)
endif()
endif()
find_package(SFML 2 COMPONENTS system window network graphics audio REQUIRED)
include_directories(${SFML_INCLUDE_DIR})
find_package(SFML 2 COMPONENTS network graphics audio REQUIRED)
# add the modules subdirectories
add_subdirectory(System)
+4 -1
View File
@@ -61,6 +61,9 @@ set(SRC
${SRCROOT}/VertexArray.cpp
${SRCROOT}/VertexArrayStruct.h
${INCROOT}/VertexArray.h
${INCROOT}/VertexBuffer.h
${SRCROOT}/VertexBuffer.cpp
${SRCROOT}/VertexBufferStruct.h
${SRCROOT}/View.cpp
${SRCROOT}/ViewStruct.h
${INCROOT}/View.h
@@ -69,4 +72,4 @@ set(SRC
# define the csfml-graphics target
csfml_add_library(csfml-graphics
SOURCES ${SRC}
DEPENDS ${SFML_GRAPHICS_LIBRARY} ${SFML_WINDOW_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_WINDOW_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES})
DEPENDS sfml-graphics)
+35
View File
@@ -34,8 +34,10 @@
#include <SFML/Graphics/ConvexShapeStruct.h>
#include <SFML/Graphics/RectangleShapeStruct.h>
#include <SFML/Graphics/VertexArrayStruct.h>
#include <SFML/Graphics/VertexBufferStruct.h>
#include <SFML/Graphics/ConvertRenderStates.hpp>
#include <SFML/Internal.h>
#include <SFML/Window/ContextSettingsInternal.h>
////////////////////////////////////////////////////////////
@@ -51,6 +53,27 @@ sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height,
}
////////////////////////////////////////////////////////////
sfRenderTexture* sfRenderTexture_createWithSettings(unsigned int width, unsigned int height, const sfContextSettings* settings)
{
// Convert context settings
sf::ContextSettings params;
if (settings)
{
priv::sfContextSettings_writeToCpp(*settings, params);
}
// Create the render texture
sfRenderTexture* renderTexture = new sfRenderTexture;
renderTexture->This.create(width, height, params);
renderTexture->Target = new sfTexture(const_cast<sf::Texture*>(&renderTexture->This.getTexture()));
renderTexture->DefaultView.This = renderTexture->This.getDefaultView();
renderTexture->CurrentView.This = renderTexture->This.getView();
return renderTexture;
}
////////////////////////////////////////////////////////////
void sfRenderTexture_destroy(sfRenderTexture* renderTexture)
{
@@ -214,6 +237,11 @@ void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVer
CSFML_CHECK(object);
CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states)));
}
void sfRenderTexture_drawVertexBuffer(sfRenderTexture* renderTexture, const sfVertexBuffer* object, const sfRenderStates* states)
{
CSFML_CHECK(object);
CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states)));
}
////////////////////////////////////////////////////////////
@@ -263,6 +291,13 @@ void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture, sfBool smooth)
}
////////////////////////////////////////////////////////////
unsigned int sfRenderTexture_getMaximumAntialiasingLevel()
{
return sf::RenderTexture::getMaximumAntialiasingLevel();
}
////////////////////////////////////////////////////////////
sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture)
{
+16
View File
@@ -35,10 +35,12 @@
#include <SFML/Graphics/ConvexShapeStruct.h>
#include <SFML/Graphics/RectangleShapeStruct.h>
#include <SFML/Graphics/VertexArrayStruct.h>
#include <SFML/Graphics/VertexBufferStruct.h>
#include <SFML/Graphics/ConvertRenderStates.hpp>
#include <SFML/Window/Touch.hpp>
#include <SFML/Internal.h>
#include <SFML/Window/ContextSettingsInternal.h>
#include <SFML/Window/CursorStruct.h>
#include <SFML/ConvertEvent.h>
@@ -274,6 +276,15 @@ void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool g
}
////////////////////////////////////////////////////////////
void sfRenderWindow_setMouseCursor(sfRenderWindow* window, const sfCursor* cursor)
{
CSFML_CHECK(cursor);
CSFML_CALL(window, setMouseCursor(cursor->This));
}
////////////////////////////////////////////////////////////
void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled)
{
@@ -459,6 +470,11 @@ void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertex
CSFML_CHECK(object);
CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states)));
}
void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow, const sfVertexBuffer* object, const sfRenderStates* states)
{
CSFML_CHECK(object);
CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states)));
}
////////////////////////////////////////////////////////////
+29
View File
@@ -209,6 +209,20 @@ void sfText_setCharacterSize(sfText* text, unsigned int size)
}
////////////////////////////////////////////////////////////
void sfText_setLineSpacing(sfText* text, float spacingFactor)
{
CSFML_CALL(text, setLineSpacing(spacingFactor));
}
////////////////////////////////////////////////////////////
void sfText_setLetterSpacing(sfText* text, float spacingFactor)
{
CSFML_CALL(text, setLetterSpacing(spacingFactor));
}
////////////////////////////////////////////////////////////
void sfText_setStyle(sfText* text, sfUint32 style)
{
@@ -280,6 +294,21 @@ unsigned int sfText_getCharacterSize(const sfText* text)
}
////////////////////////////////////////////////////////////
float sfText_getLetterSpacing(const sfText* text)
{
CSFML_CALL_RETURN(text, getLetterSpacing(), 1);
}
////////////////////////////////////////////////////////////
float sfText_getLineSpacing(const sfText* text)
{
CSFML_CALL_RETURN(text, getLineSpacing(), 1);
}
////////////////////////////////////////////////////////////
sfUint32 sfText_getStyle(const sfText* text)
{
+10 -1
View File
@@ -38,7 +38,7 @@
sfTexture* sfTexture_create(unsigned int width, unsigned int height)
{
sfTexture* texture = new sfTexture;
if (!texture->This->create(width, height))
{
delete texture;
@@ -263,6 +263,15 @@ sfBool sfTexture_generateMipmap(sfTexture* texture)
}
////////////////////////////////////////////////////////////
void sfTexture_swap(sfTexture* left, sfTexture* right)
{
CSFML_CHECK(right);
CSFML_CALL_PTR(left, swap(*right->This));
}
////////////////////////////////////////////////////////////
unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
{
+11
View File
@@ -156,3 +156,14 @@ void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float sca
*transform = convertTransform(convertTransform(*transform).scale(scaleX, scaleY, centerX, centerY));
}
////////////////////////////////////////////////////////////
sfBool sfTransform_equal(sfTransform* left, sfTransform* right)
{
CSFML_CHECK_RETURN(left, false);
CSFML_CHECK_RETURN(right, false);
return (left->matrix == right->matrix) ? sfTrue : sfFalse;
}
+148
View File
@@ -0,0 +1,148 @@
////////////////////////////////////////////////////////////
//
// 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.
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/VertexBuffer.h>
#include <SFML/Graphics/VertexBufferStruct.h>
#include <SFML/Internal.h>
////////////////////////////////////////////////////////////
sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage)
{
sfVertexBuffer* buffer = new sfVertexBuffer;
if (!buffer->This.create(vertexCount))
{
delete buffer;
buffer = NULL;
}
else
{
buffer->This.setPrimitiveType(static_cast<sf::PrimitiveType>(type));
buffer->This.setUsage(static_cast<sf::VertexBuffer::Usage>(usage));
}
return buffer;
}
////////////////////////////////////////////////////////////
sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer)
{
sfVertexBuffer* buffer = new sfVertexBuffer;
buffer->This = sf::VertexBuffer( vertexBuffer->This );
return buffer;
}
////////////////////////////////////////////////////////////
void sfVertexBuffer_destroy(sfVertexBuffer* vertexBuffer)
{
delete vertexBuffer;
}
////////////////////////////////////////////////////////////
unsigned int sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer)
{
CSFML_CALL_RETURN(vertexBuffer, getVertexCount(), 0);
}
////////////////////////////////////////////////////////////
sfBool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer, const sfVertex* vertices, unsigned int vertexCount, unsigned int offset)
{
// the cast is safe, sfVertex has to be binary compatible with sf::Vertex
CSFML_CALL_RETURN(vertexBuffer, update(reinterpret_cast<const sf::Vertex*>(vertices), vertexCount, offset), sfFalse);
}
////////////////////////////////////////////////////////////
sfBool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other)
{
CSFML_CALL_RETURN(vertexBuffer, update(other->This), sfFalse);
}
///////////////////////////////////////////////////////////
void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right)
{
CSFML_CHECK(right);
CSFML_CALL(left, swap(right->This));
}
////////////////////////////////////////////////////////////
unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* vertexBuffer)
{
CSFML_CALL_RETURN(vertexBuffer, getNativeHandle(), 0);
}
////////////////////////////////////////////////////////////
void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type)
{
CSFML_CALL(vertexBuffer, setPrimitiveType(static_cast<sf::PrimitiveType>(type)));
}
////////////////////////////////////////////////////////////
sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer)
{
CSFML_CHECK_RETURN(vertexBuffer, sfPoints);
return static_cast<sfPrimitiveType>(vertexBuffer->This.getPrimitiveType());
}
////////////////////////////////////////////////////////////
void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage)
{
CSFML_CALL(vertexBuffer, setUsage(static_cast<sf::VertexBuffer::Usage>(usage)));
}
////////////////////////////////////////////////////////////
sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer)
{
CSFML_CHECK_RETURN(vertexBuffer, sfVertexBufferStream);
return static_cast<sfVertexBufferUsage>(vertexBuffer->This.getUsage());
}
////////////////////////////////////////////////////////////
void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer)
{
sf::VertexBuffer::bind(&vertexBuffer->This);
}
////////////////////////////////////////////////////////////
sfBool sfVertexBuffer_isAvailable()
{
return sf::VertexBuffer::isAvailable() ? sfTrue : sfFalse;
}
+43
View File
@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////
//
// 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_VERTEXBUFFERSTRUCT_H
#define SFML_VERTEXBUFFERSTRUCT_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/VertexBuffer.hpp>
////////////////////////////////////////////////////////////
// Internal structure of sfVertexBuffer
////////////////////////////////////////////////////////////
struct sfVertexBuffer
{
sf::VertexBuffer This;
};
#endif // SFML_VERTEXBUFFERSTRUCT_H
+1 -1
View File
@@ -35,4 +35,4 @@ set(SRC
# define the csfml-network target
csfml_add_library(csfml-network
SOURCES ${SRC}
DEPENDS ${SFML_NETWORK_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_NETWORK_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES})
DEPENDS sfml-network)
+3 -2
View File
@@ -299,13 +299,14 @@ sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* lo
////////////////////////////////////////////////////////////
sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode)
sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append)
{
CSFML_CHECK_RETURN(ftp, NULL);
return new sfFtpResponse(ftp->This.upload(localFile ? localFile : "",
remotePath ? remotePath : "",
static_cast<sf::Ftp::TransferMode>(mode)));
static_cast<sf::Ftp::TransferMode>(mode),
append == sfTrue));
}
+2 -1
View File
@@ -4,6 +4,7 @@ set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/System)
# all source files
set(SRC
${CMAKE_SOURCE_DIR}/include/SFML/GPUPreference.h
${INCROOT}/Export.h
${SRCROOT}/Clock.cpp
${SRCROOT}/ClockStruct.h
@@ -27,4 +28,4 @@ set(SRC
# define the csfml-system target
csfml_add_library(csfml-system
SOURCES ${SRC}
DEPENDS ${SFML_SYSTEM_LIBRARY} ${SFML_SYSTEM_DEPENDENCIES})
DEPENDS sfml-system)
+6 -1
View File
@@ -5,6 +5,11 @@ set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Window)
# all source files
set(SRC
${INCROOT}/Export.h
${INCROOT}/Clipboard.h
${SRCROOT}/Clipboard.cpp
${INCROOT}/Cursor.h
${SRCROOT}/Cursor.cpp
${SRCROOT}/CursorStruct.h
${SRCROOT}/Context.cpp
${SRCROOT}/ContextSettingsInternal.h
${SRCROOT}/ContextStruct.h
@@ -33,4 +38,4 @@ set(SRC
# define the csfml-window target
csfml_add_library(csfml-window
SOURCES ${SRC}
DEPENDS ${SFML_WINDOW_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_WINDOW_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES})
DEPENDS sfml-window)
+67
View File
@@ -0,0 +1,67 @@
////////////////////////////////////////////////////////////
//
// 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.
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Clipboard.h>
#include <SFML/Window/Clipboard.hpp>
#include <SFML/Internal.h>
namespace
{
sf::String ClipboardString;
std::string ClipboardStringAnsi;
}
////////////////////////////////////////////////////////////
const char* sfClipboard_getString()
{
ClipboardStringAnsi = sf::Clipboard::getString().toAnsiString();
return ClipboardStringAnsi.c_str();
}
////////////////////////////////////////////////////////////
const sfUint32* sfClipboard_getUnicodeString()
{
ClipboardString = sf::Clipboard::getString();
return ClipboardString.getData();
}
////////////////////////////////////////////////////////////
void sfClipboard_setString(const char* text)
{
sf::Clipboard::setString(text);
}
////////////////////////////////////////////////////////////
void sfClipboard_setUnicodeString(const sfUint32* text)
{
sf::Clipboard::setString(text);
}
+8
View File
@@ -51,6 +51,7 @@ sfBool sfContext_setActive(sfContext* context, sfBool active)
CSFML_CALL_RETURN(context, setActive(active == sfTrue), false)
}
////////////////////////////////////////////////////////////
sfContextSettings sfContext_getSettings(const sfContext* context)
{
@@ -62,3 +63,10 @@ sfContextSettings sfContext_getSettings(const sfContext* context)
return settings;
}
////////////////////////////////////////////////////////////
sfUint64 sfContext_getActiveContextId()
{
return sf::Context::getActiveContextId();
}
+68
View File
@@ -0,0 +1,68 @@
////////////////////////////////////////////////////////////
//
// 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.
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.h>
#include <SFML/Window/CursorStruct.h>
#include <SFML/Internal.h>
////////////////////////////////////////////////////////////
sfCursor* sfCursor_createFromPixels(const sfUint8* pixels, sfVector2u size, sfVector2u hotspot)
{
sfCursor* cursor = new sfCursor;
if (!cursor->This.loadFromPixels(pixels, sf::Vector2u(size.x, size.y), sf::Vector2u(hotspot.x, hotspot.y)))
{
delete cursor;
cursor = NULL;
}
return cursor;
}
////////////////////////////////////////////////////////////
sfCursor* sfCursor_createFromSystem(sfCursorType type)
{
sfCursor* cursor = new sfCursor;
if (!cursor->This.loadFromSystem(static_cast<sf::Cursor::Type>(type)))
{
delete cursor;
cursor = NULL;
}
return cursor;
}
////////////////////////////////////////////////////////////
void sfCursor_destroy(sfCursor* cursor)
{
delete cursor;
}
+43
View File
@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////
//
// 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_CURSORSTRUCT_H
#define SFML_CURSORSTRUCT_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Cursor.hpp>
////////////////////////////////////////////////////////////
// Internal structure of sfCursor
////////////////////////////////////////////////////////////
struct sfCursor
{
sf::Cursor This;
};
#endif // SFML_CURSORSTRUCT_H
+9
View File
@@ -29,6 +29,7 @@
#include <SFML/Window/WindowStruct.h>
#include <SFML/Internal.h>
#include <SFML/Window/ContextSettingsInternal.h>
#include <SFML/Window/CursorStruct.h>
#include <SFML/ConvertEvent.h>
@@ -250,6 +251,14 @@ void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed)
}
////////////////////////////////////////////////////////////
void sfWindow_setMouseCursor(sfWindow* window, const sfCursor* cursor)
{
CSFML_CHECK(cursor);
CSFML_CALL(window, setMouseCursor(cursor->This));
}
////////////////////////////////////////////////////////////
void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled)
{