GL Studio C++ Runtime API
gls_odometer.h
Go to the documentation of this file.
1/// \file gls_odometer.h
2/// \brief The disti::GlsOdometer class.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<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#ifndef DISTI_INCLUDED_GLS_ODOMETER_H
40#define DISTI_INCLUDED_GLS_ODOMETER_H
41
43#include "group.h"
44
45/// Provides support for creating DLLs.
46#if( defined( GLSGEN_EXPORT_GLSODOMETER ) || defined( GLSGEN_IMPORT_GLSODOMETER ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
47 && defined( _MSC_VER )
48# if defined( GLSGEN_EXPORT_GLSODOMETER ) || defined( GLS_EXPORT_GENERATED )
49# define GLSGEN_GLSODOMETER_EXPORT __declspec( dllexport )
50# else
51# define GLSGEN_GLSODOMETER_EXPORT __declspec( dllimport )
52# endif
53#else
54# define GLSGEN_GLSODOMETER_EXPORT
55#endif
56///////////////////////////////////////////////////////////////////////////////
57
58/// Automatically link the runtime library plugin (on Windows).
59#define LIB_BASE_NAME "gls_odometer"
60#include "gls_auto_lib.h"
61#undef LIB_BASE_NAME
62
63namespace disti
64{
65enum
66{
67 GLS_GLSODOMETER_VALUE = GLS_LAST_INITIALIZER + 1,
68 GLS_GLSODOMETER_MIN_VALUE,
69 GLS_GLSODOMETER_MAX_VALUE,
70 GLS_GLSODOMETER_BASE_SYSTEM,
71 GLS_GLSODOMETER_BEHAVIOR_TYPE,
72 GLS_GLSODOMETER_GEOMETRY_TYPE,
73 GLS_GLSODOMETER_TEXTURE_SCALE,
74 GLS_GLSODOMETER_DEGREES_PER_DIGIT
75};
76
77/** Runtime implementation of a GlsOdometer */
78class GlsOdometer : public Group
79{
80 friend class GlsOdometerEditor;
81
82private:
85
86public:
87 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
88 typedef Group _BaseClass; ///< Deprecated typedef for the base class.
89 typedef Group BaseClass; ///< Typedef for the base class.
90
91 /// Constructor
92 /// \param generateInstance Whether or not to generate an instance name for this object.
93 GLSGEN_GLSODOMETER_EXPORT GlsOdometer( bool generateInstance = false );
94
95 /// Copy constructor
96 /// \param that The object to copy from.
97 /// \param generateNames Whether or not to generate an instance name for this object.
98 GLSGEN_GLSODOMETER_EXPORT GlsOdometer( const GlsOdometer& that, const bool generateNames );
99
100 /** Destructs a GlsOdometer object */
102
103 /// \return A pointer to a new GlsOdometer object.
105
109
110#ifndef GLES
113#endif
114
119
120 //////////////////////////////////////////////////
121 // GlsOdometer specific declarations
122 //////////////////////////////////////////////////
123
124 /// \details The GlsOdometerBehaviorType enumeration. Controls the scroll behavior of the odometer texture.
125 typedef enum
126 {
127 BEHAVIOR_ANALOG = 0,
128 BEHAVIOR_DIGITAL
130
131 /// \details The GlsOdometerGeometryType enumeration. Controls the whether the odometer should scroll a texture, or rotate geometry.
132 typedef enum
133 {
134 GEOMETRY_2D = 0,
135 GEOMETRY_3D
137
138 /// Set the maximum displayable value.
139 /// \param value The new maximum value to set.
140 GLSGEN_GLSODOMETER_EXPORT void MaxValue( const float& value );
141
142 /// \return The maximum displayable value.
144
145 /// Set the minimum displayable value.
146 /// \param value The new minimum value to set.
147 GLSGEN_GLSODOMETER_EXPORT void MinValue( const float& value );
148
149 /// \return The minimum displayable value.
151
152 /// Set the current value to be displayed by the odometer.
153 /// This value is limited by MaxValue() and MinValue().
154 /// \param value The new value to set.
155 GLSGEN_GLSODOMETER_EXPORT void Value( const float& value );
156
157 /// \return The current value of the odometer.
159
160 /// Set the base number system for this odometer.
161 /// The default is base 10.
162 /// \param value The new base system to set.
163 virtual GLSGEN_GLSODOMETER_EXPORT void BaseSystem( const int& value );
164
165 /// \return The base number system for this odometer.
167
168 /// Set the BehaviorType controls the "Rollover" behavior of the odometer.
169 /// BEHAVIOR_ANALOG - Wheels will roll between numbers based on the RolloverThreshold
170 /// BEHAVIOR_DIGITAL - Wheels will display only whole numbers.
171 /// \param value The new rollover behavior to set.
173
174 /// \return The BehaviorType controls the "Rollover" behavior of the odometer.
176
177 /// Set the GeometryType controls the method used to "move" the wheels.
178 /// GEOMETRY_2D - Texture is translated on the object based on the TextureScale.
179 /// GEOMETRY_3D - The wheels are rotated about the Y-AXIS of the DCS based on the value of DegreesPerDigit.
180 /// \param value The new "movement" behavior to set.
182
183 /// \return The GeometryType method used to "move" the wheels.
185
186 /// Set the TextureScale which is the amount that the texture should move for each digit.
187 /// The formula to determine this is: (Pixels per digit)/(Texture height).
188 /// This value is only used when GeometryType == GEOMETRY_2D.
189 /// \param value The new texture movement amount to set.
190 GLSGEN_GLSODOMETER_EXPORT void TextureScale( const float& value );
191
192 /// \return The TextureScale, the amount that the texture should move for each digit.
194
195 /// Set the DegreesPerDigit which is the number of degrees the wheels should be rotated for each digit.
196 /// This value is only used when GeometryType == GEOMETRY_3D.
197 /// \param value The new geometry rotation amount to set.
198 GLSGEN_GLSODOMETER_EXPORT void DegreesPerDigit( const float& value );
199
200 /// \return The DegreesPerDigit, the number of degrees the wheels should be rotated for each digit.
202
203 /// \return The order of magnitude (number of digits) the odometer can have.
205
206 /// \return The amount required to make the first digit roll over by one.
208
209protected:
210 int _orderOfMagnitude; ///< The number of digits (zeroes) the odometer can have.
211 float _textureScale; ///< The amount in texture coordinates to move for each digit. GeometryType == GEOMETRY_2D
212 float _degreesPerDigit; ///< The amount to rotate the geometry for each digit. GeometryType == GEOMETRY_3D
213 float _rolloverThreshold; ///< The amount required to make the first digit roll over by one.
214
215 float _minValue; ///< The minimum value that can be represented on the wheels.
216 float _maxValue; ///< The maximum value that can be represented on the wheels.
217 int _baseSystem; ///< The base system represented, e.g. base 10.
218 float _currentValue; ///< The current value displayed on the wheels.
219 GlsOdometerBehaviorType _behavior; ///< The "rollover" behavior in use.
220 GlsOdometerGeometryType _geometry; ///< The "movement" behavior in use.
221
222 /// \details The TexturePoints class. Used for storing the initial texture position of the GlsOdometer.
224 {
225 public:
226 Vector v1; ///< The bottom left corner.
227 Vector v2; ///< The bottom right corner.
228 Vector v3; ///< The top right corner.
229 Vector v4; ///< The top left corner.
230 };
231
232 DynamicArray<TexturePoints> _startLoc; ///< A list of start texture locations, one for each wheel.
233 bool _textureLocSaved; ///< True denotes that the texture locations have been saved off.
234
235 /// Sets the current order of magnitude (number of zeroes)
236 /// \note Not normally called by users.
237 /// \param value The new magnitude value to set.
238 void OrderOfMagnitude( const int& value );
239
240 /// Sets the rollover threshold (amount needed to move the first wheel by one)
241 /// \note Not normally called by users.
242 /// \param value The new rollover value to set.
243 void RolloverThreshold( const float& value );
244
245 /// Helper function that recalculates _orderOfMagnitude.
246 /// \note Not normally called by users.
248
249 /// Helper function that recalculates _rolloverThreshold.
250 /// \note Not normally called by users.
252
253 /// Sets the current texture coordinates as the zero position for the wheels.
254 /// \note Not normally called by users.
256
257#ifdef GLES
258 /** Set a single attribute from the GLO file.
259 * \param data The attribute to set and its associated data.
260 */
261 GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
262#endif
263};
264
265} // namespace disti
266
267#endif
Definition: cull.h:49
Definition: events.h:111
Definition: display.h:95
Definition: dynamic_array.h:79
Definition: gls_glo_file.h:1241
Definition: gls_odometer.h:224
Vector v4
The top left corner.
Definition: gls_odometer.h:229
Vector v2
The bottom right corner.
Definition: gls_odometer.h:227
Vector v3
The top right corner.
Definition: gls_odometer.h:228
Vector v1
The bottom left corner.
Definition: gls_odometer.h:226
Definition: gls_odometer.h:79
float _rolloverThreshold
The amount required to make the first digit roll over by one.
Definition: gls_odometer.h:213
virtual void BaseSystem(const int &value)
void CalculateRolloverThreshold()
void Value(const float &value)
float _degreesPerDigit
The amount to rotate the geometry for each digit. GeometryType == GEOMETRY_3D.
Definition: gls_odometer.h:212
GlsOdometerGeometryType
Definition: gls_odometer.h:133
virtual float DegreesPerDigit()
void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
virtual float Value()
GlsOdometerBehaviorType _behavior
The "rollover" behavior in use.
Definition: gls_odometer.h:219
virtual GlsOdometerGeometryType GeometryType()
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
void RolloverThreshold(const float &value)
void GeometryType(const GlsOdometerGeometryType value)
void OrderOfMagnitude(const int &value)
virtual float MaxValue()
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
GlsOdometerBehaviorType
Definition: gls_odometer.h:126
void MaxValue(const float &value)
void BehaviorType(const GlsOdometerBehaviorType value)
int _orderOfMagnitude
The number of digits (zeroes) the odometer can have.
Definition: gls_odometer.h:210
DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
virtual GlsOdometerBehaviorType BehaviorType()
float _maxValue
The maximum value that can be represented on the wheels.
Definition: gls_odometer.h:216
float _textureScale
The amount in texture coordinates to move for each digit. GeometryType == GEOMETRY_2D.
Definition: gls_odometer.h:211
void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
virtual float MinValue()
static DisplayObject * CreateInstance()
DynamicArray< TexturePoints > _startLoc
A list of start texture locations, one for each wheel.
Definition: gls_odometer.h:232
void Draw() DISTI_METHOD_OVERRIDE
void MinValue(const float &value)
void DegreesPerDigit(const float &value)
virtual float TextureScale()
virtual float RolloverThreshold() const
virtual int OrderOfMagnitude() const
float _minValue
The minimum value that can be represented on the wheels.
Definition: gls_odometer.h:215
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
bool _textureLocSaved
True denotes that the texture locations have been saved off.
Definition: gls_odometer.h:233
float _currentValue
The current value displayed on the wheels.
Definition: gls_odometer.h:218
int _baseSystem
The base system represented, e.g. base 10.
Definition: gls_odometer.h:217
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
GlsOdometerGeometryType _geometry
The "movement" behavior in use.
Definition: gls_odometer.h:220
void TextureScale(const float &value)
virtual int BaseSystem()
void CalculateOrderOfMagnitude()
Definition: group.h:52
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
Definition: vertex.h:84
The gls_auto_lib.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:245
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:50
#define GLSGEN_GLSODOMETER_EXPORT
Provides support for creating DLLs.
Definition: gls_odometer.h:54
The disti::Group class. Implements groups of objects.
Definition: bmpimage.h:46