Orasund/pixelengine/4.1.0

NOTE: the latest version is 6.2.0

PixelEngine.Controls

The graphic engine provides a touch-controller for mobile devices.

Input

type Input
= InputLeft
| InputRight
| InputUp
| InputDown
| InputA
| InputB
| InputX
| InputY
| InputNone

all possible Inputs.

defaultLayout : String -> Input

The default layout:

  • A/ArrowLeft - InputLeft
  • W/ArrowUp - InputUp
  • D/ArrowRight - InputRight
  • S/ArrowDown - InputDown
  • Space/Enter - InputA
  • X/Backspace/Esc - InputB
  • Q - InputX
  • E - InputY

Advanced

Normally everything is already predefined in PixelEngine

Mobile Support

{ windowSize :
{ width : Float
, height : Float
}
, controls : Input -> msg
}
-> Options msg
-> Options msg

Adds mobile support to the options. It needs the window size.

PixelEngine provides a fully wired program that takes care of everything.

Subscriptions

basic : (Input -> msg) -> Sub msg

Subscribes to a keypress and sends the corresponding msg. This Function uses the default key layout.

custom : (String -> Input) -> (Input -> msg) -> Sub msg

Subscribes to a keypress using custom key layouts.

It uses key values for the String. You can use this website to find out the key value.