vty-4.7.5: A simple terminal UI library

Safe HaskellNone

Graphics.Vty

Synopsis

Documentation

data Vty Source

The main object. At most one should be created. An alternative is to use unsafePerformIO to automatically create a singleton Vty instance when required.

This does not assure any thread safety. In theory, as long as an update action is not executed when another update action is already then it's safe to call this on multiple threads.

todo: Once the Terminal interface encompasses input this interface will be deprecated. Currently, just using the Terminal interface there is no support for input events.

Constructors

Vty 

Fields

update :: Picture -> IO ()

Outputs the given Picture. Equivalent to output_picture applied to a display context implicitly managed by Vty.

next_event :: IO Event

Get one Event object, blocking if necessary.

terminal :: TerminalHandle

Handle to the terminal interface. See Terminal

The use of Vty typically follows this process:

  1. initialize vty
  2. use the update equation of Vty to display a picture
  3. repeat
  4. shutdown vty.

todo: provide a similar abstraction to Graphics.Vty.Terminal for input. Use haskeline's input backend for implementation.

todo: remove explicit shutdown requirement.

refresh :: IO ()

Refresh the display. Normally the library takes care of refreshing. Nonetheless, some other program might output to the terminal and mess the display. In that case the user might want to force a refresh.

shutdown :: IO ()

Clean up after vty. The above methods will throw an exception if executed after this is executed.

mkVty :: IO VtySource

Set up the state object for using vty. At most one state object should be created at a time.

mkVtyEscDelay :: Int -> IO VtySource

Set up the state object for using vty. At most one state object should be created at a time. The delay, in microseconds, specifies the period of time to wait for a key following reading ESC from the terminal before considering the ESC key press as a discrete event.

data Key Source

Representations of non-modifier keys.

Instances

data Modifier Source

Modifier keys. Key codes are interpreted such that users are more likely to have Meta than Alt; for instance on the PC Linux console, MMeta will generally correspond to the physical Alt key.

Constructors

MShift 
MCtrl 
MMeta 
MAlt 

data Button Source

Mouse buttons. Not yet used.

Constructors

BLeft 
BMiddle 
BRight 

Instances

data Event Source

Generic events.

Instances