Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
nuklear
TOC »
- Outdated egg!
- nuklear
- Introduction
- Author
- Repository
- Current state of the bindings
- Requirements
- API
- Backends
- Basic types
- Window helpers
- Layouts
- Blocks
- Widgets
- Tooltip
- Context
- Canvas
- Styling
- Input
- Examples
- Notes
- License
- Version history
Introduction
This egg provides an incomplete set of bindings to the nuklear immediate mode GUI library.
Author
Vasilij Schneidermann
Repository
https://depp.brause.cc/nuklear
Current state of the bindings
Backends
- glfw-opengl2
API Support
Everything required for the GLFW3 OpenGL2 demos is supported.
Vendored headers
Last synced: 07-06-2016
Requirements
To compile the egg successfully, all foreign dependencies for the glfw-opengl2 backend must be met:
- GLFW3
- GL
- GLU
Additionally to this, you will need a GPU supporting OpenGL2. The setup script has only been tested on Linux and will most certainly need adjustments to work on OS X and Windows.
API
Backends
glfw-opengl2 Backend
anti-alias?
- anti-alias?parameter
- anti-alias? FLAGparameter
Controls whether anti-aliasing is enabled, defaulting to #t.
max-vertex-buffer
- max-vertex-bufferparameter
- max-vertex-buffer Nparameter
Controls the maximum amount of vertices, defaulting to 512*1024.
max-element-buffer
- max-element-bufferparameter
- max-element-buffer Nparameter
Controls the maximum amount of elements, defaulting to 128*1024.
init!
- init! window install-callbacks?procedure
Initializes the backend and returns a context to be used in all GUI procedures. WINDOW must be a GLFW3 window and can be obtained with its (window) parameter after successful setup. If INSTALL-CALLBACKS? is #t, input and scrolling callbacks are set up, otherwise the created context can only be used for visualizing data.
init-font!
- (init-font! [context path size])procedure
Initializes either the default font or a custom one if CONTEXT, PATH and SIZE are provided. The optional arguments need to be a previously obtained context, a string specifying the path to the font and a number for the font size.
new-frame
- new-frameprocedure
Starts a new frame to operate on.
render!
- render!procedure
Commits all changes done to the current frame.
shutdown!
- shutdown!procedure
Shuts down the backend. This must be called after exiting the main loop and before terminating GLFW3.
Basic types
Panels
make-panel
- make-panelprocedure
Creates and returns a panel.
panel-bounds
- panel-bounds PANELprocedure
Returns a rectangle describing the panel's bounds.
Rects
make-rect
- make-rect X Y W Hprocedure
Creates and returns a rectangle at the coordinates X and Y with the dimensions W and H. Note that all arguments can be floats.
rect-x / rect-x-set!
- rect-x RECTprocedure
- rect-x-set! RECT Xprocedure
- set! (rect-x RECT) Xsetter
Retrieves or sets the x coordinate of RECT.
rect-y / rect-y-set!
- rect-y RECTprocedure
- rect-y-set! RECT Yprocedure
- set! (rect-y RECT) Ysetter
Retrieves or sets the y coordinate of RECT.
rect-w / rect-w-set!
- rect-w RECTprocedure
- rect-w-set! RECT Wprocedure
- set! (rect-w RECT) Wsetter
Retrieves or sets the w coordinate of RECT.
rect-h / rect-h-set!
- rect-h RECTprocedure
- rect-h-set! RECT Hprocedure
- set! (rect-h RECT) Hsetter
Retrieves or sets the h coordinate of RECT.
Vectors
make-vec2
- make-vec2 X Yprocedure
Creates and returns a vector with the components X and Y. Note that all arguments can be floats.
vec2-x / vec2-x-set!
- vec2-x VECTORprocedure
- vec2-x-set! VECTOR Xprocedure
- set! (vec2-x VECTOR) Xsetter
Retrieves or sets the x component of VECTOR.
vec2-y / vec2-y-set!
- vec2-y VECTORprocedure
- vec2-y-set! VECTOR Yprocedure
- set! (vec2-y VECTOR) Ysetter
Retrieves or sets the y component of VECTOR.
Colors
make-color
- make-color R G B Aprocedure
Creates and returns a color with the components R, G, B and A. All arguments must be integers between 0 and 255.
color-r / color-r-set!
- color-r COLORprocedure
- color-r-set! COLOR Rprocedure
- set! (color-r COLOR) Rsetter
Retrieves or sets the red component of COLOR.
color-g / color-g-set!
- color-g COLORprocedure
- color-g-set! COLOR Gprocedure
- set! (color-g COLOR) Gsetter
Retrieves or sets the green component of COLOR.
color-b / color-b-set!
- color-b COLORprocedure
- color-b-set! COLOR Bprocedure
- set! (color-b COLOR) Bsetter
Retrieves or sets the blue component of COLOR.
color-a / color-a-set!
- color-a COLORprocedure
- color-a-set! COLOR Aprocedure
- set! (color-a COLOR) Asetter
Retrieves or sets the alpha component of COLOR.
Color helpers
rgb->color
- rgb->color R G Bprocedure
Returns a color with the components R, G and B. All arguments must be integers between 0 and 255.
color->rgba-floats
- color->rgba-floats COLORprocedure
Returns a list of red, green, blue and alpha components as floats between 0 and 1.
hsva->color
- hsva->color H S V Aprocedure
Returns a color with the components H, S, V and A. All arguments must be integers between 0 and 255.
color->hsva-ints
- color->hsva-ints COLORprocedure
Returns a list of hue, saturation, value and alpha components as integers between 0 and 255.
Window helpers
window-bounds
- window-bounds CONTEXTprocedure
Returns a rectangle describing the boundaries of the currently active window.
window-content-region
- window-content-region CONTEXTprocedure
Returns a rectangle describing the content region of the currently active window.
window-canvas
- window-canvas CONTEXTprocedure
Returns a canvas suitable for drawing on the currently active window.
window-closed?
- window-closed? CONTEXT TITLEprocedure
Returns #t if a window as identified by TITLE is no longer open, otherwise #f.
Layouts
Constrained positioning
layout-row-dynamic
- layout-row-dynamic CONTEXT HEIGHT COLUMNSprocedure
Sets up the following widgets to be positioned dynamically into rows. HEIGHT is the height of the row, COLUMNS the amount of widgets per row.
layout-row-static
- layout-row-static CONTEXT HEIGHT ITEM-WIDTH COLUMNSprocedure
Sets up the following widgets to be positioned statically into rows. HEIGHT is the height of the row, ITEM-WIDTH the width of each widget and COLUMNS the amount of widgets per row.
layout-row-begin
- layout-row-begin CONTEXT DYNAMIC? HEIGHT COLUMNSprocedure
Sets up the following widgets to be positioned dynamically or statically into a row, depending on DYNAMIC?. COLUMNS is the amount of widgets to be positioned.
layout-row-push
- layout-row-push CONTEXT RATIO-OR-WIDTHprocedure
Adds a widget to a row. If the positioning is dynamic, RATIO-OR-WIDTH is interpreted as ratio, otherwise as width in pixels.
layout-row-end
- layout-row-end CONTEXTprocedure
Terminates a layouted row.
layout-row
- layout-row CONTEXT DYNAMIC? HEIGHT RATIOS-OR-WIDTHSprocedure
Sets up the following widgets to be positioned dynamically or statically into a row, depending on DYNAMIC?. HEIGHT is the height of the row. RATIONS-OR-WIDTHS is a list of ratios or widths, depending on DYNAMIC?. This is equivalent to using layout-row-begin, layout-row-push and layout-row-end.
Free positioning
layout-space-begin
- layout-space-begin CONTEXT DYNAMIC? HEIGHT WIDGET-COUNTprocedure
Sets up the following widgets to be positioned freely. If DYNAMIC? is #t, widgets are scaled. HEIGHT is the total height of all widgets, WIDGET-COUNT the number of widgets.
layout-space-push
- layout-space-push CONTEXT RECTprocedure
Adds a freely positioned widget at RECT.
layout-space-end
- layout-space-end CONTEXTprocedure
Terminates free positioning.
Layout space helpers
layout-space-bounds
- layout-space-bounds CONTEXTprocedure
Returns a rectangle describing the inner bounds of the current widget.
layout-space-to-screen
- layout-space-to-screen CONTEXT VECTORprocedure
Returns a copy of VECTOR with absolute coordinates.
layout-space-rect-to-screen
- layout-space-rect-to-screen CONTEXT RECTprocedure
Returns a copy of RECT with absolute coordinates.
layout-space-rect-to-local
- layout-space-rect-to-local CONTEXT RECTprocedure
Returns a copy of RECT with relative coordinates.
Misc
spacing
- spacing CONTEXT COLUMNSprocedure
Adds COLUMNS of spacing.
Blocks
Window block
window-begin
- window-begin CONTEXT PANEL TITLE RECT FLAG-OR-FLAGSprocedure
Starts a window block with TITLE as window title. RECT specifies the window boundaries. FLAG-OR-FLAGS is a symbol or a list of symbols, each of which must be one of (border border-header movable scalable closable minimizable dynamic no-scrollbar title). Returns #t if the window is visible.
window-end
- window-end CONTEXTprocedure
Terminates the window block. Must be used after starting a window block, regardless of whether the window is visible or not.
Group block
group-begin
- group-begin CONTEXT PANEL TITLE FLAG-OR-FLAGSprocedure
Starts a group block with TEXT as title. FLAG-OR-FLAGS is a symbol or list of symbols, each of which must be one of (border border-header movable scalable closable minimizable dynamic no-scrollbar title). Returns #t if the group is visible.
group-end
- group-end CONTEXTprocedure
Terminates the group block. May only be used when the group is visible.
Tree block
tree-push
- tree-push CONTEXT TAB? TEXT MAXIMIZED?procedure
Starts a tree block with TEXT as label. If TAB? is #t, the tree header is highlighted specially. If MAXIMIZED? is #t, the tree starts expanded, otherwise minimized. Returns #t if the tree is expanded.
tree-pop
- tree-pop CONTEXTprocedure
Terminates the tree block. May only be used when the tree is expanded.
Chart block
chart-begin
- chart-begin CONTEXT LINES? COUNT MIN-VALUE MAX-VALUEprocedure
Starts a chart block. If LINES? is #t, draw lines, otherwise columns. COUNT is the number of data points, MIN-VALUE and MAX-VALUE the extremes. Returns #t if the chart is visible.
chart-begin-colored
- chart-begin-colored CONTEXT LINES? COLOR HIGHLIGHT COUNT MIN-VALUE MAX-VALUEprocedure
Starts a colored chart block. If LINES? if #t, draw lines, otherwise columns. COLOR is used for the chart itself and HIGHLIGHT for values hovered over. COUNT is the number of data points, MIN-VALUE and MAX-VALUE the extremes. Returns #t if the chart is visible.
chart-push
- chart-push CONTEXT VALUEprocedure
Adds VALUE to the data points in the chart. Returns either #f or a list of events for the data point, each of which is one of (hovering clicked).
chart-push-slot
- chart-push-slot CONTEXT VALUE SLOTprocedure
Adds VALUE to the data points in the chart SLOT. Returns either #f or a list of events for the data point, each of which is one of (hovering clicked).
chart-add-slot
- chart-add-slot CONTEXT LINES? COUNT MIN-VALUE MAX-VALUEprocedure
Adds an extra slot to the chart. Slots are integer values starting from 0. If LINES? is #t, draw lines, otherwise columns. COUNT is the number of data points, MIN-VALUE and MAX-VALUE the extremes.
chart-add-slot-colored
- chart-add-slot-colored CONTEXT LINES? COLOR HIGHLIGHT COUNT MIN-VALUE MAX-VALUEprocedure
Adds an extra colored slot to the chart. If LINES? is #t, draw lines, otherwise columns. COLOR is used for the chart itself and HIGHLIGHT for values hovered over. COUNT is the number of data points, MIN-VALUE and MAX-VALUE the extremes.
chart-end
- chart-end CONTEXTprocedure
Terminates a chart block.
Popup block
popup-begin
- popup-begin CONTEXT PANEL DYNAMIC? FLAG-OR-FLAGS RECTprocedure
Starts a popup block. If DYNAMIC? is #t, the popup uses the dynamic flag. FLAG-OR-FLAGS is a symbol or list of symbols, each of which must be one of (border border-header movable scalable closable minimizable dynamic no-scrollbar title). RECT specifies the boundaries of the popup. Returns #t if the popup is visible.
popup-close
- popup-close CONTEXTprocedure
Closes the popup. Must be used inside a popup block.
popup-end
- popup-end CONTEXTprocedure
Terminates a popup block. May only be used if the popup is visible.
Combo block
combo-begin-label
- combo-begin-label CONTEXT PANEL TEXT MAX-HEIGHTprocedure
Starts a combo block with TEXT as displayed item. MAX-HEIGHT specifies the maximum height the opened combo block may occupy. Returns #t if the combo block is opened.
combo-begin-color
- combo-begin-color CONTEXT PANEL COLOR MAX-HEIGHTprocedure
Starts a combo block with COLOR as displayed item. MAX-HEIGHT specifies the maximum height the opened combo block may occupy. Returns #t if the combo block is opened.
combo-items-height
- combo-items-height CONTEXT COUNT ITEM-HEIGHTprocedure
Returns the height COUNT labels each of which is ITEM-HEIGHT tall would occupy. This includes padding and borders.
combo-item-label
- combo-item-label CONTEXT TEXT ALIGNMENTprocedure
Adds a combo item with TEXT as label. ALIGNMENT is a symbol and must be one of (left centered right).
combo-close
- combo-close CONTEXTprocedure
Closes the combo block. Must be used inside a combo block.
combo-end
- combo-end CONTEXTprocedure
Terminates a combo block. May only be used if the combo block is visible.
Contextual block
contextual-begin
- contextual-begin CONTEXT PANEL FLAG-OR-FLAGS SIZE TRIGGER-BOUNDSprocedure
Starts a context block. SIZE is a vector describing its size. TRIGGER-BOUNDS is a rectangle specifying where it can be triggered with a right mouse click. FLAG-OR-FLAGS is a symbol or list of symbols, each of which must be one of (border border-header movable scalable closable minimizable dynamic no-scrollbar title). Returns #t if the context block is visible.
contextual-item-label
- contextual-item-label CONTEXT TEXT ALIGNMENTprocedure
Adds a context item to the current context block with TEXT as label. ALIGNMENT is a symbol and must be one of (left centered right). Returns #t when clicked, otherwise #f.
contextual-end
- contextual-end CONTEXTprocedure
Terminates the context block. May only be used if the context block is visible.
Menubar block
menubar-begin
Starts a menubar block.
menubar-end
Terminates a menubar block.
Menu block
menu-begin-label
Starts a menu block with TEXT as label. ALIGNMENT is a symbol and must be one of (left centered right). WIDTH specifies the menu width. Returns #t if the menu block is visible.
menu-item-label
Adds a menu item to the current menu block with TEXT as label. ALIGNMENT is a symbol and must be one of (left centered right). Returns #t when clicked.
menu-end
Terminates a menu block. May only be used if the menu block is visible.
Widgets
Label widget
label
- label CONTEXT TEXT ALIGNMENTprocedure
Creates a label widget with TEXT as label. ALIGNMENT controls how the text is aligned and must be one of (left centered right).
label-colored
- label-colored CONTEXT TEXT ALIGNMENT COLORprocedure
Creates a colored label widget with TEXT as label painted with COLOR. ALIGNMENT controls how the text is aligned and must be one of (left centered right).
label-wrap
- label-wrap CONTEXT TEXTprocedure
Creates a label widget with wrapped TEXT as label.
Button widget
button-label
- button-label CONTEXT TEXT #!optional REPEATER?procedure
Creates a button widget with TEXT as label. If REPEATER? is #t, the button fires as long as it's clicked, otherwise only once. Returns #t if the button has been clicked.
button-color
- button-color CONTEXT COLOR #!optional REPEATER?procedure
Creates a color button widget with COLOR as value. If REPEATER? is #t, the button fires as long as it's clicked, otherwise only once. Returns #t if the button has been clicked.
button-symbol
- button-symbol CONTEXT SYMBOL #!optional REPEATER?procedure
Creates a button with SYMBOL on it. SYMBOL must be one of (none x underscore circle circle-filled rect rect-filled triangle-up triangle-down triangle-left triangle-right plus minus). If REPEATER? is #t, the button fires as long as it's clicked, otherwise only once. Returns #t if the button has been clicked.
button-symbol-label
- button-symbol-label CONTEXT SYMBOL TEXT ALIGNMENT #!optional REPEATER?procedure
Creates a button with SYMBOL and TEXT as label on it. SYMBOL must be one of (none x underscore circle circle-filled rect rect-filled triangle-up triangle-down triangle-left triangle-right plus minus). ALIGNMENT controls how the text is aligned and must be one of (left centered right). If REPEATER? is #t, the button fires as long as it's clicked, otherwise only once. Returns #t if the button has been clicked.
Checkbox widget
checkbox-label
- checkbox-label CONTEXT TEXT ACTIVE?procedure
Creates a checkbox widget with TEXT as label and ACTIVE? as value. Returns the new value.
Option widget
option-label
- option-label CONTEXT TEXT ACTIVE?procedure
Creates an option widget with TEXT as label and ACTIVE? as value. Returns the new value.
Selectable widget
selectable-label
- selectable-label CONTEXT TEXT ALIGNMENT ACTIVE?procedure
Creates a selectable widget with TEXT as label and ACTIVE? as value. ALIGNMENT must be one of (left centered right). Returns two values, the new value and whether it is different from the old one.
Slider widget
slider-float
- slider-float CONTEXT MIN VALUE MAX STEPprocedure
Creates a slider widget with VALUE as initial float value and MIN and MAX as boundaries. STEP determines how much the value changes per step. Returns two values, the new float value and whether it is different from the old one.
slider-int
- slider-int CONTEXT MIN VALUE MAX STEPprocedure
Creates a slider widget with VALUE as initial integer value and MIN and MAX as boundaries. STEP determines how much the value changes per step. Returns two values, the new integer value and whether it is different from the old one.
Progressbar widget
progressbar
- progressbar CONTEXT VALUE MAX MODIFIABLE?procedure
Creates a progressbar widget with VALUE as initial value. MAX specifies the maximum value that can be displayed. If MODIFIABLE? is #t, the value of the widget can be changed interactively. Returns two values, the new value and whether it is different from the old one.
Color picker widget
color-picker
- color-picker CONTEXT COLOR #!optional RGB?procedure
Creates a color picker widget with COLOR as initially picked color. If the optional RGB? argument is #t, use a RGB instead of a RGBA picker. Returns the new color.
Property widget
property-float
- property-float CONTEXT TEXT MIN VALUE MAX STEP PIXEL-STEPprocedure
Creates a property widget with VALUE as initial float value and MIN and MAX as boundaries. TEXT specifies the widget label, STEP controls the change in value for each step, PIXEL-STEP the travel in pixels necessary to change the widget value when dragging. Returns the new float value.
property-int
- property-int CONTEXT TEXT MIN VALUE MAX STEP PIXEL-STEPprocedure
Creates a property widget with VALUE as initial integer value and MIN and MAX as boundaries. TEXT specifies the widget label, STEP controls the change in value for each step, PIXEL-STEP the travel in pixels necessary to change the widget value when dragging. Returns the new integer value.
Editor widget
edit-string
- edit-string CONTEXT EDIT-FLAG-OR-FLAGS TEXT MAX #!optional FILTER-FLAGprocedure
Creates an text editing widget with TEXT for its initial contents and a maximum length of MAX. EDIT-FLAG-OR-FLAGS must be a symbol or list of symbols specifying the general widget behaviour, with the permitted symbols being (simple field box editor) for predefined behavior and (default read-only auto-select sig-enter allow-tab no-cursor selectable clipboard ctrl-enter-newline no-horizontal-scroll always-insert-mode multiline) for finer-grained control over it. FILTER-FLAG restricts chars that can be entered and must be one of (default ascii float decimal hex oct binary). Returns two values, the new text and a list of edit events, each of which are one of (active inactive activated deactivated committed).
Tooltip
tooltip
- tooltip CONTEXT TEXTprocedure
Creates a tooltip with TEXT as content.
Context
context-input
- context-input CONTEXTprocedure
Returns the current input state associated with CONTEXT.
context-style
- context-style CONTEXTprocedure
Returns the current style associated with CONTEXT.
Canvas
stroke-line
- stroke-line CANVAS X0 Y0 X1 Y1 LINE-THICKNESS COLORprocedure
Draw a line between the coordinates X0, Y0, X1, Y1 with the width LINE-THICKNESS and COLOR on CANVAS.
stroke-curve
- stroke-curve CANVAS AX AY CTRL0X CTRL0Y CTRL1X CTRL1Y BX BY LINE-THICKNESS COLORprocedure
Draw a curve between the coordinates AX, AY, BX, BY with control points CTRL0X, CTRL0Y, CTRL1X, CTRL1Y, the width LINE-THICKNESS and COLOR on CANVAS.
fill-circle
- fill-circle CANVAS RECT COLORprocedure
Draw a filled circle in RECT with COLOR on CANVAS.
Styling
style-window-border
- style-window-border STYLEprocedure
Returns the window border width associated with STYLE.
style-window-header-align-set!
- style-window-header-align-set! STYLE RIGHT?procedure
Sets the window header alignment for STYLE. If RIGHT? is #t, it is set to right-aligned, otherwise left-aligned.
Input
input-mouse
- input-mouse INPUTprocedure
Returns the mouse state for INPUT.
mouse-delta
- mouse-delta MOUSEprocedure
Returns a vector describing the relative change in pixels between the current and last mouse position for MOUSE.
mouse-position
- mouse-position MOUSEprocedure
Returns a vector describing the current mouse position in pixels for MOUSE.
input-mouse-click-down-in-rect?
- input-mouse-click-down-in-rect? INPUT BUTTON RECT DOWN?procedure
Returns #t if the BUTTON has been clicked in RECT for INPUT and its clicked state is equal to the DOWN? argument. BUTTON must be one of (left middle right).
input-mouse-hovering-in-rect?
- input-mouse-hovering-in-rect? INPUT RECTprocedure
Returns #t if the mouse has been hovering in RECT for INPUT, otherwise #f.
input-mouse-previously-hovering-in-rect?
- input-mouse-previously-hovering-in-rect? INPUT RECTprocedure
Returns #t if the mouse has been hovering in the previous frame in RECT for INPUT, otherwise #f.
input-mouse-clicked?
- input-mouse-clicked? INPUT BUTTON RECTprocedure
Returns #t if the BUTTON has been clicked in RECT for INPUT, otherwise #f. BUTTON must be one of (left middle right).
input-mouse-down?
- input-mouse-down? INPUT BUTTONprocedure
Returns #t if the BUTTON is pressed down for INPUT, otherwise #f. BUTTON must be one of (left middle right).
input-mouse-released?
- input-mouse-released? INPUT BUTTONprocedure
Returns #t if the BUTTON is released for INPUT, otherwise #f. BUTTON must be one of (left middle right).
Examples
The following example requires the glfw3 and opengl-glew eggs.
(use (prefix glfw3 glfw:) (prefix opengl-glew gl:) (prefix nuklear nk:)) (require-library nuklear-glfw-opengl2) (import (prefix nuklear-glfw-opengl2 backend:)) (define width 250) (define height 150) (glfw:init) (glfw:make-window width height "Hello World") (glfw:make-context-current (glfw:window)) (set!-values (width height) (glfw:get-window-size (glfw:window))) (define context (backend:init! (glfw:window) #t)) (backend:init-font!) (define quit? #f) (define show-greeting? #f) (define layout (nk:make-panel)) (define popup-layout (nk:make-panel)) (let loop () (when (and (not (glfw:window-should-close (glfw:window))) (not quit?)) (glfw:poll-events) (backend:new-frame) (when (nk:window-begin context layout "Hello World!" (nk:make-rect 10 10 192 100) '(border no-scrollbar movable)) (nk:layout-row-dynamic context 30 2) (when (nk:button-label context "Click Me!") (printf "Yay\n") (set! show-greeting? #t)) (when (nk:button-label context "Quit") (set! quit? #t)) (when show-greeting? (if (nk:popup-begin context popup-layout #f "Greeting" '(dynamic) (nk:make-rect 15 50 200 150)) (begin (nk:layout-row-dynamic context 25 1) (nk:label context "Hello World!" 'centered) (nk:layout-row-dynamic context 25 1) (when (nk:button-label context "OK") (set! show-greeting? #f) (nk:popup-close context)) (nk:popup-end context)) (set! show-greeting? #f)))) (nk:window-end context) (let-values (((width height) (glfw:get-window-size (glfw:window)))) (gl:viewport 0 0 width height)) (gl:clear gl:+color-buffer-bit+) (gl:clear-color (/ 28 255) (/ 48 255) (/ 62 255) 0) (backend:render!) (glfw:swap-buffers (glfw:window)) (loop))) (backend:shutdown!) (glfw:terminate)
Further examples can be found in the repository. Additionally to the previously mentioned eggs, format is required to run the calculator, overview and node editor demos.
Notes
- If you wish to use a different font than the default, set it at init time. Loading multiple fonts and switching the active one is currently unsupported.
- You will need to write your own main loop using eggs that match the chosen backend and the backend API. As only the glfw-opengl2 backend is supported for now, that would be the glfw3 and opengl-glew eggs. Each example contains a full implementation you can reuse.
- As backends can be platform-specific and are built at installation time, their modules aren't automatically loaded by the egg. Therefore you'll need to use require-library and import to load one.
- Widgets typically take an input value and return an output value. Therefore you will need to use global variables, parameters or named-let initializers in the main loop for managing them. Some widgets return multiple values with the output value first, use receive to access the other values.
- Block starters (for windows, groups, combo boxes, etc.) typically return a boolean to indicate whether they're active. If this is the case, then one can draw widgets inside them and finally terminate the block with the matching procedure.
- Layouts must be used inside blocks, otherwise no widgets will be drawn.
- Bind the context and panels to top-level identifiers, otherwise they'll be gone by the next GC and make your application segfault.
License
This software is dual-licensed to the public domain and under the following license: you are granted a perpetual, irrevocable license to copy, modify, publish and distribute its files as you see fit.
Version history
0.1
- Initial release