GL Studio C++ Runtime API
runtime_display_frame.h
Go to the documentation of this file.
1 /*! \file
2  \brief The disti::RuntimeDisplayFrame class, parent class of all DisplayFrames used in runtime code.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2017 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 #ifndef _RUNTIME_DISPLAY_FRAME_H
41 #define _RUNTIME_DISPLAY_FRAME_H
42 
43 #include "display_frame.h"
44 #include "gls_include.h"
45 
46 namespace disti
47 {
48 class Statistics;
49 class GlsEyePoint;
50 
51 /** Provides basic support for runtime display frames */
53 {
54 private:
55  Statistics* _stats; /**< Keeps track of draw/predraw/calculate timing statistics */
56 protected:
57  std::string _name; /**< The title of this display frame's window, if applicable */
58  float _scale; /**< Scale of the window */
59  unsigned int frameInterval; /**< The frame interval in microSeconds (inverse of frame rate) */
60  GlsEyePoint* _currentEyePoint; /**< The current eyepoint for viewing the scene */
61 
62 public:
63  /** Ctor for RuntimeDisplayFrame
64  * \param name The title of the display frame. Shown in the window title bar.
65  * \param width The width of the display frame window, in pixels.
66  * \param height The height of the display frame window, in pixels.
67  */
68  GLS_EXPORT RuntimeDisplayFrame( const char* name, int width, int height );
69 
70  /** Dtor for RuntimeDisplayFrame */
71  virtual GLS_EXPORT ~RuntimeDisplayFrame();
72 
73  /** Clears the window associated with the display frame.
74  * The current _clearBitfield is used */
75  virtual GLS_EXPORT void Clear( void );
76 
77  /** \return The current eyepoint for the display frame */
78  virtual GLS_EXPORT GlsEyePoint* CurrentEyePoint();
79 
80  /** Sets the current eyepoint for the display frame.
81  * \param eye The eyepoint to use for the display frame.
82  */
83  virtual GLS_EXPORT void CurrentEyePoint( GlsEyePoint* eye );
84 
85  /** Set the scale for the display frame.
86  * \param scale The new scale factor. Must be non-zero. A value of zero will be ignored.
87  */
88  virtual GLS_EXPORT void Scale( float scale );
89 
90  /** \return The current scale for the display frame */
91  virtual GLS_EXPORT float Scale( void );
92 
93  /** Handles keyboard and mouse events and dispatches them to the display objects.
94  * \param ev A display event
95  * \return Pointer to the object that handled the event or NULL if no object handled it.
96  */
97  virtual GLS_EXPORT DisplayObject* handle( DisplayEvent* ev );
98 
99  /** Sets the background color of the window to the given value
100  * \param r New red color (0-255 range)
101  * \param g New green color (0-255 range)
102  * \param b New blue color (0-255 range)
103  * \param a New alpha color (0-255 range)
104  */
105  virtual GLS_EXPORT void BackgroundColor( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
106 
107  /** Gets the background color of the window to the given value
108  * \param r Gets red color (0-255 range)
109  * \param g Gets green color (0-255 range)
110  * \param b Gets blue color (0-255 range)
111  * \param a Gets alpha color (0-255 range)
112  */
113  virtual GLS_EXPORT void GetBackgroundColor( unsigned char& r, unsigned char& g, unsigned char& b, unsigned char& a );
114 
115  /** Sets the background color of the window to the given value
116  * \param color The new color
117  */
118  virtual GLS_EXPORT void BackgroundColor( const GlsColor& color );
119 
120  /** Gets the title(name) of this display frame
121  * \return The name of this display frame
122  */
123  GLS_EXPORT const char* Name( void );
124 
125  /** Sets the name(title) for this display frame
126  * \param name The new title for the display frame
127  */
128  GLS_EXPORT void Name( char* name );
129 
130  /** Gets the background color of the window to the given value
131  * \return The background color
132  */
133  virtual GLS_EXPORT GlsColor BackgroundColor( void );
134 
135  /** Returns the Frame Interval in microseconds
136  * \return The Frame Interval in microseconds
137  */
138  virtual GLS_EXPORT int FrameInterval( void );
139 
140  /** Sets the target Frame Interval in microseconds
141  * \param interval The frame interval in microseconds
142  */
143  virtual GLS_EXPORT void FrameInterval( int interval );
144 
145  /** Creates and returns a pointer to a statistics object
146  * \return A pointer to the statistics object
147  */
148  virtual GLS_EXPORT Statistics* Stats();
149 
150  /** Part of display frame statistics, for recording time used in Calculate() */
151  virtual GLS_EXPORT void RecordCalculateStart( void );
152 
153  /** Part of display frame statistics, for recording time used in Calculate() */
154  virtual GLS_EXPORT void RecordCalculateEnd( void );
155 
156  /** Call this before deleting objects which may be being kept
157  * by the drag or focus objects */
158  virtual GLS_EXPORT void ClearDragAndFocus();
159 
160  /** The background clear color */
161  GlsColor _backgroundColor; // DDH: This is public yet has an accessor method....should it be protected?
162 };
163 
164 } // namespace disti
165 
166 #endif
virtual void Clear(void)
Definition: display_frame.h:83
virtual Statistics * Stats()
virtual float Scale(void)
const char * Name(void)
std::string _name
Definition: runtime_display_frame.h:57
Definition: display.h:97
virtual DisplayObject * handle(DisplayEvent *ev)
RuntimeDisplayFrame(const char *name, int width, int height)
virtual GlsColor BackgroundColor(void)
Definition: statistics.h:56
Definition: runtime_display_frame.h:52
virtual int FrameInterval(void)
A file for all GL Studio files to include.
virtual void GetBackgroundColor(unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
virtual void RecordCalculateStart(void)
Definition: gls_eyepoint.h:115
GlsColor _backgroundColor
Definition: runtime_display_frame.h:161
Definition: events.h:110
Definition: gls_color.h:53
unsigned int frameInterval
Definition: runtime_display_frame.h:59
The disti::DisplayFrame class.
float _scale
Definition: runtime_display_frame.h:58
virtual GlsEyePoint * CurrentEyePoint()
virtual void RecordCalculateEnd(void)
Definition: bmpimage.h:46
virtual void ClearDragAndFocus()
GlsEyePoint * _currentEyePoint
Definition: runtime_display_frame.h:60