Safe Haskell | None |
---|---|
Language | Haskell98 |
SFML.Graphics.RenderTexture
- module SFML.Utils
- createRenderTexture :: Int -> Int -> Bool -> IO (Either SFException RenderTexture)
- destroy :: SFResource a => a -> IO ()
- getTextureSize :: RenderTexture -> IO Vec2u
- setActive :: RenderTexture -> Bool -> IO Bool
- display :: SFDisplayable a => a -> IO ()
- clear :: RenderTexture -> Color -> IO ()
- setView :: SFViewable a => a -> View -> IO ()
- getView :: SFViewable a => a -> IO View
- getDefaultView :: SFViewable a => a -> IO View
- getViewport :: SFViewable a => a -> View -> IO IntRect
- mapPixelToCoords :: SFCoordSpace a => a -> Vec2i -> Maybe View -> IO Vec2f
- drawSprite :: SFRenderTarget a => a -> Sprite -> Maybe RenderStates -> IO ()
- drawText :: SFRenderTarget a => a -> Text -> Maybe RenderStates -> IO ()
- drawShape :: SFRenderTarget a => a -> Shape -> Maybe RenderStates -> IO ()
- drawCircle :: SFRenderTarget a => a -> CircleShape -> Maybe RenderStates -> IO ()
- drawConvexShape :: SFRenderTarget a => a -> ConvexShape -> Maybe RenderStates -> IO ()
- drawRectangle :: SFRenderTarget a => a -> RectangleShape -> Maybe RenderStates -> IO ()
- drawVertexArray :: SFRenderTarget a => a -> VertexArray -> Maybe RenderStates -> IO ()
- drawPrimitives :: SFRenderTarget a => a -> [Vertex] -> PrimitiveType -> Maybe RenderStates -> IO ()
- drawPrimitives' :: SFRenderTarget a => a -> Ptr Vertex -> Int -> PrimitiveType -> Maybe RenderStates -> IO ()
- pushGLStates :: SFRenderTarget a => a -> IO ()
- popGLStates :: SFRenderTarget a => a -> IO ()
- resetGLStates :: SFRenderTarget a => a -> IO ()
- getRenderTexture :: RenderTexture -> IO Texture
- setSmooth :: SFSmoothTexture a => a -> Bool -> IO ()
- isSmooth :: SFSmoothTexture a => a -> IO Bool
Documentation
module SFML.Utils
Arguments
:: Int | Width of the render texture |
-> Int | Height of the render texture |
-> Bool | Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the render texture) |
-> IO (Either SFException RenderTexture) |
Construct a new render texture.
destroy :: SFResource a => a -> IO ()
Destroy the given SFML resource.
Arguments
:: RenderTexture | |
-> IO Vec2u | Size in pixels |
Get the size of the rendering region of a render texture.
Arguments
:: RenderTexture | Render texture object |
-> Bool | |
-> IO Bool |
Activate or deactivate a render texture as the current target for rendering.
display :: SFDisplayable a => a -> IO ()
Update the target's contents.
Arguments
:: RenderTexture | Render texture object |
-> Color | Fill color |
-> IO () |
Clear the rendertexture with the given color.
setView :: SFViewable a => a -> View -> IO ()
Change the target's current active view.
getView :: SFViewable a => a -> IO View
Get the target's current active view.
getDefaultView :: SFViewable a => a -> IO View
Get the target's default view.
getViewport :: SFViewable a => a -> View -> IO IntRect
Get the viewport of a view applied to this target, expressed in pixels in the current target.
Arguments
:: SFCoordSpace a | |
=> a | |
-> Vec2i | Pixel to convert |
-> Maybe View | The view to use for converting the point |
-> IO Vec2f |
Convert a point to world coordinates
This function finds the 2D position that matches the given pixel of the coord space. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your coord space, this assertion is not true anymore, ie. a point located at (10, 50) in your coord space may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-texture.
Arguments
:: SFRenderTarget a | |
=> a | |
-> Sprite | Sprite to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> Text | Text to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw text to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> Shape | Shape to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> CircleShape | CircleShape to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> ConvexShape | ConvexShape to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> RectangleShape | RectangleShape to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> VertexArray | VertexArray to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw a sprite to the render-target.
Arguments
:: SFRenderTarget a | |
=> a | |
-> [Vertex] | Vertices to render |
-> PrimitiveType | Type of primitives to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
Draw primitives defined by an array of vertices to a render texture.
Arguments
:: SFRenderTarget a | |
=> a | |
-> Ptr Vertex | Pointer to the vertices |
-> Int | Number of vertices in the array |
-> PrimitiveType | Type of primitives to draw |
-> Maybe RenderStates | Render states to use for drawing ( |
-> IO () |
pushGLStates :: SFRenderTarget a => a -> IO ()
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:
- SFML's internal states are not messed up by your OpenGL code
- 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.
popGLStates :: SFRenderTarget a => a -> IO ()
Restore the previously saved OpenGL render states and matrices.
See the description of pushGLStates to get a detailed description of these functions.
resetGLStates :: SFRenderTarget a => a -> IO ()
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
or popGLStates
. It makes sure that all OpenGL
states needed by SFML are set, so that subsequent draw
calls will work as expected.
getRenderTexture :: RenderTexture -> IO Texture
Get the target texture of a render texture.
setSmooth :: SFSmoothTexture a => a -> Bool -> IO ()
Enable or disable the smooth filter on a texture.
isSmooth :: SFSmoothTexture a => a -> IO Bool
Tell whether the smooth filter is enabled or not for a texture.