<commit_before>module SFML.Graphics.View
(
    createView
,   viewFromRect
,   copyView
,   destroyView
,   setViewCenter
,   setViewSize
,   setViewRotation
,   setViewport
,   resetView
,   getViewCenter
,   getViewSize
,   getViewRotation
,   getViewport
,   moveView
,   rotateView
,   zoomView
)
where


import SFML.Graphics.Rect
import SFML.Graphics.Types
import SFML.System.Vector2

import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Utils (with)
import Foreign.Ptr
import Foreign.Storable (peek)


-- | Create a default view.
--
-- This function creates a default view of (0, 0, 1000, 1000)
createView :: IO View
createView = sfView_create

foreign import ccall unsafe "sfView_create"
    sfView_create :: IO View

--CSFML_GRAPHICS_API sfView* sfView_create(void);


-- | Construct a view from a rectangle
viewFromRect
    :: FloatRect -- ^ Rectangle defining the zone to display
    -> IO View

viewFromRect rect = with rect sfView_createFromRect

foreign import ccall unsafe "sfView_createFromRect_helper"
    sfView_createFromRect :: Ptr FloatRect -> IO View

--CSFML_GRAPHICS_API sfView* sfView_createFromRect(sfFloatRect rectangle);


-- | Copy an existing view.
copyView :: View -> IO View
copyView = sfView_copy

foreign import ccall unsafe "svView_copy"
    sfView_copy :: View -> IO View

--CSFML_GRAPHICS_API sfView* sfView_copy(sfView* view);


-- | Destroy an existing view.
destroyView :: View -> IO ()
destroyView = sfView_destroy

foreign import ccall unsafe "sfView_destroy"
    sfView_destroy :: View -> IO ()

--CSFML_GRAPHICS_API void sfView_destroy(sfView* view);


-- | Set the center of a view.
setViewCenter :: View -> Vec2f -> IO ()
setViewCenter view center = with center $ sfView_setCenter_helper view

foreign import ccall unsafe "sfView_setCenter_helper"
    sfView_setCenter_helper :: View -> Ptr Vec2f -> IO ()

--CSFML_GRAPHICS_API void sfView_setCenter(sfView* view, sfVector2f center);


-- | Set the size of a view.
setViewSize :: View -> Vec2f -> IO ()
setViewSize view size = with size $ sfView_setSize_helper view

foreign import ccall unsafe "sfView_setSize_helper"
    sfView_setSize_helper :: View -> Ptr Vec2f -> IO ()

--CSFML_GRAPHICS_API void sfView_setSize(sfView* view, sfVector2f size);


-- | Set the orientation of a view.
--
-- The default rotation of a view is 0 degrees.
setViewRotation
    :: View  -- ^ View object
    -> Float -- ^ New angle, in degrees
    -> IO ()

setViewRotation = sfView_setRotation

foreign import ccall unsafe "sfView_setRotation"
    sfView_setRotation :: View -> Float -> IO ()

--CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle);


 -- | 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.
setViewport
    :: View -- ^ View object
    -> FloatRect -- ^ New viewport rectangle
    -> IO ()

setViewport view rect = with rect $ sfView_setViewport_helper view

foreign import ccall unsafe "sfView_setViewport_helper"
    sfView_setViewport_helper :: View -> Ptr FloatRect -> IO ()<commit_msg>Fixed docs<commit_after>module SFML.Graphics.View
(
    createView
,   viewFromRect
,   copyView
,   destroyView
,   setViewCenter
,   setViewSize
,   setViewRotation
,   setViewport
,   resetView
,   getViewCenter
,   getViewSize
,   getViewRotation
,   getViewport
,   moveView
,   rotateView
,   zoomView
)
where


import SFML.Graphics.Rect
import SFML.Graphics.Types
import SFML.System.Vector2

import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Utils (with)
import Foreign.Ptr
import Foreign.Storable (peek)


-- | Create a default view.
--
-- This function creates a default view of (0, 0, 1000, 1000)
createView :: IO View
createView = sfView_create

foreign import ccall unsafe "sfView_create"
    sfView_create :: IO View

--CSFML_GRAPHICS_API sfView* sfView_create(void);


-- | Construct a view from a rectangle
viewFromRect
    :: FloatRect -- ^ Rectangle defining the zone to display
    -> IO View

viewFromRect rect = with rect sfView_createFromRect

foreign import ccall unsafe "sfView_createFromRect_helper"
    sfView_createFromRect :: Ptr FloatRect -> IO View

--CSFML_GRAPHICS_API sfView* sfView_createFromRect(sfFloatRect rectangle);


-- | Copy an existing view.
copyView :: View -> IO View
copyView = sfView_copy

foreign import ccall unsafe "svView_copy"
    sfView_copy :: View -> IO View

--CSFML_GRAPHICS_API sfView* sfView_copy(sfView* view);


-- | Destroy an existing view.
destroyView :: View -> IO ()
destroyView = sfView_destroy

foreign import ccall unsafe "sfView_destroy"
    sfView_destroy :: View -> IO ()

--CSFML_GRAPHICS_API void sfView_destroy(sfView* view);


-- | Set the center of a view.
setViewCenter :: View -> Vec2f -> IO ()
setViewCenter view center = with center $ sfView_setCenter_helper view

foreign import ccall unsafe "sfView_setCenter_helper"
    sfView_setCenter_helper :: View -> Ptr Vec2f -> IO ()

--CSFML_GRAPHICS_API void sfView_setCenter(sfView* view, sfVector2f center);


-- | Set the size of a view.
setViewSize :: View -> Vec2f -> IO ()
setViewSize view size = with size $ sfView_setSize_helper view

foreign import ccall unsafe "sfView_setSize_helper"
    sfView_setSize_helper :: View -> Ptr Vec2f -> IO ()

--CSFML_GRAPHICS_API void sfView_setSize(sfView* view, sfVector2f size);


-- | Set the orientation of a view.
--
-- The default rotation of a view is 0 degrees.
setViewRotation
    :: View  -- ^ View object
    -> Float -- ^ New angle, in degrees
    -> IO ()

setViewRotation = sfView_setRotation

foreign import ccall unsafe "sfView_setRotation"
    sfView_setRotation :: View -> Float -> IO ()

--CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle);


-- | 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.
setViewport
    :: View -- ^ View object
    -> FloatRect -- ^ New viewport rectangle
    -> IO ()

setViewport view rect = with rect $ sfView_setViewport_helper view

foreign import ccall unsafe "sfView_setViewport_helper"
    sfView_setViewport_helper :: View -> Ptr FloatRect -> IO ()
{'fraction_non_alphanumeric': 0.0887240356083086, 'fraction_numerical': 0.00741839762611276, 'mean_word_length': 3.6910229645093944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1738293', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2084, 'n_words': 715}