mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 21:16:13 +01:00
Updated to the new graphics API
This commit is contained in:
1 parent
06997db9e8
commit
44670984af
51 files changed
+4607
-2573
No files matched your search
@@ -32,30 +32,35 @@
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/Graphics/PrimitiveType.h>
|
||||
#include <SFML/Graphics/RenderStates.h>
|
||||
#include <SFML/Graphics/Vertex.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new rendertexture
|
||||
/// \brief Construct a new render texture
|
||||
///
|
||||
/// \param width : Width of the rendertexture
|
||||
/// \param height : Height of the rendertexture
|
||||
/// \param depthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture)
|
||||
/// \param width Width of the render texture
|
||||
/// \param height Height of the render texture
|
||||
/// \param depthBuffer Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture)
|
||||
///
|
||||
/// \return A new sfRenderTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderTexture* sfRenderTexture_Create(unsigned int width, unsigned int height, sfBool depthBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing rendertexture
|
||||
/// \brief Destroy an existing render texture
|
||||
///
|
||||
/// \param renderTexture : rendertexture to destroy
|
||||
/// \param renderTexture Render texture to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_Destroy(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a rendertexture
|
||||
/// \brief Get the width of the rendering region of a render texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
@@ -63,9 +68,9 @@ CSFML_API void sfRenderTexture_Destroy(sfRenderTexture* renderTexture);
|
||||
CSFML_API unsigned int sfRenderTexture_GetWidth(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a rendertexture
|
||||
/// \brief Get the height of the rendering region of a render texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
@@ -73,10 +78,10 @@ CSFML_API unsigned int sfRenderTexture_GetWidth(const sfRenderTexture* renderTex
|
||||
CSFML_API unsigned int sfRenderTexture_GetHeight(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a rendertexture as the current target for rendering
|
||||
/// \brief Activate or deactivate a render texture as the current target for rendering
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param active : sfTrue to activate, sfFalse to deactivate
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param active sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
@@ -84,74 +89,35 @@ CSFML_API unsigned int sfRenderTexture_GetHeight(const sfRenderTexture* renderTe
|
||||
CSFML_API sfBool sfRenderTexture_SetActive(sfRenderTexture* renderTexture, sfBool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the current OpenGL render states and matrices
|
||||
/// \brief Update the contents of the target texture
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_SaveGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_RestoreGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Update the contents of the target texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_Display(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a rendertexture
|
||||
/// \brief Clear the rendertexture with the given color
|
||||
///
|
||||
/// \param renderTexture : Rendertexture to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_DrawSprite(sfRenderTexture* renderTexture, const sfSprite* sprite);
|
||||
CSFML_API void sfRenderTexture_DrawShape (sfRenderTexture* renderTexture, const sfShape* shape);
|
||||
CSFML_API void sfRenderTexture_DrawText (sfRenderTexture* renderTexture, const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a rendertexture with a shader
|
||||
///
|
||||
/// \param renderTexture : Rendertexture to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_DrawSpriteWithShader(sfRenderTexture* renderTexture, const sfSprite* sprite, const sfShader* shader);
|
||||
CSFML_API void sfRenderTexture_DrawShapeWithShader (sfRenderTexture* renderTexture, const sfShape* shape, const sfShader* shader);
|
||||
CSFML_API void sfRenderTexture_DrawTextWithShader (sfRenderTexture* renderTexture, const sfText* text, const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the rendertexture with the given color
|
||||
///
|
||||
/// \param renderTexture : Rendertexture to modify
|
||||
/// \param color : Fill color
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param color Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_Clear(sfRenderTexture* renderTexture, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current active view of a rendertexture
|
||||
/// \brief Change the current active view of a render texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture to modify
|
||||
/// \param view : Pointer to the new view
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_SetView(sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current active view of a rendertexture
|
||||
/// \brief Get the current active view of a render texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
@@ -159,9 +125,9 @@ CSFML_API void sfRenderTexture_SetView(sfRenderTexture* renderTexture, const sfV
|
||||
CSFML_API const sfView* sfRenderTexture_GetView(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the default view of a rendertexture
|
||||
/// \brief Get the default view of a render texture
|
||||
///
|
||||
/// \param renderTexture : Rendertexture
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Default view of the rendertexture
|
||||
///
|
||||
@@ -169,10 +135,10 @@ CSFML_API const sfView* sfRenderTexture_GetView(const sfRenderTexture* renderTex
|
||||
CSFML_API const sfView* sfRenderTexture_GetDefaultView(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the viewport of a view applied to this target
|
||||
/// \brief Get the viewport of a view applied to this target
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param view : Target view
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param view Target view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed in pixels in the current target
|
||||
///
|
||||
@@ -180,22 +146,99 @@ CSFML_API const sfView* sfRenderTexture_GetDefaultView(const sfRenderTexture* re
|
||||
CSFML_API sfIntRect sfRenderTexture_GetViewport(const sfRenderTexture* renderTexture, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convert a point in texture coordinates into view coordinates
|
||||
/// \brief Convert a point in texture coordinates into view coordinates
|
||||
///
|
||||
/// \param renderTexture : Rendertexture object
|
||||
/// \param windowX : X coordinate of the point to convert, relative to the texture
|
||||
/// \param windowY : Y coordinate of the point to convert, relative to the texture
|
||||
/// \param viewX : Pointer to fill with the X coordinate of the converted point
|
||||
/// \param viewY : Pointer to fill with the Y coordinate of the converted point
|
||||
/// \param targetView : Target view to convert the point to (pass NULL to use the current view)
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param windowX X coordinate of the point to convert, relative to the texture
|
||||
/// \param windowY Y coordinate of the point to convert, relative to the texture
|
||||
/// \param viewX Pointer to fill with the X coordinate of the converted point
|
||||
/// \param viewY Pointer to fill with the Y coordinate of the converted point
|
||||
/// \param targetView Target view to convert the point to (pass NULL to use the current view)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_ConvertCoords(const sfRenderTexture* renderTexture, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the target texture
|
||||
/// \brief Draw a drawable object to the render-target
|
||||
///
|
||||
/// \param renderTexture : Render-texture object
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param object Object to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_DrawSprite(sfRenderTexture* renderTexture, const sfSprite* object, const sfRenderStates* states);
|
||||
CSFML_API void sfRenderTexture_DrawText(sfRenderTexture* renderTexture, const sfText* object, const sfRenderStates* states);
|
||||
CSFML_API void sfRenderTexture_DrawCircleShape(sfRenderTexture* renderTexture, const sfCircleShape* object, const sfRenderStates* states);
|
||||
CSFML_API void sfRenderTexture_DrawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states);
|
||||
CSFML_API void sfRenderTexture_DrawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states);
|
||||
CSFML_API void sfRenderTexture_DrawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices to a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
/// \param vertices Pointer to the vertices
|
||||
/// \param vertexCount Number of vertices in the array
|
||||
/// \param type Type of primitives to draw
|
||||
/// \param states Render states to use for drawing (NULL to use the default states)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_DrawPrimitives(sfRenderTexture* renderTexture,
|
||||
const sfVertex* vertices, unsigned int vertexCount,
|
||||
sfPrimitiveType type, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the current OpenGL render states and matrices
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering. Combined with PopGLStates,
|
||||
/// it ensures that:
|
||||
/// \li SFML's internal states are not messed up by your OpenGL code
|
||||
/// \li your OpenGL states are not modified by a call to a SFML function
|
||||
///
|
||||
/// Note that this function is quite expensive: it saves all the
|
||||
/// possible OpenGL states and matrices, even the ones you
|
||||
/// don't care about. Therefore it should be used wisely.
|
||||
/// It is provided for convenience, but the best results will
|
||||
/// be achieved if you handle OpenGL states yourself (because
|
||||
/// you know which states have really changed, and need to be
|
||||
/// saved and restored). Take a look at the ResetGLStates
|
||||
/// function if you do so.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_PushGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// See the description of PushGLStates to get a detailed
|
||||
/// description of these functions.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_PopGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the internal OpenGL states so that the target is ready for drawing
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering, if you choose not to use
|
||||
/// PushGLStates/PopGLStates. It makes sure that all OpenGL
|
||||
/// states needed by SFML are set, so that subsequent sfRenderTexture_Draw*()
|
||||
/// calls will work as expected.
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderTexture_ResetGLStates(sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the target texture of a render texture
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return Pointer to the target texture
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user