Pebble.Game.Sprite

Lightweight sprite helpers built on top of Pebble.Ui.

Sprites

Sprite

type alias Sprite =
    { bitmap : Ui.Bitmap
    , x : Int
    , y : Int
    , w : Int
    , h : Int
    }

Bitmap sprite with integer bounds.

sprite

sprite : Ui.Bitmap -> Ui.Rect -> Sprite

Construct a sprite from a bitmap and rectangle.

view

view : Sprite -> Ui.RenderOp

Render a sprite as a bitmap draw operation.

Helpers

parallaxBitmap

parallaxBitmap : Ui.Bitmap -> { x : Int, y : Int, w : Int, h : Int } -> Int -> List Ui.RenderOp

Draw a horizontally wrapping bitmap strip for parallax backgrounds.

tileMap

tileMap : { tileSize : Int
, cameraX : Int
, cameraY : Int
, tiles : List ( Int, Int, Ui.Bitmap )
}
-> List Ui.RenderOp

Draw a tile map from tile coordinates, a camera offset, and bitmap resources.