Main clnl-gltk package.
Use widgets available in clnl-gltk to create NetLogo user interface widgets in pure opengl. This project doesn't have much usefulness outside of CLNL.
an integer
14
The height of the font used by CLNL-GLTK.
This can be used to calculate appropriate sizes of things that may have fonts displayed in them.
an integer
7.
The width of the font used by CLNL-GLTK.
This can be used to calculate appropriate sizes of things that may have fonts displayed in them.
an integer
33
The default slider height.
an integer
33
The default switch height.
button x y width height text callback &key forever => button
x---x offset, in pixels y---y offset, in pixels width---width, in pixels height---height, in pixels text---string for the textual display callback---a function forever---a boolean, including whether this button is a forever button button---a button that can later be rendered
button creates a button widget.
The widget will center the viewable TExT inside itself, replacing the last three characters with an ellipses if the text is too large for the given dimensions. It will never clip a character.
button objects also work with mouse movement functions. When it identifies that a click has happened, callback will be called.
When forever is non NIL, an extra icon is added to the button.
clear ib => result
ib---an inputbox result---undefined
Rests the inputbox ib to empty.
font-print str => result
str---a string to be printed to screen result---undefined
font-print prints str to the screen.
It affirms no assumptions that are required for it to run, in the interest of speed. Those assumptions include that an opengl window has been opened, that all matrices are correct, and that SETUP-FONT has been run.
(font-print #P"Hello World" t)
=> nil
inputbox x y width => ib
x---x offset, in pixels y---y offset, in pixels width---width, in characters ib---an inputbox that can later be rendered
inputbox creates an inputbox widget.
The inputbox is a simple, single lined, box that can hold a mutating string. Use the various inputbox-* functions to add to it and modify it. As a string is added to it that is too large, it will scroll the characters automatically.
The widget is defined in terms of characters, rather than pixels. In this way, it will never clip a portion of a character off.
key-pressed ib key => result
ib---An inputbox key---Key pressed, an integer or a symbol result---Undefined
key-pressed will do the appropriate thing in the case of a key being pressed.
When an integer, will insert the text into the appropriate location, if it's an ascii character less than 256.
The other values acceptable are:
:key-left moves the cursor one to the left :key-right moves the cursor one to the right
mousedown item x y => result
item---item handling event x---an integer y---an integer result---undefined
mousedown is the general purpose mousedown entry point for all widgets. It is used to alert widgets that a mouse button has been pressed, and where. There's no information on which button has been pressed.
x and y are absolute coordinates, and assumed to be opengl coordinates, not window coordinates (meaning they match the render and setup functions of widgets).
A catchall method that does nothing is also defined so that mouse functions can loop over all available widgets and let them decide what they want to do.
mousemove item x y => result
item---item handling event x---an integer y---an integer result---undefined
mousemove is the general purpose mousemove entry point for all widgets. It is used to alert widgets to movements of the mouse, regardless of button state.
x and y are absolute coordinates, and assumed to be opengl coordinates, not window coordinates (meaning they match the render and setup functions of widgets).
A catchall method that does nothing is also defined so that mouse functions can loop over all available widgets and let them decide what they want to do.
mouseup item x y => result
item---item handling event x---an integer y---an integer result---undefined
mouseup is the general purpose mouseup entry point for all widgets. It is used to alert widgets to that a mouse button has been released, and where. There's no information on which button has been released, and it is up to the widget to decide if a click was triggered.
x and y are absolute coordinates, and assumed to be opengl coordinates, not window coordinates (meaning they match the render and setup functions of widgets).
A catchall method that does nothing is also defined so that mouse functions can loop over all available widgets and let them decide what they want to do.
render item => result
item---item to be rendered result---undefined
render is the entry point for rendering different items in the CLNL-GLTK package.
render will return the opengl world to the way it found it after finishing, usually via just popping the matrix.
reposition item x y => result
item---item to be rendered x---an integer y---an integer result---undefined
reposition is the general purpose resizing entry point for all widgets.
x and y are contextual to the actual item being repositioned, and may be even be ignored.
resize item width height => result
item---item to be rendered width---an integer height---an integer result---undefined
resize is the general purpose resizing entry point for all widgets.
width and height are contextual to the actual item being resized, and may be even be ignored.
setup => result
result---undefined
setup sets up the clnl-gltk system, calling all the necessary underlying functions.
Calling before the opengl system has been initialized properly may or may not work, so calling it after everything else has been initialized is recommended.
slider x y width text callback min max increment value => slider
x---x offset, in pixels y---y offset, in pixels width---width, in pixels text---string for the textual display callback---a function min---minimum value max---maximum value increment---increment when moving the slider value---inital value slider---a slider that can later be rendered
slider creates a button widget.
TODO: The rest of this description needs to be updated!
switch x y width text callback &optional initial-state => switch
x---x offset, in pixels y---y offset, in pixels width---width, in pixels text---string for the textual display callback---a function initial-state---a boolean, defaulting to nil switch---a switch that can later be rendered
switch creates a switch widget.
The widget will center the viewable TExT inside itself, replacing the last three characters with an ellipses if the text is too large for the given dimensions. It will never clip a character.
switch objects also work with mouse movement functions. When it identifies that a mousedown has happened, the state of the switch will be changed, and callback will be called with the new state.
The initial-state defines whether the switch starts on or off.
textbox x y width height &key text border word-wrap => tb
x---x offset, in pixels y---y offset, in pixels width---width, in characters height---height, in characters text---optional string for the textual display border---boolean, whether we draw a border, defaults to t word-wrap---boolean, whether we attempt to wrap the text tb---a textbox that can later be rendered
textbox creates a textbox widget.
The widget is defined in terms of characters, rather than pixels. In this way, it will never clip a portion of a character off. It will also display whatever it can of its text, clipping off characters that are outside.
Multiline strings are supported, and each one appears on a new line.
When border is NIL, no border is drawn and the text box floats, which can be useful for labels.
When word-wrap is non NIL, the text is attempted to wrap by the following rules. The wrapping is done at the line if possible, at a breaking character if possible, or just fits as many letters as it can befoer wrapping. It then only clips off on the bottom. The only breaking character currently is #Space.
textbox-text tb => text
tb---a textbox text---string currently being displayed
textbox-text allows for the retrieving and setting of the internal text of textbox tb.
toggle item &optional state => new-state
item---an item state---a boolean, the state to set to new-state---a boolean, the state after being set
toggle toggles an item.
Inverts the current toggle status of the item if no state passed in, otherwise sets to state.
value ib => text
ib---an inputbox text---a string, the text currently in ib
Returns the text that currently resides in the inputbox ib.