mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 21:16: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
@@ -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
|
||||
Reference in new issue
Block a user