Interactive 2D continuous target/coordinate selector.
Supports custom X/Y continuous domains, procedural background shader blocks,
static buffer backgrounds, custom reticle glyphs, mouse dragging, and arrow-key stepping.
Constructors
new(x_range :
Range(
Float64,
Float64) = 0.0..1.0, y_range :
Range(
Float64,
Float64) = 0.0..1.0, initial_x :
Float64 |
Nil = nil, initial_y :
Float64 |
Nil = nil, reticle_char :
Char = '⌖', show_coordinates :
Bool = true, border :
Bool = true, width :
Int32 |
Nil = 24, height :
Int32 |
Nil = 10, background_shader :
Proc(
Float64,
Float64,
Color) |
Nil = nil)
Sourcenew(x_range :
Range(
Float64,
Float64) = 0.0..1.0, y_range :
Range(
Float64,
Float64) = 0.0..1.0, initial_x :
Float64 |
Nil = nil, initial_y :
Float64 |
Nil = nil, reticle_char :
Char = '⌖', show_coordinates :
Bool = true, border :
Bool = true, width :
Int32 |
Nil = 24, height :
Int32 |
Nil = 10, &block :
Float64,
Float64 ->
Color)
SourceInstance methods
background_buffer
Optional pre-rendered background buffer
Sourcebackground_buffer=(background_buffer : Buffer | Nil)
Optional pre-rendered background buffer
Sourcebackground_color=(background_color : Color)
Sourcebackground_shader
Optional procedural background generator: receives normalized (u, v) in [0.0..1.0] and returns a Color
SourceOptional procedural background generator: receives normalized (u, v) in [0.0..1.0] and returns a Color
Sourceborder_color=(border_color : Color)
Sourcehandle_key(key :
Terminal::KeyEvent) :
Bool Default key event handler. Override in subclasses if not using @default_input_proc.
Sourcehandle_mouse(event :
Terminal::MouseEvent) :
Bool Default mouse event handler. Override in subclasses if not using @default_input_proc.
Sourcenormalized_coords
Returns normalized (u, v) in [0.0..1.0]
Sourcerender(buffer : Buffer) : Nil
Sourcereticle_color=(reticle_color : Color)
SourceSets coordinates from normalized (u, v) in [0.0..1.0]
SourceSets current coordinate values and triggers on_change if changed
Source