Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides an implementation for simple resolution independent drawing and rendering. You can do the same stuff with the resolution independent compositor as with a regular one.
One important difference is that the translateA
function as well
as the standard drawing functions don't work with ResIndependent
.
Instead there are replacement functions for these operations.
This implementation finds the biggest square that fits into the
dimensions of the rendering surface. The top left corner of this
sqare is V2 0 0
, the bottom right corner is V2 1 1
.
- data ResIndependent c a
- fromRelativeCompositor :: (Compositor (c a), AbsoluteSize c) => V2 Int -> ResIndependent c a -> c a
- drawRectangle :: Drawer (c a) => V2 Float -> Color -> ResIndependent c a
- fillRectangle :: Drawer (c a) => V2 Float -> Color -> ResIndependent c a
- drawLine :: Drawer (c a) => V2 Float -> Color -> ResIndependent c a
- class RelativeSize c where
Wrapping and unwrapping
data ResIndependent c a Source
Functor c => Functor (ResIndependent c) Source | |
AbsoluteSize c => RelativeSize (ResIndependent c) Source | |
Monoid (c a) => Monoid (ResIndependent c a) Source | |
Manipulator (c a) => Manipulator (ResIndependent c a) Source | |
Blender (c a) => Blender (ResIndependent c a) Source | |
Compositor (c a) => Compositor (ResIndependent c a) Source |
fromRelativeCompositor :: (Compositor (c a), AbsoluteSize c) => V2 Int -> ResIndependent c a -> c a Source
Convert a resolution independent compositor into a compositor for a fixed screen size by specifying the size of the screen.
Drawing
drawRectangle :: Drawer (c a) => V2 Float -> Color -> ResIndependent c a Source
fillRectangle :: Drawer (c a) => V2 Float -> Color -> ResIndependent c a Source
Composition
class RelativeSize c where Source
translateR :: V2 Float -> c a -> c a Source
Translate a composition by a given resolution independent vector.
sizedR :: V2 Float -> a -> c a Source
This function takes a rectangular area given as resolution independent coordinates and an object and constructs a compositing node from it that spans the given area.
AbsoluteSize c => RelativeSize (ResIndependent c) Source |