mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Update for 2.5.0
This commit is contained in:
1 parent
75f95202b7
commit
7ef69e3b1c
40 files changed
+1327
-24
No files matched your search
@@ -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)
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user