diguyViewLabel

Generated from diguyViewLabel.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguyViewLabel.h. Do not edit this file directly; the changes will be lost.
Includes: diguy_constants.h | diguy_typedefs.h | declspec_diguy.h

Contents:

Alphabetical Index

typedef diguyViewLabelJustification

typedef int diguyViewLabelJustification;

enumeration

enum {
	DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT   = 0,
	DIGUY_GRAPHICS_LABEL_JUSTIFIED_BOTTOM = 0,
	DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT  = 1,
	DIGUY_GRAPHICS_LABEL_JUSTIFIED_TOP    = 1,
	DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER = 2
};

class diguyViewLabel

class BDI_DECLSPEC_diguy diguyViewLabel
{
public:
    const char* get_name();
    void set_text(const char* text);
    const char* get_text();
    void set_text_color(float r, float g, float b, float a,
        float interp_time = 0.0f);
    void set_text_shadow_color(float r, float g, float b, float a,
        float interp_time = 0.0f);
    void set_text_shadow_enabled(int text_shadow_enabled);
    void set_text_justification(diguyViewLabelJustification just);
    diguyViewLabelJustification get_text_justification();
    void set_text_offset_x(int offset);
    int get_text_offset_x();
    void set_text_offset_y(int offset);
    int get_text_offset_y();
    void set_x(float screen_x_offset,
        float interp_time = 0.0f);
    float get_x();
    void set_y(float screen_y_offset,
        float interp_time = 0.0f);
    float get_y();
    void set_negative_wraps_x(int wrap);
    int get_negative_wraps_x();
    void set_negative_wraps_y(int wrap);
    int get_negative_wraps_y();
    void set_window_justification_x(diguyViewLabelJustification just);
    diguyViewLabelJustification get_window_justification_x();
    void set_window_justification_y(diguyViewLabelJustification just);
    diguyViewLabelJustification get_window_justification_y();
    void set_minimum_width(int min_x);
    int get_minimum_width();
    void set_minimum_height(int min_y);
    int get_minimum_height();
    int get_width();
    int get_height();
    void set_full_window(int full_window);
    int get_full_window();
    void reset();
    void set_visible(int visible);
    int get_visible();
    void set_background_color(float r, float g, float b, float a,
        float interp_time = 0.0f);
    void set_background_image(const char* filename);
    void set_background_enabled(int background_enabled);
    void set_border_color(float r, float g, float b, float a,
        float interp_time = 0.0f);
    void set_margin_size(int margin_size);
    void set_border_enabled(int border_enabled);
    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);
    void disable_bar_graph();
    int get_bar_graph_num_lines();
    int get_bar_graph_lines_are_vertical();
    void set_bar_graph_line_color(int line_number,
        float r, float g, float b, float a);
    void set_bar_graph_line_magnitude_ratio(int line_number, float ratio);
    void set_bar_graph_line_magnitude_pixels(int line_number, int pixels);
    void set_is_temporary(int temporary);
    int get_is_temporary();
    void set_draw_limit(float draw_limit);
    float get_draw_limit();
    void set_is_clickable(int is_clickable);
    int get_is_clickable();
    void set_is_noise(int is_noise);
    int get_is_noise();
    const char* get_type_name();
    enum {
        CALLBACK_ID_USER_SELECTED = 1,
        CALLBACK_ID_USER_UNSELECTED,
        CALLBACK_ID_IGUY_INTERACT
    };
    int add_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    int remove_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
#ifdef CPLUSPLUS_ONLY
    int add_callback(int callback_id,
        diguyViewLabelCallback* callback,
        void* callback_params = NULL,
        void* callback_user_data = NULL);
    int remove_callback(int callback_id,
        diguyViewLabelCallback* callback);
    int remove_callback_with_user_data(int callback_id,
        void* callback_user_data);
General Functions

function diguyViewLabel::get_name

Prototype:

const char* get_name();
Description:

Returns the name of the object. This pointer will never be NULL.

Returns:

name of the object

Callable From:

Text Functions

function diguyViewLabel::set_text

Prototype:

void set_text(const char* text);
Description:

Sets the text on the label.

Callable From:

function diguyViewLabel::get_text

Prototype:

const char* get_text();
Description:

Returns the text on the label.

Returns:

pointer to NULL-terminated string

Callable From:

function diguyViewLabel::set_text_color

Prototype:

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

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

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

Callable From:

function diguyViewLabel::set_text_shadow_color

Prototype:

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

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

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

Callable From:

function diguyViewLabel::set_text_shadow_enabled

Prototype:

void set_text_shadow_enabled(int text_shadow_enabled);
Description:

Enables or disables text shadow. Default is 0 (disabled).

Arguments:

text_shadow_enabledpass 1 to enable shadow, 0 to disable
Callable From:

function diguyViewLabel::set_text_justification

Prototype:

void set_text_justification(diguyViewLabelJustification just);
Description:

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.

Callable From:

function diguyViewLabel::get_text_justification

Prototype:

diguyViewLabelJustification get_text_justification();
Description:

Returns how the text on the label is being justified.

Returns:

One of the following values:

Callable From:

function diguyViewLabel::set_text_offset_x

Prototype:

void set_text_offset_x(int offset);
Description:

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

Callable From:

function diguyViewLabel::get_text_offset_x

Prototype:

int get_text_offset_x();
Returns:

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

Callable From:

function diguyViewLabel::set_text_offset_y

Prototype:

void set_text_offset_y(int offset);
Description:

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

Callable From:

function diguyViewLabel::get_text_offset_y

Prototype:

int get_text_offset_y();
Returns:

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

Callable From:

Position Functions

function diguyViewLabel::set_x

Prototype:

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

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.

Arguments:

screen_x_offsetx offset in pixels
interp_time amount of time in seconds used to shift to new position
Callable From:

function diguyViewLabel::get_x

Prototype:

float get_x();
Description:

Gets the x location of the label.

Note: this will return the current x value, not the desired one.

Callable From:

function diguyViewLabel::set_y

Prototype:

void set_y(float screen_y_offset,
    float interp_time = 0.0f);
Description:

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.

Arguments:

screen_y_offsety offset in pixels
interp_time amount of time in seconds used to shift to new position
Callable From:

function diguyViewLabel::get_y

Prototype:

float get_y();
Description:

Gets the y location of the label.

Note: this will return the current y value, not the desired one.

Callable From:

function diguyViewLabel::set_negative_wraps_x

Prototype:

void set_negative_wraps_x(int wrap);
Description:

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

Arguments:

wrap1 if x should wrap; 0 if not
Callable From:

function diguyViewLabel::get_negative_wraps_x

Prototype:

int get_negative_wraps_x();
Returns:

1 if x wraps its offset when negative

Callable From:

function diguyViewLabel::set_negative_wraps_y

Prototype:

void set_negative_wraps_y(int wrap);
Description:

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

Arguments:

wrap1 if y should wrap; 0 if not
Callable From:

function diguyViewLabel::get_negative_wraps_y

Prototype:

int get_negative_wraps_y();
Returns:

1 if y wraps its offset when negative

Callable From:

function diguyViewLabel::set_window_justification_x

Prototype:

void set_window_justification_x(diguyViewLabelJustification just);
Description:

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

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.

Callable From:

function diguyViewLabel::get_window_justification_x

Prototype:

diguyViewLabelJustification get_window_justification_x();
Returns:

label's x positioning parameter described above

Callable From:

function diguyViewLabel::set_window_justification_y

Prototype:

void set_window_justification_y(diguyViewLabelJustification just);
Description:

Sets how the label is positioned relative to the window. Possible values are:

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.

Callable From:

function diguyViewLabel::get_window_justification_y

Prototype:

diguyViewLabelJustification get_window_justification_y();
Returns:

label's y positioning parameter described above

Callable From:

function diguyViewLabel::set_minimum_width

Prototype:

void set_minimum_width(int min_x);
Description:

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.

Arguments:

min_xminimum width, in pixels
Callable From:

function diguyViewLabel::get_minimum_width

Prototype:

int get_minimum_width();
Returns:

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

Callable From:

function diguyViewLabel::set_minimum_height

Prototype:

void set_minimum_height(int min_y);
Description:

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

function diguyViewLabel::get_minimum_height

Prototype:

int get_minimum_height();
Description:

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

function diguyViewLabel::get_width

Prototype:

int get_width();
Returns:

the current label width

Callable From:

function diguyViewLabel::get_height

Prototype:

int get_height();
Returns:

the current label height

Callable From:

function diguyViewLabel::set_full_window

Prototype:

void set_full_window(int full_window);
Description:

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.

Arguments:

full_windowpass 1 for full-window, 0 for not full-window
Callable From:

function diguyViewLabel::get_full_window

Prototype:

int get_full_window();
Returns:

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

Callable From:

function diguyViewLabel::reset

Prototype:

void reset();
Description:

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

Callable From:

function diguyViewLabel::set_visible

Prototype:

void set_visible(int visible);
Description:

Sets the visibility of a label. Default is 1 (visible).

Arguments:

visiblepass 1 to make label visible, 0 for invisible
Callable From:

function diguyViewLabel::get_visible

Prototype:

int get_visible();
Returns:

visibility of label, as set by set_visible()

Callable From:

Background Functions

function diguyViewLabel::set_background_color

Prototype:

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

Sets the color of the label background.

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

Arguments:

r, g, b, a RGBA 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).

Callable From:

function diguyViewLabel::set_background_image

Prototype:

void set_background_image(const char* filename);
Description:

Sets the background image of the label. The file will be looked for in $DIGUYcustomgeometry/rgb first, then in $DIGUYgeometryrgb.

The default is no background image.

Callable From:

function diguyViewLabel::set_background_enabled

Prototype:

void set_background_enabled(int background_enabled);
Description:

Enables or disables label background. Default is 1 (enabled).

Arguments:

background_enabledpass 1 to enable shadow, 0 to disable
Callable From:

Border Functions

function diguyViewLabel::set_border_color

Prototype:

void set_border_color(float r, float g, float b, float a,
    float interp_time = 0.0f);
Description:

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

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

r, g, b, a RGBA values of new color, between 0.0 and 1.0
interp_timeamount of time in seconds used to shift to new color
Callable From:

function diguyViewLabel::set_margin_size

Prototype:

void set_margin_size(int margin_size);
Description:

Sets the margin, of the label. Default is 6 pixels.

Arguments:

margin_sizemargin size in pixels
Callable From:

function diguyViewLabel::set_border_enabled

Prototype:

void set_border_enabled(int border_enabled);
Description:

Sets if the border should be visible. Default is 1 (enabled).

Arguments:

border_enabledpass 1 to enable, 0 to disable
Callable From:

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);

function diguyViewLabel::enable_bar_graph

Prototype:

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);
Description:

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.

Arguments:

num_lines number of lines/bars that will be shown
lines_are_vertical pass 1 for lines to go bottom to top, 0 for lines to go left to right
line_thickness line 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
Callable From:

function diguyViewLabel::disable_bar_graph

Prototype:

void disable_bar_graph();
Description:

Disables bar graph functionality for this label. Bar graph lines will no longer be visible.

function diguyViewLabel::get_bar_graph_num_lines

Prototype:

int get_bar_graph_num_lines();
Returns:

number of bars/lines in bar graph

function diguyViewLabel::get_bar_graph_lines_are_vertical

Prototype:

int get_bar_graph_lines_are_vertical();
Returns:

1 if lines to go bottom to top, 0 if lines to go left to right

function diguyViewLabel::set_bar_graph_line_color

Prototype:

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

Sets the color of the specified line.

function diguyViewLabel::set_bar_graph_line_magnitude_ratio

Prototype:

void set_bar_graph_line_magnitude_ratio(int line_number, float ratio);
Description:

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.

Arguments:

line_numberline to change
ratio how 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.

function diguyViewLabel::set_bar_graph_line_magnitude_pixels

Prototype:

void set_bar_graph_line_magnitude_pixels(int line_number, int pixels);
Description:

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.

Arguments:

line_numberline to change
pixels line length in pixels
Misc Functions

function diguyViewLabel::set_is_temporary

Prototype:

void set_is_temporary(int temporary);
Description:

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.

function diguyViewLabel::get_is_temporary

Prototype:

int get_is_temporary();
Returns:

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

function diguyViewLabel::set_draw_limit

Prototype:

void set_draw_limit(float draw_limit);
Description:

Sets how far away the label will be drawn.

Arguments:

draw_limit-1 to always draw, otherwise will draw till draw_limit is reached
Callable From:

function diguyViewLabel::get_draw_limit

Prototype:

float get_draw_limit();
Description:

Gets how far away the label will be drawn. Defaults to -1 which always draws.

Callable From:

function diguyViewLabel::set_is_clickable

Prototype:

void set_is_clickable(int is_clickable);
Description:

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.

Arguments:

is_clickablepass 1 to enable, 0 to disable
Callable From:

function diguyViewLabel::get_is_clickable

Prototype:

int get_is_clickable();
Returns:

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

Callable From:

function diguyViewLabel::set_is_noise

Prototype:

void set_is_noise(int is_noise);
Description:

Sets if the label is "noise".

The textures of noise labels with be shifted every frame.

By default labels not noise.

Arguments:

is_noisepass 1 to enable, 0 to disable
Callable From:

function diguyViewLabel::get_is_noise

Prototype:

int get_is_noise();
Returns:

1 if label textures shift every frame, 0 if not; see set_is_noise()

Callable From:

function diguyViewLabel::get_type_name

Prototype:

const char* get_type_name();
Resturs:

NULL-terminated string "label"

enumeration

	enum {
		CALLBACK_ID_USER_SELECTED = 1,
		CALLBACK_ID_USER_UNSELECTED,
		CALLBACK_ID_IGUY_INTERACT
	};
Description:

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

Usable From:

function diguyViewLabel::add_callback_script

Prototype:

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

This function adds a user callback script. Callback scripts can be removed with remove_callback_script().

Arguments:

callback_id integer id of the callback
callback_script script 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

Callable From:

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");

function diguyViewLabel::remove_callback_script

Prototype:

int remove_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

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

Arguments:

callback_id integer id of the callback
callback_script script 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

Callable From:

Lua Example:

--
-- Remove all callback scripts with id
--  diguyViewLabel_CALLBACK_ID_USER_UNSELECTED
--
label:remove_callback_script(diguyViewLabel_CALLBACK_ID_USER_UNSELECTED,
nil,
"lua");

function diguyViewLabel::add_callback

Prototype:

int add_callback(int callback_id,
    diguyViewLabelCallback* callback,
    void* callback_params = NULL,
    void* callback_user_data = NULL);
Description:

This function adds a user callback. Callbacks can be removed with remove_callback() or remove_callback_with_user_data().

Arguments:

callback pointer to function with prototype diguyViewLabelCallback (typedefed above)
callback_id integer 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:

function diguyViewLabel::remove_callback

Prototype:

int remove_callback(int callback_id,
    diguyViewLabelCallback* callback);
Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback function will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback pointer to function with prototype diguyViewLabelCallback (typedefed above)
Returns:

0 on success, -1 on failure

Callable From:

Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback_user_data pointer will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback_user_datapointer for user's own use
Returns:

0 on success, -1 on failure

Callable From:

function diguyViewLabel::remove_callback_with_user_data

Prototype:

int remove_callback_with_user_data(int callback_id,
    void* callback_user_data);

Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.