GL Studio C++ Runtime API
RuntimeDisplayFrame Class Reference

#include <runtime_display_frame.h>

Inheritance diagram for RuntimeDisplayFrame:
DisplayFrame GlsPainter AttributeChangedNotifier WeakReferenceableMixin WeakReferenceable EmbeddedDisplayFrame glsDisplayFrame

Public Member Functions

 RuntimeDisplayFrame (const char *name, int width, int height)
 
virtual ~RuntimeDisplayFrame ()
 
virtual void Clear (void)
 
virtual GlsEyePointCurrentEyePoint ()
 
virtual void CurrentEyePoint (GlsEyePoint *eye)
 
virtual void Scale (float scale)
 
virtual float Scale (void)
 
virtual DisplayObjecthandle (DisplayEvent *ev)
 
virtual void BackgroundColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
virtual void GetBackgroundColor (unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
 
virtual void BackgroundColor (const GlsColor &color)
 
const char * Name (void)
 
void Name (char *name)
 
virtual GlsColor BackgroundColor (void)
 
virtual int FrameInterval (void)
 
virtual void FrameInterval (int interval)
 
virtual StatisticsStats ()
 
virtual void RecordCalculateStart (void)
 
virtual void RecordCalculateEnd (void)
 
virtual void ClearDragAndFocus ()
 
virtual bool UpdateAnimate ()
 
virtual bool FrameAnimate ()
 
virtual void WaitForNextFrame ()
 
virtual void Paint ()
 
virtual void WidthOffset (float offset)
 
virtual float WidthOffset (void)
 
virtual void HeightOffset (float offset)
 
virtual float HeightOffset (void)
 
virtual void DepthFactor (float factor)
 
virtual float DepthFactor ()
 
virtual void FOV (double fov)
 
virtual double FOV ()
 
virtual void CurrentView (const int view)
 
virtual int CurrentView (void) const
 
void Invalidate () override
 
bool IsInvalidated () const override
 
- Public Member Functions inherited from DisplayFrame
 DisplayFrame (int width, int height, bool allocateObjects=true)
 
void ClearBitfield (GLbitfield bitField)
 
GLbitfield ClearBitfield ()
 
virtual void DragObject (DisplayObject *obj)
 
virtual DisplayObjectDragObject (void)
 
virtual void ClearDrag ()
 
virtual void FocusObject (DisplayObject *obj)
 
virtual DisplayObjectFocusObject (void)
 
virtual void ClearFocus ()
 
virtual void MultitouchEnabled (bool enabled)
 
virtual bool MultitouchEnabled (void)
 
virtual InputHandlerGetInputHandler ()
 
virtual DisplayObjectHandleDisplayEvent (DisplayEvent *ev)
 
virtual void WriteResources (const char *filename, GlsResourceFilter *filter=NULL)
 
virtual void ReadResources (const char *filename)
 
virtual DistiAttributeBaseResource (const char *name)
 
virtual void GetResources (std::ostream &outstr, GlsResourceFilter *filter=NULL)
 
virtual void SetResources (std::istream &instr)
 
void SetResource (const std::string &resourceName, const std::string &resourceVal)
 
std::string GetResource (const std::string &resourceName)
 
virtual char * GetResource_CRTClean (const char *name)
 
virtual void GetResourceFree_CRTClean (char *memoryToFree)
 
virtual char * GetResources_CRTClean (GlsResourceFilter *filter)
 
virtual void GetResourcesFree_CRTClean (char *memoryToFree)
 
virtual void SetResource_CRTClean (const char *name, const char *value)
 
virtual void SetResources_CRTClean (const char *buf)
 
virtual void NotifyAttributeChanged (const AttributeName &name) override
 
virtual InterfaceListTypeGetCppInterfaceDescription (InterfaceListType *addToThisList=NULL)
 
virtual void GetCppInterfaceDescriptionFree (InterfaceListType *array)
 
void SetTexturePaletteSize (int cnt)
 
void Draw (void)
 
void InsertObject (DisplayObject *obj, int loc)
 
void PushObject (DisplayObject *obj)
 
int Width (void)
 
int Height (void)
 
void SetWidth (int w)
 
void SetHeight (int h)
 
virtual void SetRedraw (void)
 
bool CullingEnabled (void)
 
void CullingEnabled (const bool enabled)
 
DistiAttribDictFrameAttribDict (void)
 
const DistiAttribDictFrameAttribDict (void) const
 
DynamicMaterialArrayMaterialPalette (void)
 
ComponentLightMgrLightMgr (void)
 
void LightMgr (ComponentLightMgr *val)
 
- Public Member Functions inherited from AttributeChangedNotifier
virtual ~AttributeChangedNotifier ()
 
- Public Member Functions inherited from WeakReferenceableMixin
void AddWeakReference (WeakReference *weakRef) override
 
void NotifyWeakReferenceDestroyed (WeakReference *ref) override
 

Public Attributes

GlsColor _backgroundColor
 
- Public Attributes inherited from DisplayFrame
TexturePalettetexturePalette
 
SoundSystem_sound_player
 
Groupobjects
 

Protected Attributes

Timer _frameTimer
 
float _smoothedFrameDelay
 
float _width_offset
 
float _height_offset
 
float _depthFactor
 
double _fov
 
double _nearZ
 
bool _autoCalcNearZ
 
double _farZ
 
bool _autoCalcFarZ
 
int _current_view
 
std::string _name
 
float _scale
 
unsigned int frameInterval
 
GlsEyePoint_currentEyePoint
 
bool _redraw
 
- Protected Attributes inherited from DisplayFrame
bool _cullingEnabled
 
int _width
 
int _height
 
float _lastPickedDepth
 
DynamicMaterialArray _materialPalette
 
ComponentLightMgr_lightMgr
 
GLbitfield _clearBitfield
 
std::string _componentHeaderFileName
 
unsigned int _currentCursor
 
bool _multitouchEnabled
 
unsigned int _cursorsDown
 
- Protected Attributes inherited from WeakReferenceableMixin
DynamicArray< WeakReference * > * _weakRefs
 

Additional Inherited Members

- Static Public Member Functions inherited from DisplayFrame
static void SetOpenGLDefaultState (bool saveVal)
 
static void RestoreOpenGLState (void)
 
- Protected Member Functions inherited from DisplayFrame
virtual void CurrentCursor (unsigned int cursor_id)
 
void CleanupDragMap ()
 
DisplayObjectGetDragObjectForCursor (unsigned int cursorID)
 
DisplayObjectFindDragObject ()
 
- Protected Member Functions inherited from WeakReferenceableMixin
 WeakReferenceableMixin (void)
 
virtual ~WeakReferenceableMixin ()
 

Detailed Description

Provides basic support for runtime display frames

Constructor & Destructor Documentation

RuntimeDisplayFrame ( const char *  name,
int  width,
int  height 
)

Ctor for RuntimeDisplayFrame

Parameters
nameThe title of the display frame. Shown in the window title bar.
widthThe width of the display frame window, in pixels.
heightThe height of the display frame window, in pixels.
virtual ~RuntimeDisplayFrame ( )
virtual

Member Function Documentation

virtual void BackgroundColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
virtual

Sets the background color of the window to the given value

Parameters
rNew red color (0-255 range)
gNew green color (0-255 range)
bNew blue color (0-255 range)
aNew alpha color (0-255 range)
virtual void BackgroundColor ( const GlsColor color)
virtual

Sets the background color of the window to the given value

Parameters
colorThe new color
virtual GlsColor BackgroundColor ( void  )
virtual

Gets the background color of the window to the given value

Returns
The background color
virtual void Clear ( void  )
virtual

Clears the window associated with the display frame. The current _clearBitfield is used

virtual void ClearDragAndFocus ( )
virtual

Call this before deleting objects which may be being kept by the drag or focus objects

Reimplemented from DisplayFrame.

virtual GlsEyePoint* CurrentEyePoint ( )
virtual
Returns
The current eyepoint for the display frame
virtual void CurrentEyePoint ( GlsEyePoint eye)
virtual

Sets the current eyepoint for the display frame.

Parameters
eyeThe eyepoint to use for the display frame.
virtual void CurrentView ( const int  view)
inlinevirtual

Sets the current view mode for the window

Parameters
viewThe new view mode for the window. Acceptable view types are: [VIEW_EYEPOINT - The application will be viewed through an eyepoint] [VIEW_XY - The application will be viewed through a 2D orthographic view of the XY plane] [VIEW_PERSPECTIVE - The application will be viewed through a perspective projection]
virtual int CurrentView ( void  ) const
inlinevirtual

Gets the current view mode for the window.

Returns
The current viewmode for the window (VIEW_EYEPOINT, VIEW_XY, VIEW_PERSPECTIVE)
virtual void DepthFactor ( float  factor)
virtual

Sets the Depth Factor for the window

Parameters
factorThe depth factor. Used for autocalculating clipping planes
virtual float DepthFactor ( )
virtual

Gets the Depth Factor for the window

Returns
The current depth factor
virtual void FOV ( double  fov)
virtual

Sets the FOV (Field of View) for the window. If fov is set to 0.0, a reasonable FOV will be calculated based on width and height.

Parameters
fovNew field of view in degrees
virtual double FOV ( )
virtual

Gets the FOV (Field of View) for the window.

Returns
The current field of view in degrees
virtual bool FrameAnimate ( )
virtual

Redraw the window at the Hz rate set for the DisplayFrame, or at least try to. We might be slower if the hardware can't keep up.

Returns
on desktop runtimes, returns true if any window is still open. On ES runtimes always returns true.

Reimplemented in glsDisplayFrame.

virtual int FrameInterval ( void  )
virtual

Returns the Frame Interval in microseconds

Returns
The Frame Interval in microseconds
virtual void FrameInterval ( int  interval)
virtual

Sets the target Frame Interval in microseconds

Parameters
intervalThe frame interval in microseconds
virtual void GetBackgroundColor ( unsigned char &  r,
unsigned char &  g,
unsigned char &  b,
unsigned char &  a 
)
virtual

Gets the background color of the window to the given value

Parameters
rGets red color (0-255 range)
gGets green color (0-255 range)
bGets blue color (0-255 range)
aGets alpha color (0-255 range)
virtual DisplayObject* handle ( DisplayEvent ev)
virtual

Handles keyboard and mouse events and dispatches them to the display objects.

Parameters
evA display event
Returns
Pointer to the object that handled the event or NULL if no object handled it.
virtual void HeightOffset ( float  offset)
virtual

Pans the display vertically

Parameters
offsetThe new Y position of the center of the window
virtual float HeightOffset ( void  )
virtual

Gets the vertical position of the display at the center of the window

Returns
The Y position at the center of the window
void Invalidate ( )
overridevirtual
See also
GlsPainter

Implements GlsPainter.

bool IsInvalidated ( ) const
overridevirtual
See also
GlsPainter

Implements GlsPainter.

const char* Name ( void  )

Gets the title(name) of this display frame

Returns
The name of this display frame
void Name ( char *  name)

Sets the name(title) for this display frame

Parameters
nameThe new title for the display frame
virtual void Paint ( void  )
inlinevirtual

Redraws the window, using the platform specific mechanism. Place holder for base class implementations. Simple implementations may draw directly, while implementations that use a window manager may tell the window manager to redraw.

Reimplemented in glsDisplayFrame, and EmbeddedDisplayFrame.

virtual void RecordCalculateEnd ( void  )
virtual

Part of display frame statistics, for recording time used in Calculate()

virtual void RecordCalculateStart ( void  )
virtual

Part of display frame statistics, for recording time used in Calculate()

virtual void Scale ( float  scale)
virtual

Set the scale for the display frame.

Parameters
scaleThe new scale factor. Must be non-zero. A value of zero will be ignored.
virtual float Scale ( void  )
virtual
Returns
The current scale for the display frame

Reimplemented from DisplayFrame.

virtual Statistics* Stats ( )
virtual

Creates and returns a pointer to a statistics object

Returns
A pointer to the statistics object
virtual bool UpdateAnimate ( )
virtual

Redraws the scene if the scene has changed since the last frame, and also calls WaitForNextFrame to ensure we are not drawing faster than the set frame interval allows.

Returns
true if we the scene was redrawn. Generally used to determine if the buffers need to be swapped
virtual void WaitForNextFrame ( )
virtual

Sleeps based on the Hz rate set for the DisplayFrame.

virtual void WidthOffset ( float  offset)
virtual

Pans the display horizontally

Parameters
offsetThe new X position at the center of the window
virtual float WidthOffset ( void  )
virtual

Gets the horizontal position of the display at the center of the window

Returns
The X position at the center of the window

Member Data Documentation

bool _autoCalcFarZ
protected

When true a _farZ is automatically calculated.

bool _autoCalcNearZ
protected

When true a _nearZ is automatically calculated.

GlsColor _backgroundColor

The background clear color

int _current_view
protected

Current view of the canvas (e.g., ortho, perspective, eyepoint)

GlsEyePoint* _currentEyePoint
protected

The current eyepoint for viewing the scene

float _depthFactor
protected

Used for auto calculations

double _farZ
protected

Far clipping plane. Only meaningfull if _autoCalcVarZ is false

double _fov
protected

Field Of View. If 0.0 (the default), fov will be auto calculated.

Timer _frameTimer
protected

Timer used for scheduling

float _height_offset
protected

Current "height" offset of window. Used for panning of display vertically in ortho mode.

std::string _name
protected

The title of this display frame's window, if applicable

double _nearZ
protected

Near clipping plane. Only meaningful if _autoCalcNearZ is false

bool _redraw
protected

Flag indicating if the window should be redrawn

float _scale
protected

Scale of the window

float _smoothedFrameDelay
protected

for backwards compatibility Frame interval, smoothed based on actual draw performance

float _width_offset
protected

For better control over clipping and field of view, use a GlsEyePoint, but some limited functionality is available here Current "width" offset of window. Used for panning of display horizontally in ortho mode.

unsigned int frameInterval
protected

The frame interval in microSeconds (inverse of frame rate)


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