minilight-0.4.2: A SDL2-based graphics library, batteries-included.

Safe HaskellNone
LanguageHaskell2010

MiniLight.Figure

Description

This module provides many convenient operations for textures.

Synopsis

Documentation

centerL :: Lens' (Rectangle a) (V2 a) Source #

Lens for the center of a rectangle.

sizeL :: Lens' (Rectangle a) (V2 a) Source #

Lens for the size of a rectangle.

data Figure Source #

Figure type carries a texture, sizing information and rotation information.

Constructors

Figure 

Fields

emptyFigure :: Figure Source #

A figure which has no texture. You can render it but do nothing.

freeFigure :: MonadIO m => Figure -> m () Source #

render :: (HasLightEnv env, MonadIO m, MonadMask m) => Figure -> LightT env m () Source #

Render a figure.

renders :: (HasLightEnv env, MonadIO m, MonadMask m) => [Figure] -> LightT env m () Source #

Render figures.

withBlendedText :: (MonadIO m, MonadMask m) => Font -> Text -> Color -> (Surface -> m a) -> m a Source #

class Rendering r m | r -> m where Source #

Rendering typeclass provides basic operations for figures.

Methods

translate :: V2 Int -> r -> r Source #

Change the place to be rendered.

clip :: Rectangle Int -> r -> r Source #

Specify some area and clip the figure into the region.

rotate :: Double -> r -> r Source #

Rotate a figure.

text :: Font -> V4 Word8 -> Text -> m r Source #

Create a text texture. Be careful: this is a slow operation, use cache as long as you can.

picture :: FilePath -> m r Source #

Create a texture from a png file. Be careful: this is a slow operation, use cache as long as you can.

fromTexture :: Texture -> m r Source #

Create a texture from a raw SDL texture.

rectangleOutline Source #

Arguments

:: V4 Word8

Stroke color

-> V2 Int

Size

-> m r 

Create an outlined rectangle. Be careful: this is a slow operation, use cache as long as you can.

rectangleFilled Source #

Arguments

:: V4 Word8

Filling color

-> V2 Int

Size

-> m r 

Create a filled texture. Be careful: this is a slow operation, use cache as long as you can.

triangleOutline Source #

Arguments

:: V4 Word8

Stroke color

-> V2 Int

Size

-> m r 

Create an outlined triangle. Be careful: this is a slow operation, use cache as long as you can.