imj-base-0.1.0.2: Game engine with geometry, easing, animated text, delta rendering.

Safe HaskellNone
LanguageHaskell2010

Imj.Input

Contents

Description

This module exports functions and types allowing to read player key-presses.

When we read a key with getKeyThenFlush or tryGetKeyThenFlush, we flush stdin just after having read from it, to avoid repeated keys slowing down the game.

Synopsis

Documentation

data Key Source #

Represents a key-press, read from stdin.

Constructors

AlphaNum Char

An alphanumeric key

Arrow Direction

One of the four direction arrows

Escape

The escape key

Unknown

An unhandled key

Blocking read

getKeyThenFlush :: IO Key Source #

Blocks until a key is read from stdin. Then, flushes stdin.

Non-blocking read

tryGetKeyThenFlush :: IO (Maybe Key) Source #

Tries to read a key from stdin. If it succeeds, it flushes stdin.