GlsRSOLoader API  1.3.1
RSOReference Class Reference

#include <gls_rso_loader.h>

Inheritance diagram for RSOReference:
RSOInterface5::RSOPainter

Public Member Functions

 RSOReference (disti::RSOInterface1 *, LiveComponentLibRef *, unsigned int)
 
 ~RSOReference ()
 
disti::RSOInterface1GetRSOInterface1 ()
 
unsigned int GetRSOVersion ()
 
void SetResource (const char *resourceName, const char *resourceVal)
 
void SetResources (const char *buf)
 
const char * GetResource (const char *resourceName)
 
void Calculate (double time)
 
void PreDraw (const disti::RSOInterface1::OpenGLMatrices &current, disti::RSOInterface1::Culler &culler)
 
void Draw ()
 
bool HandleInput (disti::RSOInterface1::Event *ev)
 
bool SetEmittedEventHandler (disti::RSOInterface1::EmittedEventHandler *handler)
 
void AbsolutePlacement (bool value)
 
void GetBackgroundColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
 
bool GetBoundingBox (disti::RSOInterface1::Vector *min, disti::RSOInterface1::Vector *max, disti::RSOInterface1::MatrixD *transform=0)
 
void SetProjection (int controlWidth, int controlHeight, float depthFactor=4.0f, float fov=90.0f, bool perspective=false)
 
bool HandleMouseDown (int x, int y, int button)
 
bool HandleMouseUp (int x, int y, int button)
 
bool HandleMouseWheelPlus (int x, int y, int buttonMask)
 
bool HandleMouseWheelMinus (int x, int y, int buttonMask)
 
bool HandleMouseMove (int x, int y, int buttonMask)
 
bool HandleKeyDown (int key, int x, int y)
 
bool HandleKeyUp (int key, int x, int y)
 
bool CreateResourceHandle (const char *resourceName, disti::RSOInterface2::ResourceHandle &resourceHandle)
 
bool ReleaseResourceHandle (disti::RSOInterface2::ResourceHandle resourceHandle)
 
bool IsResourceHandleValid (disti::RSOInterface2::ResourceHandle resourceHandle)
 
bool SetResource (disti::RSOInterface2::ResourceHandle resourceHandle, const char *resourceVal)
 
bool GetResource (disti::RSOInterface2::ResourceHandle resourceHandle, const char *&resourceValue)
 
bool SetIntResource (const char *resourceName, long resourceVal)
 
bool SetIntResource (disti::RSOInterface2::ResourceHandle resourceHandle, long resourceVal)
 
bool GetIntResource (const char *resourceName, long &resourceVal)
 
bool GetIntResource (disti::RSOInterface2::ResourceHandle resourceHandle, long &resourceVal)
 
bool SetFloatResource (const char *resourceName, double resourceVal)
 
bool SetFloatResource (disti::RSOInterface2::ResourceHandle resourceHandle, double resourceVal)
 
bool GetFloatResource (const char *resourceName, double &resourceVal)
 
bool GetFloatResource (disti::RSOInterface2::ResourceHandle resourceHandle, double &resourceVal)
 
bool RegisterResourceObserver (disti::RSOInterface2::ResourceHandle resourceHandle, disti::RSOInterface4::ResourceObserver *obs, disti::RSOInterface4::CallbackID &id)
 
bool UnregisterResourceObserver (disti::RSOInterface2::ResourceHandle resourceHandle, disti::RSOInterface4::CallbackID id)
 
void Invalidate ()
 
void SetRedraw (bool redraw)
 
bool GetRedraw ()
 

Detailed Description

RSOReference class. Main interface for GlsRSOLoader

Constructor & Destructor Documentation

RSOReference ( disti::RSOInterface1 ,
LiveComponentLibRef *  ,
unsigned  int 
)

Constructor

Destructor

Member Function Documentation

void AbsolutePlacement ( bool  value)

Sets the "AbsolutePlacement" property on the RSO

Parameters
valuetrue to enable AbsolutePlacement property, false to disable it
void Calculate ( double  time)

Calculate method. Should be called every frame for normal operation.

Parameters
timeElapsed time, in seconds
bool CreateResourceHandle ( const char *  resourceName,
disti::RSOInterface2::ResourceHandle &  resourceHandle 
)

Constructs a resource handle for rapid access to the named resource (RSO v2)

Parameters
resourceNameresource name
[out]resourceHandlereference to resource handle output location
Returns
true if successful
void Draw ( )
inline

Draw the object via OpenGL. Call this after PreDraw()

void GetBackgroundColor ( unsigned char &  r,
unsigned char &  g,
unsigned char &  b,
unsigned char &  a 
)

Gets the background color of the RSO's display frame

Parameters
rRed color component (0-255)
gGreen color component (0-255)
bBlue color component (0-255)
aAlpha color component (0-255)
bool GetBoundingBox ( disti::RSOInterface1::Vector min,
disti::RSOInterface1::Vector max,
disti::RSOInterface1::MatrixD transform = 0 
)

Get the extents of the RSO when drawn with the given transformation matrix, as a coordinate system-aligned box

Parameters
minIf the method returns true, contains the point corresponding with the 1st corner of the box. If the method returns false, value is undefined.
maxIf the method returns true, contains the point corresponding with the 2nd corner of the box. If the method returns false, value is undefined.
transformTransformation matrix from A to B where A is the component�s coordinate system and B is the coordinate system to compute the bounding box in. (If NULL then identity matrix is assumed)
Returns
true if the extents were calculated, false if the extents could not be calculated.
bool GetFloatResource ( const char *  resourceName,
double &  resourceVal 
)

Gets a float resource by name (RSO v2)

Parameters
resourceNameresource name
[out]resourceValreference to resource value output location
Returns
true if successful
bool GetFloatResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
double &  resourceVal 
)

Gets a float resource by handle (RSO v2)

Parameters
resourceHandleresource name
[out]resourceValreference to resource value output location
Returns
true if successful
bool GetIntResource ( const char *  resourceName,
long &  resourceVal 
)

Gets an integer resource by name (RSO v2)

Parameters
resourceNameresource name
[out]resourceValreference to resource value output location
Returns
true if successful
bool GetIntResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
long &  resourceVal 
)

Gets an integer resource by handle (RSO v2)

Parameters
resourceHandleresource handle
[out]resourceValreference to resource value output location
Returns
true if successful
bool GetRedraw ( )
inline

Get the redraw flag, whether or not this RSO should be redrawn

Returns
the current value of the redraw flag
const char* GetResource ( const char *  resourceName)
inline

Gets a resource value by name

Parameters
resourceNameResource name
Returns
Value of given resource
bool GetResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
const char *&  resourceValue 
)

Gets a string resource by handle (RSO v2)

Parameters
resourceHandleresource handle
[out]resourceValuereference to resource value output location
Returns
true if successful
disti::RSOInterface1* GetRSOInterface1 ( )
inline

Accessor for RSOInterface contained within this RSO Reference

Returns
Pointer to RSOInterface instance
unsigned int GetRSOVersion ( )
inline

Gets the version number for the RSO

Returns
The RSO version number
bool HandleInput ( disti::RSOInterface1::Event ev)
inline

Allow the object to handle an event.

Parameters
evEvent to be handled by the RSO
Returns
true if the event was handled by the RSO
bool HandleKeyDown ( int  key,
int  x,
int  y 
)

Keyboard key down event handler

Parameters
keyKey code pressed. Either ascii value or RSOInterface1::KeyboardEvent::KeySymCodeEnum (for any non-ascii key).
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
Returns
true if event handled successfully, false otherwise
bool HandleKeyUp ( int  key,
int  x,
int  y 
)

Keyboard key up event handler

Parameters
keyKey code released. Either ascii value or RSOInterface1::KeyboardEvent::KeySymCodeEnum (for any non-ascii key).
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
Returns
true if event handled successfully, false otherwise
bool HandleMouseDown ( int  x,
int  y,
int  button 
)

Mouse button down event handler

Parameters
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
buttonMouse button pressed (see RSOInterface1::MouseEvent::MouseButtonType)
Returns
true if event handled successfully, false otherwise
bool HandleMouseMove ( int  x,
int  y,
int  buttonMask 
)

Mouse button up event handler

Parameters
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
buttonMaskbitfield of which mouse buttons are currently held down (see RSOInterface1::MouseEvent::MouseButtonType)
Returns
true if event handled successfully, false otherwise
bool HandleMouseUp ( int  x,
int  y,
int  button 
)

Mouse button up event handler

Parameters
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
buttonMouse button released (see RSOInterface1::MouseEvent::MouseButtonType)
bool HandleMouseWheelMinus ( int  x,
int  y,
int  buttonMask 
)

Mouse wheel minus event handler

Parameters
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
buttonMaskbitfield of which mouse buttons are currently held down (see RSOInterface1::MouseEvent::MouseButtonType)
Returns
true if event handled successfully, false otherwise
bool HandleMouseWheelPlus ( int  x,
int  y,
int  buttonMask 
)

Mouse wheel plus event handler

Parameters
xX screen coordinate of mouse cursor's current location
yY screen coordinate of mouse cursor's current location
buttonMaskbitfield of which mouse buttons are currently held down (see RSOInterface1::MouseEvent::MouseButtonType)
Returns
true if event handled successfully, false otherwise
void Invalidate ( )
inlinevirtual

Notify the painter that the scene needs to be redrawn

Implements RSOInterface5::RSOPainter.

bool IsResourceHandleValid ( disti::RSOInterface2::ResourceHandle  resourceHandle)

Checks the given resource handle for validity (RSO v2)

Parameters
resourceHandleresource handle
Returns
true if the given resource handle is connected to a valid resource
void PreDraw ( const disti::RSOInterface1::OpenGLMatrices current,
disti::RSOInterface1::Culler culler 
)
inline

Calculate transformations and perform culling. Call this before Draw()

Parameters
currentTransformation matrices (Projection and Modelview) to apply
cullerCuller operation to apply on this RSO
bool RegisterResourceObserver ( disti::RSOInterface2::ResourceHandle  resourceHandle,
disti::RSOInterface4::ResourceObserver obs,
disti::RSOInterface4::CallbackID id 
)

Register a resource observer to be notified when a resource changes *

Parameters
resourceHandlethe resource handle
obsthe observer to be notified
[out]idthe id used to unregister the observer
Returns
true if successful
bool ReleaseResourceHandle ( disti::RSOInterface2::ResourceHandle  resourceHandle)

Frees the given resource handle (RSO v2)

Parameters
resourceHandleresource handle
Returns
true if successful
bool SetEmittedEventHandler ( disti::RSOInterface1::EmittedEventHandler handler)
inline

Allow for handling events from inside the object. The emitted event handler will be passed events that are from inside the component

Parameters
handlerpointer to the EmittedEventHandler object to use or NULL to remove the current event handler.
Returns
true if this component may emit events, false if this component will never emit events.
bool SetFloatResource ( const char *  resourceName,
double  resourceVal 
)

Sets a float resource by name (RSO v2)

Parameters
resourceNameresource name
resourceValresource value
Returns
true if successful
bool SetFloatResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
double  resourceVal 
)

Sets a float resource by handle (RSO v2)

Parameters
resourceHandleresource handle
resourceValresource value
Returns
true if successful
bool SetIntResource ( const char *  resourceName,
long  resourceVal 
)

Sets an integer resource by name (RSO v2)

Parameters
resourceNameresource name
resourceValresource value
Returns
true if successful
bool SetIntResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
long  resourceVal 
)

Sets an integer resource by handle (RSO v2)

Parameters
resourceHandleresource handle
resourceValresource value
Returns
true if successful
void SetProjection ( int  controlWidth,
int  controlHeight,
float  depthFactor = 4.0f,
float  fov = 90.0f,
bool  perspective = false 
)

Sets the projection of the RSO using glOrtho or gluSetPerspective. Sets the application's projection globally.

Parameters
controlWidthWidth of the RSO (in pixels)
controlHeightHeight of the RSO (in pixels)
depthFactorUsed for autocalculating clipping planes.
fovfield of view (in degrees)
perspectiveWhether the projection is perspective or orthographic
void SetRedraw ( bool  redraw)
inline

Set the redraw flag, notifying the application that this RSO should be redrawn

Parameters
redrawthe new value of the redraw flag
void SetResource ( const char *  resourceName,
const char *  resourceVal 
)
inline

Sets a resource contained within the RSO

Parameters
resourceNameResource name
resourceValResource value
bool SetResource ( disti::RSOInterface2::ResourceHandle  resourceHandle,
const char *  resourceVal 
)

Sets a string resource by handle (RSO v2)

Parameters
resourceHandleresource handle
resourceValresource value
Returns
true if successful
void SetResources ( const char *  buf)

CRT Insensitive version of SetResources() Parse a buffer of resource value pairs.

Parameters
bufString containing resource data
bool UnregisterResourceObserver ( disti::RSOInterface2::ResourceHandle  resourceHandle,
disti::RSOInterface4::CallbackID  id 
)

Unregister a resource observer

Parameters
resourceHandlethe resource handle
idthe id used to register the resource observer
Returns
true if successful

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