termbox-bindings-hs-1.0.0: termbox bindings
Safe HaskellSafe-Inferred
LanguageHaskell2010

Termbox.Bindings.Hs

Description

This module provides a low-level wrapper around termbox, a simple C library for writing text-based user interfaces: https://github.com/termbox/termbox

You may prefer to use one of the following interfaces instead:

Synopsis

Functions

Initialize / shutdown

tb_init :: IO (Either Tb_init_error ()) Source #

Initialize the termbox library.

tb_init_fd :: Fd -> IO (Either Tb_init_error ()) Source #

Initialize the termbox library.

tb_init = tb_init_fd(0)

tb_init_file :: FilePath -> IO (Either Tb_init_error ()) Source #

Initialize the termbox library.

tb_init = tb_init_file("/dev/tty")

tb_shutdown :: IO () #

Shutdown the termbox library.

Get or set input mode

tb_get_input_mode :: IO Tb_input_mode Source #

Get the input mode.

tb_select_input_mode :: Tb_input_mode -> IO () Source #

Set the input mode.

Get or set output mode

tb_select_output_mode :: Tb_output_mode -> IO () Source #

Set the output mode.

Get terminal dimensions

tb_width :: IO Int Source #

Get the terminal width.

tb_height :: IO Int Source #

Get the terminal height.

Poll for events

tb_peek_event :: Int -> IO (Either () (Maybe Tb_event)) Source #

Wait up to a number of milliseconds for an event.

tb_poll_event :: IO (Either () Tb_event) Source #

Wait for an event.

Set a cell

tb_set_cursor Source #

Arguments

:: Maybe (Int, Int)

x, y

-> IO () 

Set or hide the cursor location.

tb_put_cell Source #

Arguments

:: Int

x

-> Int

y

-> Tb_cell

cell

-> IO () 

Set a cell value in the back buffer.

tb_change_cell Source #

Arguments

:: Int

x

-> Int

y

-> Char

ch

-> Tb_attrs

fg

-> Tb_attrs

bg

-> IO () 

Set a cell value in the back buffer.

Clear and synchronize the back buffer

tb_clear :: IO () #

Clear the back buffer.

tb_set_clear_attributes Source #

Arguments

:: Tb_attrs

fg

-> Tb_attrs

bg

-> IO () 

Set the foreground and background attributes that tb_clear clears the back buffer with.

tb_present :: IO () #

Synchronize the back buffer with the terminal.

Types

data Tb_cell Source #

A cell.

Constructors

Tb_cell 

Fields

Instances

Instances details
Generic Tb_cell Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Cell

Associated Types

type Rep Tb_cell :: Type -> Type #

Methods

from :: Tb_cell -> Rep Tb_cell x #

to :: Rep Tb_cell x -> Tb_cell #

Show Tb_cell Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Cell

Eq Tb_cell Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Cell

Methods

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

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

type Rep Tb_cell Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Cell

type Rep Tb_cell = D1 ('MetaData "Tb_cell" "Termbox.Bindings.Hs.Internal.Cell" "termbox-bindings-hs-1.0.0-inplace" 'False) (C1 ('MetaCons "Tb_cell" 'PrefixI 'True) (S1 ('MetaSel ('Just "ch") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Char) :*: (S1 ('MetaSel ('Just "fg") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Tb_attrs) :*: S1 ('MetaSel ('Just "bg") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Tb_attrs))))

newtype Tb_attrs Source #

Cell attributes.

Constructors

Tb_attrs Word16 

data Tb_event Source #

An event.

Constructors

Tb_event 

Fields

Instances

Instances details
Generic Tb_event Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Event

Associated Types

type Rep Tb_event :: Type -> Type #

Methods

from :: Tb_event -> Rep Tb_event x #

to :: Rep Tb_event x -> Tb_event #

Show Tb_event Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Event

Eq Tb_event Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Event

type Rep Tb_event Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Event

data Tb_event_mod where Source #

An event modifier.

Bundled Patterns

pattern TB_MOD_ALT :: Tb_event_mod 
pattern TB_MOD_MOTION :: Tb_event_mod 

data Tb_event_type where Source #

An event type.

Bundled Patterns

pattern TB_EVENT_KEY :: Tb_event_type 
pattern TB_EVENT_MOUSE :: Tb_event_type 
pattern TB_EVENT_RESIZE :: Tb_event_type 

newtype Tb_input_mode Source #

The input mode.

Constructors

Tb_input_mode CInt 

Instances

Instances details
Semigroup Tb_input_mode Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.InputMode

Bits Tb_input_mode Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.InputMode

Show Tb_input_mode Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.InputMode

Eq Tb_input_mode Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.InputMode

data Tb_key where Source #

A key.

Bundled Patterns

pattern TB_KEY_ARROW_DOWN :: Tb_key 
pattern TB_KEY_ARROW_LEFT :: Tb_key 
pattern TB_KEY_ARROW_RIGHT :: Tb_key 
pattern TB_KEY_ARROW_UP :: Tb_key 
pattern TB_KEY_BACKSPACE :: Tb_key 
pattern TB_KEY_BACKSPACE2 :: Tb_key 
pattern TB_KEY_CTRL_2 :: Tb_key 
pattern TB_KEY_CTRL_3 :: Tb_key 
pattern TB_KEY_CTRL_4 :: Tb_key 
pattern TB_KEY_CTRL_5 :: Tb_key 
pattern TB_KEY_CTRL_6 :: Tb_key 
pattern TB_KEY_CTRL_7 :: Tb_key 
pattern TB_KEY_CTRL_8 :: Tb_key 
pattern TB_KEY_CTRL_A :: Tb_key 
pattern TB_KEY_CTRL_B :: Tb_key 
pattern TB_KEY_CTRL_BACKSLASH :: Tb_key 
pattern TB_KEY_CTRL_C :: Tb_key 
pattern TB_KEY_CTRL_D :: Tb_key 
pattern TB_KEY_CTRL_E :: Tb_key 
pattern TB_KEY_CTRL_F :: Tb_key 
pattern TB_KEY_CTRL_G :: Tb_key 
pattern TB_KEY_CTRL_H :: Tb_key 
pattern TB_KEY_CTRL_I :: Tb_key 
pattern TB_KEY_CTRL_J :: Tb_key 
pattern TB_KEY_CTRL_K :: Tb_key 
pattern TB_KEY_CTRL_L :: Tb_key 
pattern TB_KEY_CTRL_LSQ_BRACKET :: Tb_key 
pattern TB_KEY_CTRL_M :: Tb_key 
pattern TB_KEY_CTRL_N :: Tb_key 
pattern TB_KEY_CTRL_O :: Tb_key 
pattern TB_KEY_CTRL_P :: Tb_key 
pattern TB_KEY_CTRL_Q :: Tb_key 
pattern TB_KEY_CTRL_R :: Tb_key 
pattern TB_KEY_CTRL_RSQ_BRACKET :: Tb_key 
pattern TB_KEY_CTRL_S :: Tb_key 
pattern TB_KEY_CTRL_SLASH :: Tb_key 
pattern TB_KEY_CTRL_T :: Tb_key 
pattern TB_KEY_CTRL_TILDE :: Tb_key 
pattern TB_KEY_CTRL_U :: Tb_key 
pattern TB_KEY_CTRL_UNDERSCORE :: Tb_key 
pattern TB_KEY_CTRL_V :: Tb_key 
pattern TB_KEY_CTRL_W :: Tb_key 
pattern TB_KEY_CTRL_X :: Tb_key 
pattern TB_KEY_CTRL_Y :: Tb_key 
pattern TB_KEY_CTRL_Z :: Tb_key 
pattern TB_KEY_DELETE :: Tb_key 
pattern TB_KEY_END :: Tb_key 
pattern TB_KEY_ENTER :: Tb_key 
pattern TB_KEY_ESC :: Tb_key 
pattern TB_KEY_F1 :: Tb_key 
pattern TB_KEY_F10 :: Tb_key 
pattern TB_KEY_F11 :: Tb_key 
pattern TB_KEY_F12 :: Tb_key 
pattern TB_KEY_F2 :: Tb_key 
pattern TB_KEY_F3 :: Tb_key 
pattern TB_KEY_F4 :: Tb_key 
pattern TB_KEY_F5 :: Tb_key 
pattern TB_KEY_F6 :: Tb_key 
pattern TB_KEY_F7 :: Tb_key 
pattern TB_KEY_F8 :: Tb_key 
pattern TB_KEY_F9 :: Tb_key 
pattern TB_KEY_HOME :: Tb_key 
pattern TB_KEY_INSERT :: Tb_key 
pattern TB_KEY_MOUSE_LEFT :: Tb_key 
pattern TB_KEY_MOUSE_MIDDLE :: Tb_key 
pattern TB_KEY_MOUSE_RELEASE :: Tb_key 
pattern TB_KEY_MOUSE_RIGHT :: Tb_key 
pattern TB_KEY_MOUSE_WHEEL_DOWN :: Tb_key 
pattern TB_KEY_MOUSE_WHEEL_UP :: Tb_key 
pattern TB_KEY_PGDN :: Tb_key 
pattern TB_KEY_PGUP :: Tb_key 
pattern TB_KEY_SPACE :: Tb_key 
pattern TB_KEY_TAB :: Tb_key 

Instances

Instances details
Show Tb_key Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Key

Eq Tb_key Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Key

Methods

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

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

Ord Tb_key Source # 
Instance details

Defined in Termbox.Bindings.Hs.Internal.Key