User Interface Definitions

Graphical user interfaces (GUIs) are accepted by the MI parser and the API module. API passes all information on to the PHCR module, which provides the actual user interface for editing shader parameters. PHCR is not included in raylib, it is available only in separate executables. All GUI functions are no-ops if PHCR is not linked in.

mi_api_gui_begin
miBoolean mi_api_gui_begin(
    char            *name)     /* gui name */

Begin the definition of a new user interface named name. The name will generally be the name of the declaration or function that the GUI describes. If there is already a user interface with the given name, it is deleted. If two different concurrent threads operate on a GUI with a given name, the changes by both are compounded; concurrent creation should be avoided.

mi_api_gui_end
miBoolean mi_api_gui_end(void)

Complete the definition of the GUI. The previous and this function bracket the user interface definition. All other GUI functions except mi_api_gui_default can only be used between begin and end.

mi_api_gui_control_begin
miBoolean mi_api_gui_control_begin(
    char            *name,     /* control name */
    char            *type)     /* control type */

After beginning the GUI, controls such as buttons, sliders, color choosers and others, can be added to it. The control is named name, which may be a null pointer for unnamed controls. GUIs that describe a shader should have controls named after input shader parameters; PHCR will connect these controls to the shader directly. The possible control types type are defined by the PHCR module.

mi_api_gui_control_end
miBoolean mi_api_gui_control_end(void)

After beginning a control, attributes and sub-controls may be defined. After the last definition, the control must be completed with this call. After completion, another control may be begun, or the GUI can be ended.

mi_api_gui_push
miBoolean mi_api_gui_push(void)

Some types of controls, such as cell containers or menus, can contain sub-controls. Between control begin and end, the nesting level can be pushed to begin the subdefinition, which contains its own control begin and end pairs and ends with a pop operation. Cell containers can contain multiple subdefinitions, each with its own push/pop pair; all others may contain only one. In the cell container pair, each push/pop pair fills the next cell (in row-major order beginning at 0/0); but the cell can also be set explicitly with mi_api_gui_attr ("cell", ...) before the push.

mi_api_gui_pop
miBoolean mi_api_gui_pop(void)

Complete the definition of a subdefinition.

mi_api_gui_attr
miBoolean mi_api_gui_attr(
    char            *name,      /* parameter name */
    miParam_type    type,       /* bool, scal, string */
    int             nval, ...)  /* # of values, vals */

Apply an attribute to the current GUI or control. Attributes control the appearance; there are attributes for foreground and background colors, size, value, limits, number of cells and cell number, etc. For a complete list see the PHCR module documentation. Attributes always apply to the GUI or control most recently begun at the current push/pop nesting level. Attributes may not be set between a push and a control begin.

mi_api_gui_default
miBoolean mi_api_gui_default(
    miTag           tag,       /* decl or function */
    char            *name,     /* name of <tag> */
    miBoolean       override)  /* recreate? */

The previous GUI calls are used for defining a GUI explicitly. This call is independent and creates a GUI automatically given the tag of a function declaration or function (the result is the same in both cases except that parameter values are applied in the function case). The tag specifies the declaration or function to be used as a template, name is the GUI name to create (it should agree with the shading function name if tag is a declaration), and override controls whether the default GUI should replace an existing GUI definition. It is normally miFALSE because default GUIs should not override explicitly defined GUIs.

Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.