Safe Haskell | None |
---|---|
Language | Haskell98 |
SFML.Graphics.View
- createView :: IO View
- viewFromRect :: FloatRect -> IO View
- copyView :: View -> IO View
- destroy :: SFResource a => a -> IO ()
- setViewCenter :: View -> Vec2f -> IO ()
- setViewSize :: View -> Vec2f -> IO ()
- setViewRotation :: View -> Float -> IO ()
- setViewport :: View -> FloatRect -> IO ()
- resetView :: View -> FloatRect -> IO ()
- getViewCenter :: View -> IO Vec2f
- getViewSize :: View -> IO Vec2f
- getViewRotation :: View -> IO Float
- getViewViewport :: View -> IO FloatRect
- moveView :: View -> Vec2f -> IO ()
- rotateView :: View -> Float -> IO ()
- zoomView :: View -> Float -> IO ()
Documentation
createView :: IO View
Create a default view.
This function creates a default view of (0, 0, 1000, 1000)
Construct a view from a rectangle
destroy :: SFResource a => a -> IO ()
Destroy the given SFML resource.
setViewCenter :: View -> Vec2f -> IO ()
Set the center of a view.
setViewSize :: View -> Vec2f -> IO ()
Set the size of a view.
Set the orientation of a view.
The default rotation of a view is 0 degrees.
Set the target viewport of a view
The viewport is the rectangle into which the contents of the view are displayed, expressed as a factor (between 0 and 1) of the size of the render target to which the view is applied. For example, a view which takes the left side of the target would be defined by a rect of (0, 0, 0.5, 1).
By default, a view has a viewport which covers the entire target.
Reset a view to the given rectangle.
Note that this function resets the rotation angle to 0.
getViewCenter :: View -> IO Vec2f
Get the center of a view.
getViewSize :: View -> IO Vec2f
Get the size of a view.
getViewRotation :: View -> IO Float
Get the current orientation of a view, in degrees.
getViewViewport :: View -> IO FloatRect
Get the target viewport rectangle of a view, expressed as a factor of the target size.
Move a view relatively to its current position.
Rotate a view relatively to its current orientation.
Resize a view rectangle relatively to its current size
Resizing the view simulates a zoom, as the zone displayed on screen grows or shrinks.
factor is a multiplier:
- 1 keeps the size unchanged
- > 1 makes the view bigger (objects appear smaller)
- < 1 makes the view smaller (objects appear bigger)