( x . y )
email: frank@consxy.com | resume (pdf)

Package CLNL-GLTK (link)

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.

Contents (link)

  • variable \font\-height\ - The height of the font used by CLNL-GLTK.
  • variable \font\-width\ - The width of the font used by CLNL-GLTK.
  • variable \slider\-height\ - The default slider height.
  • variable \switch\-height\ - The default switch height.
  • function button - button creates a button widget.
  • function clear - Rests the inputbox ib to empty.
  • function font-print - font-print prints str to the screen.
  • function inputbox - inputbox creates an inputbox widget.
  • function key-pressed - key-pressed will do the appropriate thing in the case of a key being pressed.
  • function mousedown - 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.
  • function mousemove - 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.
  • function mouseup - 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.
  • function render - render is the entry point for rendering different items in the CLNL-GLTK package.
  • function reposition - reposition is the general purpose resizing entry point for all widgets.
  • function resize - resize is the general purpose resizing entry point for all widgets.
  • function setup - setup sets up the clnl-gltk system, calling all the necessary underlying functions.
  • function slider - slider creates a button widget.
  • function switch - switch creates a switch widget.
  • function textbox - textbox creates a textbox widget.
  • function textbox-text - textbox-text allows for the retrieving and setting of the internal text of textbox tb.
  • function toggle - toggle toggles an item.
  • function value - Returns the text that currently resides in the inputbox ib.

Variable \FONT\-HEIGHT\ (link)

Value Type:

an integer

Initial Value:

14

Description:

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.

Variable \FONT\-WIDTH\ (link)

Value Type:

an integer

Initial Value:

7.

Description:

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.

Variable \SLIDER\-HEIGHT\ (link)

Value Type:

an integer

Initial Value:

33

Description:

The default slider height.

Variable \SWITCH\-HEIGHT\ (link)

Value Type:

an integer

Initial Value:

33

Description:

The default switch height.

Function BUTTON (link)

Syntax:

button x y width height text callback &key forever => button

Arguments and Values:

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

Description:

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.

Function CLEAR (link)

Syntax:

clear ib => result

Arguments and Values:

ib---an inputbox result---undefined

Description:

Rests the inputbox ib to empty.

Function FONT-PRINT (link)

Syntax:

font-print str => result

Arguments and Values:

str---a string to be printed to screen result---undefined

Description:

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.

Examples:

(font-print #P"Hello World" t) => nil

Function INPUTBOX (link)

Syntax:

inputbox x y width => ib

Arguments and Values:

x---x offset, in pixels y---y offset, in pixels width---width, in characters ib---an inputbox that can later be rendered

Description:

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.

Function KEY-PRESSED (link)

Syntax:

key-pressed ib key => result

Arguments and Values:

ib---An inputbox key---Key pressed, an integer or a symbol result---Undefined

Description:

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

Function MOUSEDOWN (link)

Syntax:

mousedown item x y => result

Arguments and Values:

item---item handling event x---an integer y---an integer result---undefined

Description:

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.

Function MOUSEMOVE (link)

Syntax:

mousemove item x y => result

Arguments and Values:

item---item handling event x---an integer y---an integer result---undefined

Description:

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.

Function MOUSEUP (link)

Syntax:

mouseup item x y => result

Arguments and Values:

item---item handling event x---an integer y---an integer result---undefined

Description:

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.

Function RENDER (link)

Syntax:

render item => result

Arguments and Values:

item---item to be rendered result---undefined

Description:

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.

Function REPOSITION (link)

Syntax:

reposition item x y => result

Arguments and Values:

item---item to be rendered x---an integer y---an integer result---undefined

Description:

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.

Function RESIZE (link)

Syntax:

resize item width height => result

Arguments and Values:

item---item to be rendered width---an integer height---an integer result---undefined

Description:

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.

Function SETUP (link)

Syntax:

setup => result

Arguments and Values:

result---undefined

Description:

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.

Function SLIDER (link)

Syntax:

slider x y width text callback min max increment value => slider

Arguments and Values:

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

Description:

slider creates a button widget.

TODO: The rest of this description needs to be updated!

Function SWITCH (link)

Syntax:

switch x y width text callback &optional initial-state => switch

Arguments and Values:

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

Description:

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.

Function TEXTBOX (link)

Syntax:

textbox x y width height &key text border word-wrap => tb

Arguments and Values:

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

Description:

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.

Function TEXTBOX-TEXT (link)

Syntax:

textbox-text tb => text

Arguments and Values:

tb---a textbox text---string currently being displayed

Description:

textbox-text allows for the retrieving and setting of the internal text of textbox tb.

Function TOGGLE (link)

Syntax:

toggle item &optional state => new-state

Arguments and Values:

item---an item state---a boolean, the state to set to new-state---a boolean, the state after being set

Description:

toggle toggles an item.

Inverts the current toggle status of the item if no state passed in, otherwise sets to state.

Function VALUE (link)

Syntax:

value ib => text

Arguments and Values:

ib---an inputbox text---a string, the text currently in ib

Description:

Returns the text that currently resides in the inputbox ib.