miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Subscription.Keyboard

Description

 
Synopsis

Types

data Arrows Source #

type for arrow keys currently pressed

  • 37 left arrow ( x = -1 )
  • 38 up arrow ( y = 1 )
  • 39 right arrow ( x = 1 )
  • 40 down arrow ( y = -1 )

Constructors

Arrows 

Fields

Instances

Instances details
Show Arrows Source # 
Instance details

Defined in Miso.Subscription.Keyboard

Eq Arrows Source # 
Instance details

Defined in Miso.Subscription.Keyboard

Methods

(==) :: Arrows -> Arrows -> Bool #

(/=) :: Arrows -> Arrows -> Bool #

Subscriptions

arrowsSub :: (Arrows -> action) -> Sub action Source #

Maps Arrows onto a Keyboard subscription

directionSub :: ([Int], [Int], [Int], [Int]) -> (Arrows -> action) -> Sub action Source #

Maps a specified list of keys to directions (up, down, left, right)

keyboardSub :: (Set Int -> action) -> Sub action Source #

Returns subscription for Keyboard. The callback will be called with the Set of currently pressed keyCodes.

wasdSub :: (Arrows -> action) -> Sub action Source #

Maps Arrows onto a Keyboard subscription for directions (W+A+S+D keys)