DI-Guy SDK Documentation  13.6
diguyViewLabel Class Reference

The diguyViewLabel allows on screen 2D and 3D labels in diguy scenario and the opengl renderer. More...

#include <diguyViewLabel.h>

Public Member Functions

General Functions

All functions in this section are callable from:

  • C++
  • Script
const char * get_name ()
 Returns the name of the object. More...
 
Text Functions

All functions in this section are callable from:

  • C++
  • Script
void set_text (const char *text)
 Sets the text on the label. More...
 
const char * get_text ()
 Returns the text on the label. More...
 
int set_font (const char *name)
 Sets the font to use. More...
 
const char * get_font ()
 Returns the font set by set_font. More...
 
void set_text_color (float r, float g, float b, float a, float interp_time=0.0f)
 Similar to set_background_color(), but sets the color of the label text. More...
 
void set_text_shadow_color (float r, float g, float b, float a, float interp_time=0.0f)
 Similar to set_background_color(), but sets the shadow color of the label text. More...
 
void set_text_shadow_enabled (int text_shadow_enabled)
 Enables or disables text shadow. More...
 
void set_text_justification (diguyViewLabelJustification just)
 Sets how the label text is justified, possible values are: More...
 
diguyViewLabelJustification get_text_justification ()
 Returns how the text on the label is being justified. More...
 
void set_text_offset_x (int offset)
 Adds an x offset to the text part of the label. More...
 
int get_text_offset_x ()
 Returns: returns the x offset of the text part of the label. More...
 
void set_text_offset_y (int offset)
 Adds a y offset to the text part of the label. More...
 
int get_text_offset_y ()
 Returns: returns the y offset of the text part of the label. More...
 
Position Functions

All functions in this section are callable from:

  • C++
  • Script
void set_x (float screen_x_offset, float interp_time=0.0f)
 Sets the x location of the label. More...
 
float get_x ()
 Gets the x location of the label. More...
 
void set_y (float screen_y_offset, float interp_time=0.0f)
 Sets the y location of the label. More...
 
float get_y ()
 Gets the y location of the label. More...
 
void set_world_xyz (float x, float y, float z)
 Sets the position of the label in world space. More...
 
void get_world_xyz (float *x, float *y, float *z)
 Gets the position of the label in world space. More...
 
void set_negative_wraps_x (int wrap)
 Sets if having a negative value wraps to the other side of the viewport. More...
 
int get_negative_wraps_x ()
 Returns: 1 if x wraps its offset when negative. More...
 
void set_negative_wraps_y (int wrap)
 Sets if having a negative value wraps to the other side of the viewport. More...
 
int get_negative_wraps_y ()
 Returns: 1 if y wraps its offset when negative. More...
 
void set_window_justification_x (diguyViewLabelJustification just)
 Sets how the label is positioned relative to the window, possible values are: More...
 
diguyViewLabelJustification get_window_justification_x ()
 Returns: label's x positioning parameter described above. More...
 
void set_window_justification_y (diguyViewLabelJustification just)
 Sets how the label is positioned relative to the window. More...
 
diguyViewLabelJustification get_window_justification_y ()
 Returns: label's y positioning parameter described above. More...
 
void set_offset_x (int offset)
 Adds a screen-space x offset to the final position of the label. More...
 
int get_offset_x ()
 Returns: returns the x offset of the label. More...
 
void set_offset_y (int offset)
 Adds a screen-space y offset to the final position of the label. More...
 
int get_offset_y ()
 Returns: returns the y offset of the label. More...
 
void set_minimum_width (int min_x)
 Sets the minimum width of the label. More...
 
int get_minimum_width ()
 Returns: minimum width of the label, as set by set_minimum_width() More...
 
void set_minimum_height (int min_y)
 Similar to set_minimum_width(), but sets minimum label height. More...
 
int get_minimum_height ()
 Similar to set_minimum_height(), but returns minimum label height. More...
 
int get_width ()
 Returns: the current label width. More...
 
int get_height ()
 Returns: the current label height. More...
 
void set_full_window (int full_window)
 Turns the label into a full-window overlay. More...
 
int get_full_window ()
 Returns: whether label is full-window, as set by set_full_window() More...
 
void reset ()
 Resets the parameters of the label to the values from the constructor. More...
 
void set_visible (int visible)
 Sets the visibility of a label. More...
 
int get_visible ()
 Returns: visibility of label, as set by set_visible() More...
 
Background Functions

All functions in this section are callable from:

  • C++
  • Script
void set_background_color (float r, float g, float b, float a, float interp_time=0.0f)
 Sets the color of the label background. More...
 
void set_background_image (const char *filename)
 Sets the background image of the label. More...
 
void set_background_enabled (int background_enabled)
 Enables or disables label background. More...
 
Border Functions

All functions in this section are callable from:

  • C++
  • Script
void set_border_color (float r, float g, float b, float a, float interp_time=0.0f)
 Similar to set_border_color(), but sets the border color of the label background. More...
 
void set_margin_size (int margin_size)
 Sets the margin, of the label. More...
 
void set_border_enabled (int border_enabled)
 Sets if the border should be visible. More...
 
Bar Graph Functions

These functions allow view labels to be used as bar graph-like visuals.

This can be useful for providing a graphical representation for various parameters in a scenario; for example, to show the level of different control parameters of a DI-Guy AI Agent.

Lua Example:

local label_bar_graph = this_scenario:find_or_create_label("bar_graph");
-- set position and minimum sizes
label_bar_graph:set_x(10.0);
label_bar_graph:set_y(20.0);
label_bar_graph:set_minimum_width(10.0);
label_bar_graph:set_minimum_height(100.0);
-- enable bar graph functionality:
-- 4 bars/lines
-- lines are vertical
-- lines are 8 pixels wide
-- 4 pixels between lines
label_bar_graph:enable_bar_graph(4, 1, 10, 4);
-- set bar graph line colors
label_bar_graph:set_bar_graph_line_color(0, 1.0, 0.0, 0.0, 1.0); -- red
label_bar_graph:set_bar_graph_line_color(1, 0.0, 1.0, 0.0, 1.0); -- green
label_bar_graph:set_bar_graph_line_color(2, 0.0, 0.0, 1.0, 1.0); -- blue
label_bar_graph:set_bar_graph_line_color(3, 1.0, 1.0, 0.0, 1.0); -- yellow
-- set bar graph line magnitudes (height in this case)
label_bar_graph:set_bar_graph_line_magnitude_ratio(0, 1.0);
label_bar_graph:set_bar_graph_line_magnitude_ratio(1, 0.25);
label_bar_graph:set_bar_graph_line_magnitude_ratio(2, 0.5);
label_bar_graph:set_bar_graph_line_magnitude_ratio(3, 1.0);

All functions in this section are callable from:

  • C++
  • Script
void enable_bar_graph (int num_lines, int lines_are_vertical=1, int line_thickness=10, int space_between_lines=2, int derive_minimum_label_size=1)
 Enables bar graph functionality for this label. More...
 
void disable_bar_graph ()
 Disables bar graph functionality for this label. More...
 
int get_bar_graph_num_lines ()
 Returns: number of bars/lines in bar graph. More...
 
int get_bar_graph_lines_are_vertical ()
 Returns: 1 if lines to go bottom to top, 0 if lines to go left to right. More...
 
void set_bar_graph_line_color (int line_number, float r, float g, float b, float a)
 Sets the color of the specified line. More...
 
void set_bar_graph_line_magnitude_ratio (int line_number, float ratio)
 Sets how much of the usable space (bottom to top for vertical lines, left to right for horizontal lines) a line will take up at its maximum length. More...
 
void set_bar_graph_line_magnitude_pixels (int line_number, int pixels)
 Similar to set_bar_graph_line_magnitude_ratio(), but sets the length of the line based on absolute pixels. More...
 

Misc Functions

Unless otherwise noted all functions in this section are callable from:

  • C++
  • Script
enum  {
  CALLBACK_ID_USER_SELECTED = 1, CALLBACK_ID_USER_UNSELECTED, CALLBACK_ID_IGUY_INTERACT, CALLBACK_ID_MOUSE_DOWN,
  CALLBACK_ID_MOUSE_UP, CALLBACK_ID_LEFT_CLICK, CALLBACK_ID_RIGHT_CLICK, CALLBACK_ID_MIDDLE_CLICK,
  CALLBACK_ID_DOUBLE_CLICK, CALLBACK_ID_BEGIN_DRAG, CALLBACK_ID_END_DRAG
}
 This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script(). More...
 
void set_is_temporary (int temporary)
 Sets if a label is temporary. More...
 
int get_is_temporary ()
 Returns: 1 if a label is temporary, 0 if not; see set_is_temporary() More...
 
void set_draw_limit (float draw_limit)
 Sets how far away the label will be drawn. More...
 
float get_draw_limit ()
 Gets how far away the label will be drawn. More...
 
void set_is_clickable (int is_clickable)
 Sets if the label is clickable with the mouse. More...
 
int get_is_clickable ()
 Returns: 1 if label responds to mouse clicks, 0 if not; see set_is_clickable() More...
 
const char * get_type_name ()
  Resturs: More...
 
int add_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL)
 This function adds a user callback script. More...
 
int remove_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL)
 This function removes a user callback script previously added with add_callback_script(). More...
 
int add_callback (int callback_id, diguyViewLabelCallback *callback, void *callback_params=NULL, void *callback_user_data=NULL)
 This function adds a user callback. More...
 
int remove_callback (int callback_id, diguyViewLabelCallback *callback)
 This function removes a user callback. More...
 
int remove_callback_with_user_data (int callback_id, void *callback_user_data)
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiGraphicsLabelm_label
 A pointer to internal data. More...
 
class bdiGraphicsLabel
 
bdiGraphicsLabelget_scripted_object ()
 
 diguyViewLabel (bdiGraphicsLabel *label)
 A private constructor. More...
 

Detailed Description

The diguyViewLabel allows on screen 2D and 3D labels in diguy scenario and the opengl renderer.

Link against: libdiguy

Member Enumeration Documentation

anonymous enum

This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().

Enumerator
CALLBACK_ID_USER_SELECTED 
CALLBACK_ID_USER_UNSELECTED 
CALLBACK_ID_IGUY_INTERACT 
CALLBACK_ID_MOUSE_DOWN 
CALLBACK_ID_MOUSE_UP 
CALLBACK_ID_LEFT_CLICK 
CALLBACK_ID_RIGHT_CLICK 
CALLBACK_ID_MIDDLE_CLICK 
CALLBACK_ID_DOUBLE_CLICK 
CALLBACK_ID_BEGIN_DRAG 
CALLBACK_ID_END_DRAG 

Constructor & Destructor Documentation

diguyViewLabel::diguyViewLabel ( bdiGraphicsLabel label)
private

A private constructor.

Member Function Documentation

const char* diguyViewLabel::get_name ( )

Returns the name of the object.

This pointer will never be NULL.

Returns:

name of the object

void diguyViewLabel::set_text ( const char *  text)

Sets the text on the label.

const char* diguyViewLabel::get_text ( )

Returns the text on the label.

Returns:

pointer to NULL-terminated string

int diguyViewLabel::set_font ( const char *  name)

Sets the font to use.

const char* diguyViewLabel::get_font ( )

Returns the font set by set_font.

Returns:

NULL or pointer to NULL-terminated string

void diguyViewLabel::set_text_color ( float  r,
float  g,
float  b,
float  a,
float  interp_time = 0.0f 
)

Similar to set_background_color(), but sets the color of the label text.

Default color is solid white (1, 1, 1, 1).

void diguyViewLabel::set_text_shadow_color ( float  r,
float  g,
float  b,
float  a,
float  interp_time = 0.0f 
)

Similar to set_background_color(), but sets the shadow color of the label text.

Default color is solid black (0, 0, 0, 1).

void diguyViewLabel::set_text_shadow_enabled ( int  text_shadow_enabled)

Enables or disables text shadow.

Default is 0 (disabled).

Parameters
text_shadow_enabledpass 1 to enable shadow, 0 to disable
void diguyViewLabel::set_text_justification ( diguyViewLabelJustification  just)

Sets how the label text is justified, possible values are:

  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER

Depending on how the flag is set the text will either draw flowing to the right of the current x. The left of the current x or centered above x.

diguyViewLabelJustification diguyViewLabel::get_text_justification ( )

Returns how the text on the label is being justified.

Returns:

One of the following values:

  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER
void diguyViewLabel::set_text_offset_x ( int  offset)

Adds an x offset to the text part of the label.

int diguyViewLabel::get_text_offset_x ( )

Returns: returns the x offset of the text part of the label.

void diguyViewLabel::set_text_offset_y ( int  offset)

Adds a y offset to the text part of the label.

int diguyViewLabel::get_text_offset_y ( )

Returns: returns the y offset of the text part of the label.

void diguyViewLabel::set_x ( float  screen_x_offset,
float  interp_time = 0.0f 
)

Sets the x location of the label.

Positive numbers are relative to the left side of the screen; negative numbers are relative to the right side of the screen.

The optional interp_time argument will make the label animate to its new location.

Parameters
screen_x_offsetx offset in pixels
interp_timeamount of time in seconds used to shift to new position
float diguyViewLabel::get_x ( )

Gets the x location of the label.

**

Note
this will return the current x value, not the desired one.
void diguyViewLabel::set_y ( float  screen_y_offset,
float  interp_time = 0.0f 
)

Sets the y location of the label.

Positive numbers are relative to the bottom of the screen; negative numbers are relative to the top of the screen.

The optional interp_time argument will make the label animate to its new location.

Parameters
screen_y_offsety offset in pixels
interp_timeamount of time in seconds used to shift to new position
float diguyViewLabel::get_y ( )

Gets the y location of the label.

**

Note
this will return the current y value, not the desired one.
void diguyViewLabel::set_world_xyz ( float  x,
float  y,
float  z 
)

Sets the position of the label in world space.

Parameters
x,y,zcoordinates in world space
void diguyViewLabel::get_world_xyz ( float *  x,
float *  y,
float *  z 
)

Gets the position of the label in world space.

void diguyViewLabel::set_negative_wraps_x ( int  wrap)

Sets if having a negative value wraps to the other side of the viewport.

Defaults to 1.

Parameters
wrap1 if x should wrap; 0 if not
int diguyViewLabel::get_negative_wraps_x ( )

Returns: 1 if x wraps its offset when negative.

void diguyViewLabel::set_negative_wraps_y ( int  wrap)

Sets if having a negative value wraps to the other side of the viewport.

Defaults to 1.

Parameters
wrap1 if y should wrap; 0 if not
int diguyViewLabel::get_negative_wraps_y ( )

Returns: 1 if y wraps its offset when negative.

void diguyViewLabel::set_window_justification_x ( diguyViewLabelJustification  just)

Sets how the label is positioned relative to the window, possible values are:

  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER

Depending on how the flag is set the x offset will be measured from the right of the screen, the left or from the center of the window.

diguyViewLabelJustification diguyViewLabel::get_window_justification_x ( )

Returns: label's x positioning parameter described above.

void diguyViewLabel::set_window_justification_y ( diguyViewLabelJustification  just)

Sets how the label is positioned relative to the window.

Possible values are:

  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_BOTTOM
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_TOP
  • DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER

Depending on how the flag is set the y offset will be measured from the bottom of the screen, from the top or from the center of the window.

diguyViewLabelJustification diguyViewLabel::get_window_justification_y ( )

Returns: label's y positioning parameter described above.

void diguyViewLabel::set_offset_x ( int  offset)

Adds a screen-space x offset to the final position of the label.

int diguyViewLabel::get_offset_x ( )

Returns: returns the x offset of the label.

void diguyViewLabel::set_offset_y ( int  offset)

Adds a screen-space y offset to the final position of the label.

int diguyViewLabel::get_offset_y ( )

Returns: returns the y offset of the label.

void diguyViewLabel::set_minimum_width ( int  min_x)

Sets the minimum width of the label.

The default is 0, which will size the label width to fit the label text or bar graph.

Parameters
min_xminimum width, in pixels
int diguyViewLabel::get_minimum_width ( )

Returns: minimum width of the label, as set by set_minimum_width()

void diguyViewLabel::set_minimum_height ( int  min_y)

Similar to set_minimum_width(), but sets minimum label height.

int diguyViewLabel::get_minimum_height ( )

Similar to set_minimum_height(), but returns minimum label height.

int diguyViewLabel::get_width ( )

Returns: the current label width.

int diguyViewLabel::get_height ( )

Returns: the current label height.

void diguyViewLabel::set_full_window ( int  full_window)

Turns the label into a full-window overlay.

This can be useful for things like Heads-Up Displays (HUDs).

If there is a background image (see set_background_image()), the image will be scaled to fit the entire screen.

Default is 0 (not full-window). **

Note
turning a label into a full window will automatically make it non-clickable.
Parameters
full_windowpass 1 for full-window, 0 for not full-window
int diguyViewLabel::get_full_window ( )

Returns: whether label is full-window, as set by set_full_window()

void diguyViewLabel::reset ( )

Resets the parameters of the label to the values from the constructor.

void diguyViewLabel::set_visible ( int  visible)

Sets the visibility of a label.

Default is 1 (visible).

Parameters
visiblepass 1 to make label visible, 0 for invisible
int diguyViewLabel::get_visible ( )

Returns: visibility of label, as set by set_visible()

void diguyViewLabel::set_background_color ( float  r,
float  g,
float  b,
float  a,
float  interp_time = 0.0f 
)

Sets the color of the label background.

The optional interp_time argument will make the label gradually shift to its new color.

Parameters
r,g,b,aRGBA values of new color, between 0.0 and 1.0
interp_timeamount of time in seconds used to shift to new color

Default color is translucent blue (0, 0, 0.3, 0.7).

void diguyViewLabel::set_background_image ( const char *  filename)

Sets the background image of the label.

The file will be looked for in $DIGUY/custom/geometry/rgb first, then in $DIGUY/geometry/rgb.

The default is no background image.

void diguyViewLabel::set_background_enabled ( int  background_enabled)

Enables or disables label background.

Default is 1 (enabled).

Parameters
background_enabledpass 1 to enable shadow, 0 to disable
void diguyViewLabel::set_border_color ( float  r,
float  g,
float  b,
float  a,
float  interp_time = 0.0f 
)

Similar to set_border_color(), but sets the border color of the label background.

Default color is translucent white (1, 1, 1, 0.7).

Parameters
r,g,b,aRGBA values of new color, between 0.0 and 1.0
interp_timeamount of time in seconds used to shift to new color
void diguyViewLabel::set_margin_size ( int  margin_size)

Sets the margin, of the label.

Default is 6 pixels.

Parameters
margin_sizemargin size in pixels
void diguyViewLabel::set_border_enabled ( int  border_enabled)

Sets if the border should be visible.

Default is 1 (enabled).

Parameters
border_enabledpass 1 to enable, 0 to disable
void diguyViewLabel::enable_bar_graph ( int  num_lines,
int  lines_are_vertical = 1,
int  line_thickness = 10,
int  space_between_lines = 2,
int  derive_minimum_label_size = 1 
)

Enables bar graph functionality for this label.

Note that this doesn't automatically turn off text or background image.

Label position and minimum sizes should be set before this is called.

Parameters
num_linesnumber of lines/bars that will be shown
lines_are_verticalpass 1 for lines to go bottom to top, 0 for lines to go left to right
line_thicknessline thickness, in pixels
space_between_linesspace between lines, in pixels
derive_minimum_label_sizederive and set the minimum label size, as if set_minimum_width() and set_minimum_height() were called to fit this bar graph
void diguyViewLabel::disable_bar_graph ( )

Disables bar graph functionality for this label.

Bar graph lines will no longer be visible.

int diguyViewLabel::get_bar_graph_num_lines ( )

Returns: number of bars/lines in bar graph.

int diguyViewLabel::get_bar_graph_lines_are_vertical ( )

Returns: 1 if lines to go bottom to top, 0 if lines to go left to right.

void diguyViewLabel::set_bar_graph_line_color ( int  line_number,
float  r,
float  g,
float  b,
float  a 
)

Sets the color of the specified line.

void diguyViewLabel::set_bar_graph_line_magnitude_ratio ( int  line_number,
float  ratio 
)

Sets how much of the usable space (bottom to top for vertical lines, left to right for horizontal lines) a line will take up at its maximum length.

Parameters
line_numberline to change
ratiohow much of the line to display, from 0 (none) to 1 (all)

For example, if, based on the label height, the bar graph has at most 20 pixels to show each line, passing 0.5 for ratio will fill 10 pixels with the line color, while passing 1.0 for ratio will fill all 20 pixels.

void diguyViewLabel::set_bar_graph_line_magnitude_pixels ( int  line_number,
int  pixels 
)

Similar to set_bar_graph_line_magnitude_ratio(), but sets the length of the line based on absolute pixels.

Note that care should be taken to not overrun the current height or width of the label when using this function.

Parameters
line_numberline to change
pixelsline length in pixels
void diguyViewLabel::set_is_temporary ( int  temporary)

Sets if a label is temporary.

Temporary labels are destroyed on scenario reset, and will not re-appear unless they are recreated.

Pass 1 to make label temporary, 0 to make it permanent.

int diguyViewLabel::get_is_temporary ( )

Returns: 1 if a label is temporary, 0 if not; see set_is_temporary()

void diguyViewLabel::set_draw_limit ( float  draw_limit)

Sets how far away the label will be drawn.

Parameters
draw_limit-1 to always draw, otherwise will draw till draw_limit is reached
float diguyViewLabel::get_draw_limit ( )

Gets how far away the label will be drawn.

Defaults to -1 which always draws.

void diguyViewLabel::set_is_clickable ( int  is_clickable)

Sets if the label is clickable with the mouse.

For character labels this is the equivalent of clicking on the character itself, and can trigger the CALLBACK_ID_IGUY_INTERACT callback.

For screen labels it triggers CALLBACK_ID_USER_SELECTED on mouse down, and CALLBACK_ID_USER_UNSELECTED on mouse up.

By default labels are clickable.

Parameters
is_clickablepass 1 to enable, 0 to disable
int diguyViewLabel::get_is_clickable ( )

Returns: 1 if label responds to mouse clicks, 0 if not; see set_is_clickable()

const char* diguyViewLabel::get_type_name ( )

Resturs:

NULL-terminated string "label"

int diguyViewLabel::add_callback_script ( int  callback_id,
const char *  callback_script,
const char *  callback_script_type = NULL 
)

This function adds a user callback script.

Callback scripts can be removed with remove_callback_script().

Parameters
callback_idinteger id of the callback
callback_scriptscript text of callback to be added
callback_script_typethe type of script contained in callback_script

If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

lua specific:

When the script is called, the object for which it is being called will be in the callback_object global.

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

lua Example:

------------------------------------------------------------------------------
local on_clicked_callback = [[
local la_name = callback_object:get_name();
bdi_log_print(BDI_LOG_WARN, "Calling on_click for label ".. la_name .. "'.\n");
]]
------------------------------------------------------------------------------
label:add_callback_script(diguyViewLabel_CALLBACK_ID_USER_UNSELECTED,
on_clicked_callback,
"lua");
int diguyViewLabel::remove_callback_script ( int  callback_id,
const char *  callback_script,
const char *  callback_script_type = NULL 
)

This function removes a user callback script previously added with add_callback_script().

Parameters
callback_idinteger id of the callback
callback_scriptscript text of callback previously added
callback_script_typethe type of script contained in callback_script

If NULL is passed for callback_script, all callback scripts whose ids match callback_id and whose types match callback_script_type will be removed.

If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

lua specific:

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

Lua Example:

--
-- Remove all callback scripts with id
-- diguyViewLabel_CALLBACK_ID_USER_UNSELECTED
--
label:remove_callback_script(diguyViewLabel_CALLBACK_ID_USER_UNSELECTED,
nil,
"lua");
int diguyViewLabel::add_callback ( int  callback_id,
diguyViewLabelCallback callback,
void *  callback_params = NULL,
void *  callback_user_data = NULL 
)

This function adds a user callback.

Callbacks can be removed with remove_callback() or remove_callback_with_user_data().

Parameters
callbackpointer to function with prototype diguyViewLabelCallback (typedefed above)
callback_idinteger id of when this callback is to be called
callback_paramsnot currently used; pass NULL
callback_user_datapointer for user's own use; DI-Guy will do nothing to the contents of this pointer beyond passing it back when the callback is invoked

Returns:

0 on success, -1 on failure

Callable From:

  • C++
int diguyViewLabel::remove_callback ( int  callback_id,
diguyViewLabelCallback callback 
)

This function removes a user callback.

All callbacks matching the specified callback_id and callback function will be removed.

Parameters
callback_idinteger id of when this callback is to be called
callbackpointer to function with prototype diguyViewLabelCallback (typedefed above)

Returns:

0 on success, -1 on failure

Callable From:

  • C++
int diguyViewLabel::remove_callback_with_user_data ( int  callback_id,
void *  callback_user_data 
)
bdiGraphicsLabel* diguyViewLabel::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiGraphicsLabel
friend

Member Data Documentation

bdiGraphicsLabel* diguyViewLabel::m_label
private

A pointer to internal data.


The documentation for this class was generated from the following file: