Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains the SDL asset types.
Types
Represents an image asset loaded by an engine instance.
This is a type family, where the instance
types are the specific internal representations of an image
for an engine. Hence the e type variable here should refer
to an Engine
instance, but that is not strictly required.
Having the image type be a family allows us to separate the internal representation of the image assets for each engine from the core Helm library.
Loading
withImage :: SDLEngine -> FilePath -> (Image SDLEngine -> IO a) -> IO a Source
Load an image asset using the SDL engine and do something with it. The image will be cleaned up once the provided monad completes.
Currently, the only supported image file format is PNG.
The expected usage would be to use withImage
for each image you need to load before
running the engine, and then use the images with
graphics. Once the engine stops running, the image
will then be automatically cleaned up.