nuklear

Nuklear immediate-mode GUI library bindings for Kit

Files

FileDescription
kit.tomlPackage manifest with metadata and dependencies
src/nuklear.kitWidgets, layouts, input handling, and style API
tests/nuklear.test.kitModule import verification
examples/demo.kitFull widget showcase with SDL2 rendering
examples/sdl-demo.kitNuklear + SDL integration with visual feedback
examples/simple.kitBasic button, radio, and slider widgets
LICENSEMIT license file

Dependencies

No Kit package dependencies.

Installation

kit add gitlab.com/kit-lang/packages/kit-nuklear.git

Usage

import Kit.Nuklear

License

MIT License - see LICENSE for details.

Exported Functions & Types

free

Free a Nuklear context and release all resources.

Ptr -> Unit

clear

Clear the command buffer. Call this at the end of each frame.

Ptr -> Unit

flag-border

Window has a visible border.

Int

flag-movable

Window can be moved by dragging the header.

Int

flag-scalable

Window can be resized by dragging the corner.

Int

flag-closable

Window has a close button.

Int

flag-minimizable

Window can be minimized.

Int

flag-no-scrollbar

Window has no scrollbar.

Int

flag-title

Window always shows the title bar.

Int

text-left

Left-aligned text.

Int

text-centered

Center-aligned text.

Int

text-right

Right-aligned text.

Int

begin?

Begin a new window. Returns true if window is visible.

Parameters:

Ptr -> String -> Float -> Float -> Float -> Float -> Int -> Bool

flags = Nk.flag-border ||| Nk.flag-movable ||| Nk.flag-title
if Nk.begin? ctx "My Window" 50.0 50.0 200.0 200.0 flags then
  # ... window contents ...
  Nk.end ctx

end

End the current window.

Ptr -> Unit

window-is-closed?

Check if a window has been closed.

Ptr -> String -> Bool

window-is-hidden?

Check if a window is hidden.

Ptr -> String -> Bool

window-close

Close a window by name.

Ptr -> String -> Unit

window-get-width

Get the current window width.

Ptr -> Float

window-get-height

Get the current window height.

Ptr -> Float

window-has-focus?

Check if the current window has focus.

Ptr -> Bool

window-is-hovered?

Check if the current window is hovered.

Ptr -> Bool

item-is-any-active?

Check if any item is currently active.

Ptr -> Bool

layout-row-dynamic

Create a dynamic row with equally sized columns.

Parameters:

    Ptr -> Float -> Int -> Unit

layout-row-static

Create a static row with fixed-width columns.

Parameters:

    Ptr -> Float -> Int -> Int -> Unit

layout-row-begin

Begin a custom row layout.

Ptr -> Int -> Float -> Int -> Unit

layout-row-push

Push a column width for custom row layout.

Ptr -> Float -> Unit

layout-row-end

End a custom row layout.

Ptr -> Unit

spacing

Add spacing columns.

Ptr -> Int -> Unit

label

Display a text label.

Parameters:

    Ptr -> String -> Int -> Unit

label-colored

Display a colored text label.

Ptr -> String -> Int -> Int -> Int -> Int -> Int -> Unit

label-wrap

Display a wrapping text label.

Ptr -> String -> Unit

button-label?

Create a button with a text label. Returns true if clicked.

Ptr -> String -> Bool

button-color?

Create a colored button. Returns true if clicked.

Ptr -> Int -> Int -> Int -> Int -> Bool

check-label?

Create a checkbox (toggle). Returns new state.

Parameters:

Returns:

Ptr -> String -> Bool -> Bool

option-label?

Create a radio button option. Returns true if selected.

Parameters:

    Ptr -> String -> Bool -> Bool

slide-float

Create a float slider. Returns the new value.

Parameters:

    Ptr -> Float -> Float -> Float -> Float -> Float

slide-int

Create an integer slider. Returns the new value.

Ptr -> Int -> Int -> Int -> Int -> Int

prog

Create a progress bar. Returns the new value.

Parameters:

    Ptr -> Int -> Int -> Bool -> Int

propertyi

Create an integer property (label + value + increment buttons).

Ptr -> String -> Int -> Int -> Int -> Int -> Float -> Int

propertyf

Create a float property.

Ptr -> String -> Float -> Float -> Float -> Float -> Float -> Float

group-begin?

Begin a group (scrollable sub-region). Returns true if visible.

Ptr -> String -> Int -> Bool

group-end

End a group.

Ptr -> Unit

tree-node

Tree node type constant.

Int

tree-tab

Tree tab type constant.

Int

minimized

Minimized state constant.

Int

maximized

Maximized state constant.

Int

tree-push?

Begin a tree node. Returns true if expanded.

Ptr -> Int -> String -> Int -> Bool

tree-pop

End a tree node.

Ptr -> Unit

input-begin

Begin input handling. Call before feeding input events.

Ptr -> Unit

input-end

End input handling. Call after all input events are fed.

Ptr -> Unit

input-motion

Feed mouse motion event.

Ptr -> Int -> Int -> Unit

input-button

Feed mouse button event.

Parameters:

    Ptr -> Int -> Int -> Int -> Bool -> Unit

input-scroll

Feed scroll event.

Ptr -> Float -> Float -> Unit

input-key

Feed key event.

Ptr -> Int -> Bool -> Unit

mouse-button-left

Mouse button constants.

Int

mouse-button-middle

Middle mouse button constant.

Int

mouse-button-right

Right mouse button constant.

Int

key-shift

Shift key constant.

Int

key-ctrl

Ctrl key constant.

Int

key-del

Delete key constant.

Int

key-enter

Enter key constant.

Int

key-tab

Tab key constant.

Int

key-backspace

Backspace key constant.

Int

key-up

Up arrow key constant.

Int

key-down

Down arrow key constant.

Int

key-left

Left arrow key constant.

Int

key-right

Right arrow key constant.

Int

render-sdl

Render all Nuklear commands to an SDL renderer.

Parameters:

Ptr -> Ptr -> Unit

SDL.clear renderer
Nk.render-sdl ctx renderer
SDL.present renderer

command-begin

Get the first command in the buffer. Returns null if empty.

Ptr -> Ptr

command-next

Get the next command. Returns null if no more commands.

Ptr -> Ptr -> Ptr

command-type

Get the type of a command.

Ptr -> Int

cmd-nop

No-operation command type constant.

Int

cmd-scissor

Scissor command type constant.

Int

cmd-line

Line command type constant.

Int

cmd-rect

Rectangle command type constant.

Int

cmd-rect-filled

Filled rectangle command type constant.

Int

cmd-circle

Circle command type constant.

Int

cmd-circle-filled

Filled circle command type constant.

Int

cmd-triangle

Triangle command type constant.

Int

cmd-triangle-filled

Filled triangle command type constant.

Int

cmd-text

Text command type constant.

Int

Static popup type constant.

Int

Dynamic popup type constant.

Int

Begin a popup window. Returns true if visible.

Ptr -> Int -> String -> Int -> Float -> Float -> Float -> Float -> Bool

Close the current popup.

Ptr -> Unit

End a popup.

Ptr -> Unit

tooltip

Show a simple tooltip at current widget position.

Ptr -> String -> Unit

Begin the menubar.

Ptr -> Int

End the menubar.

Ptr -> Unit

Begin a menu. Returns true if open.

Ptr -> String -> Int -> Float -> Float -> Bool

Create a menu item. Returns true if clicked.

Ptr -> String -> Int -> Bool

Close the current menu.

Ptr -> Unit

End a menu.

Ptr -> Unit

combo-begin-label?

Begin a combo box. Returns true if open.

Ptr -> String -> Float -> Float -> Bool

combo-item-label?

Create a combo item. Returns true if clicked.

Ptr -> String -> Int -> Bool

combo-close

Close the current combo.

Ptr -> Unit

combo-end

End a combo box.

Ptr -> Unit