DI-Guy SDK Documentation  13.2
diguyView Class Reference

A view is a graphics window wherein the scenario and its characters are animated. Note that views have a current camera and may have settings for visual effects, such as lighting and fog. Providing view information can sometimes be useful for DI-Guy, and is required when using the Load Manager. More...

#include <diguyView.h>

Public Member Functions

General Functions

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

  • C++
  • Script
const char * get_name ()
 Returns the name of the object. More...
 
const char * get_type_name ()
 Returns the type name of the object. More...
 
int show ()
 Shows the view. More...
 
int hide ()
 Hides the view. More...
 
int is_showing ()
 Returns: Returns 1 if the view is showing, 0 if not. More...
 
const char * get_window_title ()
 Returns the window title of the view. More...
 
int set_window_title (const char *window_title)
 This function sets the window title of the view. More...
 
diguyViewCameraget_camera ()
 This function returns a pointer to the view camera. More...
 
diguyViewFogget_fog ()
 This function returns a pointer to the view fog. More...
 
diguyViewLightget_light (int number=0)
 This function returns a pointer to the view lights. More...
 
Size and Position Functions
int set_width (int width)
 Sets the width of the view, in pixels. More...
 
int get_width ()
 Returns: width in pixels of the view. More...
 
int set_height (int height)
 Sets the height of the view, in pixels. More...
 
int get_height ()
 Returns: height in pixels of the view. More...
 
int set_x (int x)
 Sets the current x position of the view window relative to the left-hand edge of the screen. More...
 
int get_x ()
 Returns: current x coordinate of the view window; see set_x() More...
 
int set_y (int y)
 Sets the current y position of the view window relative to the upper edge of the screen. More...
 
int get_y ()
 Returns: current y coordinate of the view window; see set_y() More...
 
void set_quick_track_character (const char *name)
 sets the target of the scenario camera More...
 

Callback Functions

enum  { CALLBACK_ID_SHOW = 1, CALLBACK_ID_HIDE, CALLBACK_ID_WINDOW_TITLE_CHANGED, CALLBACK_ID_WINDOW_GEOMETRY_CHANGED }
 This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script(). More...
 
int add_callback (int callback_id, diguyViewCallback *callback, void *callback_params=0, void *callback_user_data=0)
 This function adds a user callback. More...
 
int remove_callback (int callback_id, diguyViewCallback *callback)
 This function removes a user callback. More...
 
int remove_callback_with_user_data (int callback_id, void *callback_user_data)
 This function removes a user callback. 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...
 

Private Functions

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

No external access to them is expected or necessary.

bdiScenarioViewm_scripted_object
 A pointer to internal data. More...
 
class bdiScenarioView
 
bdiScenarioViewget_scripted_object ()
 
 diguyView (bdiScenarioView *view)
 A private constructor. More...
 

Detailed Description

A view is a graphics window wherein the scenario and its characters are animated. Note that views have a current camera and may have settings for visual effects, such as lighting and fog. Providing view information can sometimes be useful for DI-Guy, and is required when using the Load Manager.

Member Enumeration Documentation

anonymous enum

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

Usable From:

  • C++
  • Script
Enumerator
CALLBACK_ID_SHOW 
CALLBACK_ID_HIDE 
CALLBACK_ID_WINDOW_TITLE_CHANGED 
CALLBACK_ID_WINDOW_GEOMETRY_CHANGED 

Constructor & Destructor Documentation

diguyView::diguyView ( bdiScenarioView view)
private

A private constructor.

Member Function Documentation

const char* diguyView::get_name ( )

Returns the name of the object.

This pointer will never be NULL.

Returns:

name of the view

const char* diguyView::get_type_name ( )

Returns the type name of the object.

This pointer will never be NULL.

Returns:

type name of the object

int diguyView::show ( )

Shows the view.

Returns:

0 on success, -1 on failure

Callable From:

  • C++
  • Script
  • Decision Bead
int diguyView::hide ( )

Hides the view.

Returns:

0 on success, -1 on failure

Callable From:

  • C++
  • Script
  • Decision Bead
int diguyView::is_showing ( )

Returns: Returns 1 if the view is showing, 0 if not.

Callable From:

  • C++
  • Script
  • Decision Bead
const char* diguyView::get_window_title ( )

Returns the window title of the view.

This pointer will never be NULL.

Returns:

window title of the view

int diguyView::set_window_title ( const char *  window_title)

This function sets the window title of the view.

Parameters
window_titlenew window title

Returns:

0 on success, -1 on failure

diguyViewCamera* diguyView::get_camera ( )

This function returns a pointer to the view camera.

Returns:

pointer of type diguyViewCamera; should never be NULL

diguyViewFog* diguyView::get_fog ( )

This function returns a pointer to the view fog.

Returns:

pointer of type diguyViewFog; should never be NULL

diguyViewLight* diguyView::get_light ( int  number = 0)

This function returns a pointer to the view lights.

Parameters
numbernumber of light to be found

Returns:

pointer of type diguyViewLight; can be NULL if light at specified index doesn't exist

int diguyView::set_width ( int  width)

Sets the width of the view, in pixels.

Parameters
widthnew width of view, in pixels

Returns:

0 on success, -1 on failure

int diguyView::get_width ( )

Returns: width in pixels of the view.

int diguyView::set_height ( int  height)

Sets the height of the view, in pixels.

Increasing height value moves the view window bottom edge lower.

Parameters
widthnew height of view, in pixels

Returns:

0 on success, -1 on failure

int diguyView::get_height ( )

Returns: height in pixels of the view.

int diguyView::set_x ( int  x)

Sets the current x position of the view window relative to the left-hand edge of the screen.

Parameters
xnew x coordinate of view

Returns:

0 on success, -1 on failure

int diguyView::get_x ( )

Returns: current x coordinate of the view window; see set_x()

int diguyView::set_y ( int  y)

Sets the current y position of the view window relative to the upper edge of the screen.

Increasing y moves the view window lower.

Parameters
ynew y coordinate of view

Returns:

0 on success, -1 on failure

int diguyView::get_y ( )

Returns: current y coordinate of the view window; see set_y()

void diguyView::set_quick_track_character ( const char *  name)

sets the target of the scenario camera

int diguyView::add_callback ( int  callback_id,
diguyViewCallback callback,
void *  callback_params = 0,
void *  callback_user_data = 0 
)

This function adds a user callback.

Parameters
callbackpointer to function with prototype diguyViewCallback (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

callback_id should be one of the following values:

CALLBACK_ID_SHOW

 This callback will be called whenever the view is
 to be shown, whether due to a call to the diguyView::show()
 function above or due to the result of a decision
 or script.

 There are no parameters for this callback.

CALLBACK_ID_HIDE

 This callback will be called whenever the view is
 to be hidden, whether due to a call to the diguyView::hide()
 function above or due to the result of a decision
 or script.

 There are no parameters for this callback.

CALLBACK_ID_WINDOW_TITLE_CHANGED

 This callback will be called whenever the view's
 window title has been changed.

 There are no parameters for this callback.

Callback Return Values:

Callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the callback returns DIGUY_CALLBACK_STOP, the default handler of the function will not be called; the callback is asserting that it has done everything necessary for the function call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default handler for the function will be called after the callback.

Returns:

0 on success, -1 on failure

Returns:

0 on success, -1 on failure

Callable From:

  • C++
int diguyView::remove_callback ( int  callback_id,
diguyViewCallback 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 diguyCharacterCallback (typedefed above)

Returns:

0 on success, -1 on failure

int diguyView::remove_callback_with_user_data ( int  callback_id,
void *  callback_user_data 
)

This function removes a user callback.

All callbacks matching the specified callback_id and callback_user_data pointer will be removed.

Parameters
callback_idinteger id of when this callback is to be called
callback_user_datapointer for user's own use

Returns:

0 on success, -1 on failure

int diguyView::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().

See diguyCharacter::add_callback_script() for an example of use.

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

Callable From:

  • C++
  • Script
int diguyView::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().

See diguyCharacter::remove_callback_script() for an example of use.

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

Callable From:

  • C++
  • Script
bdiScenarioView* diguyView::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiScenarioView
friend

Member Data Documentation

bdiScenarioView* diguyView::m_scripted_object
private

A pointer to internal data.


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