(add-resize-listener terminal listener-fn)
Create a listener that will call the supplied fn when the terminal is resized.
The function must take two arguments: the new number of columns and the new number of rows.
The listener itself will be returned. You don't need to do anything with it, but you can use it to remove it later with remove-resize-listener.
Create a listener that will call the supplied fn when the terminal is resized. The function must take two arguments: the new number of columns and the new number of rows. The listener itself will be returned. You don't need to do anything with it, but you can use it to remove it later with remove-resize-listener.
(clear terminal)
Clear the terminal.
The cursor will be at 0 0 afterwards.
Clear the terminal. The cursor will be at 0 0 afterwards.
(get-key terminal)
Get the next keypress from the user, or nil if none are buffered.
If the user has pressed a key, that key will be returned (and popped off the buffer of input).
If the user has not pressed a key, nil will be returned immediately. If you want to wait for user input, use get-key-blocking instead.
Get the next keypress from the user, or nil if none are buffered. If the user has pressed a key, that key will be returned (and popped off the buffer of input). If the user has *not* pressed a key, nil will be returned immediately. If you want to wait for user input, use get-key-blocking instead.
(get-key-blocking terminal)
(get-key-blocking terminal {:keys [interval timeout] :as opts})
Get the next keypress from the user.
If the user has pressed a key, that key will be returned (and popped off the buffer of input).
If the user has not pressed a key, this function will block, checking every 50ms. If you want to return nil immediately, use get-key instead.
Options can include any of the following keys:
:interval - sets the interval between checks :timeout - sets the maximum amount of time blocking will occur before returning nil
Get the next keypress from the user. If the user has pressed a key, that key will be returned (and popped off the buffer of input). If the user has *not* pressed a key, this function will block, checking every 50ms. If you want to return nil immediately, use get-key instead. Options can include any of the following keys: :interval - sets the interval between checks :timeout - sets the maximum amount of time blocking will occur before returning nil
(get-size terminal)
Return the current size of the terminal as [cols rows].
Return the current size of the terminal as [cols rows].
(in-terminal terminal & body)
Start the given terminal, perform the body, and stop the terminal afterward.
Start the given terminal, perform the body, and stop the terminal afterward.
(move-cursor terminal x y)
Move the cursor to a specific location on the screen.
Move the cursor to a specific location on the screen.
(put-character terminal ch)
(put-character terminal ch x y)
Draw the character at the current cursor location.
If x and y are given, moves the cursor there first.
Moves the cursor one character to the right, so a sequence of calls will output next to each other.
Draw the character at the current cursor location. If x and y are given, moves the cursor there first. Moves the cursor one character to the right, so a sequence of calls will output next to each other.
(remove-resize-listener terminal listener)
Remove a resize listener from the given terminal.
Remove a resize listener from the given terminal.
(start terminal)
Start the terminal. Consider using in-terminal instead.
Start the terminal. Consider using in-terminal instead.
(stop terminal)
Stop the terminal. Consider using in-terminal instead.
Stop the terminal. Consider using in-terminal instead.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close