Skip to content

Getting Started#

Crystal language bindings for Nuklear

Introduction#

Nuklear-cr provides a lightweight immediate-mode GUI for use with the following backends:

  • SDL3-Renderer
  • SDL3-OpenGL3

An immediate-mode GUI means that it does not hold the state of its widgets. Instead, you call the functions for the elements you want to draw, and they are drawn every frame.

Example
# Outside the render loop
count = 0

# Inside the render loop
nk.window("demo") do
    nk.row
    count += 1 if nk.button("Increase")
    nk.label "Count: " + count.to_s
end
nk.button returns true if the button was clicked during the current frame. Since everything is redrawn every frame, there is no need to worry about updating the value of a given label instance.

Installation#

Work in progress

API Reference#

class Nuklear
inherits Reference #

Test

Methods#

#button(text)#

View source

#chart_column(amostras, min = 0, max = 100#

View source

#chart_lines(amostras, min = 0, max = 100#

View source

#chart_max(amostras, min = 0, max = 100#

View source

#chart_push_slot(val, index = 0) : ChartEvent#

View source

#check(text, val : Bool) : Bool#

View source

#contextual(width = 150, height = 200, trigger_x = 0, trigger_y = 0, trigger_width = 0, trigger_height = 0#

View source

#contextual_item(label)#

View source

#ctx=(ctx)#

View source

#current_window#

View source

#current_window=(current_window : String)#

View source

#edit(text : String, max : Int)#

View source

#edit_box(text : String, max : Int)#

View source

#edit_editor(text : String, max : Int)#

View source

#image(tex)#

View source

#input_begin#

View source

#input_end#

View source

#label(text = "", align = :left)#

View source

#menu_item_label(label)#

View source

#menu_label(label, width = 200, height = 200#

View source

#menubar#

View source

#option(text, val : Bool) : Bool#

View source

#popup(name, x = 0, y = 0, width = 150, height = 350, title = false, movable = false, scalable = false, minimizable = false, closable = false, border = false, scrollbar = false, scrollbar_autohide = false, background = false, scale_left = false, no_input = false#

View source

#popup_close#

View source

#property(name, val : Int, min = -999999, max = 999999, step = 1, inc_per_pixel = 0.5)#

View source

#property(name, val : Float, min = -999999, max = 999999, step = 1, inc_per_pixel = 0.5)#

View source

#row(cols = 1, height = 0, col_width = 0)#

View source

#tooltip(label : String)#

View source

#tooltip(width = 200#

View source

#tree(title, collapsed = true, is_tab = false#

View source

#widget_hovered?#

View source

#widget_mouse_clicked?#

View source

#widget_tooltip(label : String)#

View source

#widget_tooltip(width = 200#

View source

#window(name : String, x = 0, y = 0, width = 400, height = 300, title = name, movable = true, scalable = true, minimizable = true, closable = true, border = true, scrollbar = true, scrollbar_autohide = false, background = false, scale_left = false, no_input = false#

View source

#window_active?(name)#

View source

#window_any_hovered?#

View source

#window_closed?(name) : Bool#

View source

#window_has_focus?(name) : Bool#

View source

#window_hidden?(name)#

View source

#window_hovered?(name) : Bool#

View source