Plankton - xarvh/squarepants GitHub Wiki

Plankton is a specification for a minimalist game api.

Each platform will decide whether to accept a Plankton.App as main or not

Module: Plankton

Update model = fn Env, @Array Sound, model: model
Draw model = fn Env, model: [Image]

App model = {
    , init as model
    , update as Update model
    , draw as Draw model
    }

Env = {
   , left as Button
   , right as Button
   , up as Button
   , down as Button
   , menu as Button
   , a as Button
   , b as Button

   , pointer as { x as Float, y as Float }
   , click as Button

   , frameNumber as Int
}

buttonWasClicked as fn Button: Bool

buttonIsPressed as fn Button: Bool

urlToImage as fn Text: Image

move2 as fn Float, Float, Image: Image
scale as fn Float, Image: Image
rotate as fn Float, Image: Image

Float angles go from 0% (no turn) to 100% (360 degrees turn). move (ie, translation) values are a percentage of the current space (the screen coordinates go from -50% to +50%)

Browser/EmbeddedPlankton

init as fn model: PlanktonModel model
update as fn Plankton.Update model: fn PlanktonMsg, PlanktonModel model: PlanktonModel model & Cmd PlanktonMsg
view as fn Plankton.Draw model: fn PlanktonModel model: Html PlanktonMsg
subs as fn PlanktonModel model: Subs PlanktonMsg