BLTerminalInterface
public protocol BLTerminalInterface : AnyObject
API for talking to BearLibTerminal. See BLTerminal
for the concrete
implementation. Use BLTerminal.main
to get the main instance.
Each docstring briefly explains how it relates to the C API, so you’ll probably want to refer to the original documentation for more information.
By writing your code against this protocol instead of the concrete
BLTerminal
type, you enable unit testing and possible cross-platform
compatibility adapters in the future.
-
terminal_open()
Declaration
Swift
func open()
-
terminal_close()
Declaration
Swift
func close()
-
terminal_set()
Declaration
Swift
@discardableResult func configure(_ config: String) -> Bool
-
terminal_refresh()
Declaration
Swift
func refresh()
-
terminal_clear()
Declaration
Swift
func clear()
-
terminal_clear_area()
Declaration
Swift
func clear(area: BLRect)
-
terminal_crop()
Declaration
Swift
func crop(area: BLRect)
-
terminal_delay()
Declaration
Swift
func delay(milliseconds: BLInt)
-
terminal_measure()
Declaration
Swift
func measure(string: String) -> BLSize
-
color_from_name()
Declaration
Swift
func getColor(name: String) -> BLColor
-
color_from_argb()
Declaration
Swift
func getColor(a: UInt8, r: UInt8, g: UInt8, b: UInt8) -> BLColor
-
terminal_peek()
Declaration
Swift
func peek() -> Int32
-
terminal_read()
Declaration
Swift
func read() -> Int32
-
terminal_state()
Declaration
Swift
func state(_ slot: Int32) -> Int32
-
terminal_check()
Declaration
Swift
func check(_ slot: Int32) -> Bool
-
terminal_has_input()
Declaration
Swift
var hasInput: Bool { get }
-
terminal_layer()
/terminal_state(TK_LAYER)
Declaration
Swift
var layer: BLInt { get set }
-
terminal_color()
/terminal_state(TK_COLOR)
Declaration
Swift
var foregroundColor: BLColor { get set }
-
terminal_layer()
/terminal_state(TK_LAYER)
Declaration
Swift
var backgroundColor: BLColor { get set }
-
terminal_composition()
/terminal_state(TK_COMPOSITION)
Declaration
Swift
var isCompositionEnabled: Bool { get set }
-
waitForExit()
Extension methodBlock until the user quits. This isn’t part of the original BearLibTerminal library, but it’s convenient for quick experiments.
Declaration
Swift
public func waitForExit()