helm-1.0.0: A functionally reactive game engine.

Safe HaskellNone
LanguageHaskell2010

Helm.Engine.SDL.Asset

Contents

Description

Contains the SDL asset types.

Synopsis

Types

data family Image e Source

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.

Instances

data Image SDLEngine = SDLImage {} Source

Represents an Image for the SDL engine.

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.