| GL Studio C++ Runtime API

gls_nine_patch.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsNinePatch class.
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 _GLS_NINE_PATCH_H
41#define _GLS_NINE_PATCH_H
42#include "glpolygon.h"
43#include "gls_cpp_lang_support.h"
44
45#ifdef GLES
46# include "gls_index_array.h"
47# include "gls_vertex_array.h"
48#else
49# include "gls_display_list.h"
50#endif
51
52/// Provides support for creating DLLs.
53#if( defined( GLSGEN_EXPORT_GLSNINEPATCH ) || defined( GLSGEN_IMPORT_GLSNINEPATCH ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
54 && defined( _MSC_VER )
55# if defined( GLSGEN_EXPORT_GLSNINEPATCH ) || defined( GLS_EXPORT_GENERATED )
56# define GLSGEN_GLSNINEPATCH_EXPORT __declspec( dllexport )
57# else
58# define GLSGEN_GLSNINEPATCH_EXPORT __declspec( dllimport )
59# endif
60#else
61# define GLSGEN_GLSNINEPATCH_EXPORT
62#endif
63///////////////////////////////////////////////////////////////////////////////
64
65/// Automatically link the runtime library plugin (on Windows).
66#define LIB_BASE_NAME "gls_nine_patch"
67#include "gls_auto_lib.h"
68#undef LIB_BASE_NAME
69
70 namespace disti
71{
72// SetValue enumerations
73 enum
74{
75 GLS_NINE_PATCH_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
76 GLS_NINE_PATCH_CENTER_VISIBLE,
77 GLS_NINE_PATCH_EDGES,
78 GLS_NINE_PATCH_TEXTURE_EDGES,
79 GLS_NINE_PATCH_RADII,
80 GLS_NINE_PATCH_TEXTURE_POINTS,
81 GLS_NINE_PATCH_COLOR,
82 GLS_NINE_PATCH_REFERENCE_TEXTURE_WIDTH_HEIGHT
83};
84
85#define GLS_NINE_PATCH_ARRAY_SIZE 16 ///< The number of vertices present in a nine patch.
86
87/** Runtime implementation of a GlsNinePatch */
88 class GlsNinePatch : public GLPolygon
89{
90 friend class GlsNinePatchEditor;
91
92 private:
93 GlsNinePatch& operator=( const GlsNinePatch& ) DISTI_SPECIAL_MEM_FUN_DELETE;
94 GlsNinePatch( const GlsNinePatch& ) DISTI_SPECIAL_MEM_FUN_DELETE;
95
96 public:
97 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
98 typedef GLPolygon _BaseClass; ///< Deprecated typedef for the base class.
99 typedef GLPolygon BaseClass; ///< Typedef for the base class.
100
101 /// \details The Rect3D class. Describes a 3D bounding box.
102 class Rect3D
103 {
104 public:
105 Vector blc; ///< The bottom left corner.
106 Vector brc; ///< The bottom right corner.
107 Vector trc; ///< The top right corner.
108
109 Rect3D(){};
110 };
111
112 /// Constructor
113 /// \param generateInstance Whether or not to generate an instance name for this object.
114 GLSGEN_GLSNINEPATCH_EXPORT GlsNinePatch( bool generateInstance = false );
115
116 /// Copy constructor
117 /// \param that The object to copy from.
118 /// \param generateNames Whether or not to generate an instance name for this object.
119 GLSGEN_GLSNINEPATCH_EXPORT GlsNinePatch( const GlsNinePatch& that, const bool generateNames );
120
121 virtual GLSGEN_GLSNINEPATCH_EXPORT ~GlsNinePatch();
122
123 /// \return A pointer to a new GlsNinePatch object.
124 static GLSGEN_GLSNINEPATCH_EXPORT DisplayObject* CreateInstance();
125
126 // DisplayObject overrides
127
128 virtual GLSGEN_GLSNINEPATCH_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar ) DISTI_METHOD_OVERRIDE;
129 virtual GLSGEN_GLSNINEPATCH_EXPORT void Rotate( const Vector& orig, float angle, const Vector& axis ) DISTI_METHOD_OVERRIDE;
130 virtual GLSGEN_GLSNINEPATCH_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
131 virtual GLSGEN_GLSNINEPATCH_EXPORT Vertex* Vertices() DISTI_METHOD_OVERRIDE;
132 virtual GLSGEN_GLSNINEPATCH_EXPORT void GetExtents( float& minx, float& miny, float& minz, float& maxx, float& maxy, float& maxz ) DISTI_METHOD_OVERRIDE;
133 virtual GLSGEN_GLSNINEPATCH_EXPORT void GetTransformedExtents( Vector& min, Vector& max, const GlsMatrixType& matrix, bool resetMinMax ) DISTI_METHOD_OVERRIDE;
134 virtual GLSGEN_GLSNINEPATCH_EXPORT void UpdateBoundingVolume() DISTI_METHOD_OVERRIDE;
135 virtual GLSGEN_GLSNINEPATCH_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
136 virtual GLSGEN_GLSNINEPATCH_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
137 virtual GLSGEN_GLSNINEPATCH_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
138 virtual GLSGEN_GLSNINEPATCH_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
139 virtual GLSGEN_GLSNINEPATCH_EXPORT void CopyGeometry( DisplayObject* srcArg ) DISTI_METHOD_OVERRIDE;
140
141#ifndef GLES
142 virtual GLSGEN_GLSNINEPATCH_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
143 virtual GLSGEN_GLSNINEPATCH_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
144#endif
145
146 virtual GLSGEN_GLSNINEPATCH_EXPORT void Calculate( double time ) DISTI_METHOD_OVERRIDE;
147
148#ifdef GLES
149 virtual GLSGEN_GLSNINEPATCH_EXPORT void PreDraw( const OpenGLMatrices& current, Culler& culler ) DISTI_METHOD_OVERRIDE;
150#endif
151
152 virtual GLSGEN_GLSNINEPATCH_EXPORT void Draw() DISTI_METHOD_OVERRIDE;
153
154 virtual GLSGEN_GLSNINEPATCH_EXPORT void SetFillColor( const GlsColor& color ) DISTI_METHOD_OVERRIDE;
155 virtual GLSGEN_GLSNINEPATCH_EXPORT GlsColor GetFillColor() DISTI_METHOD_OVERRIDE;
156
157 /** Gets the polygon drawing mode for this object
158 * \return The polygon drawing mode for this object
159 * \sa PolygonMode_e
160 */
161 virtual GLSGEN_GLSNINEPATCH_EXPORT int PolygonMode() DISTI_METHOD_OVERRIDE { return POLY_MODE_FILLED; }
162
163 /** Sets the polygon drawing mode for this object
164 * \param mode The new polygon drawing mode for this object
165 * \sa PolygonMode_e
166 */
167 virtual GLSGEN_GLSNINEPATCH_EXPORT void PolygonMode( int mode ) DISTI_METHOD_OVERRIDE {} // do nothing
168
169 /** The enumeration defining which edge textures and vertices refer to*/
170 enum Edge
171 {
172 FIRST = 0,
173 LEFT = 0,
174 RIGHT = 1,
175 TOP = 2,
176 BOTTOM = 3,
177 // The number of items
178 COUNT = 4
179 };
180
181 /// Set's the texture edge at enum specified by index to the value specified as pixel units.
182 /// \param index Refers to the texture edge enumeration that will be modified.
183 /// \param value The pixel unit(s) assigned to the specificed texture edge enumeration.
184 GLSGEN_GLSNINEPATCH_EXPORT void TextureEdge( Edge index, float value );
185
186 /// Shortcut to set the nine patch's left texture edge.
187 /// \param value The new texture edge value in pixels.
188 GLSGEN_GLSNINEPATCH_EXPORT void LeftTextureEdge( float value ) { TextureEdge( LEFT, value ); }
189
190 /// Shortcut to set the nine patch's right texture edge.
191 /// \param value The new texture edge value in pixels.
192 GLSGEN_GLSNINEPATCH_EXPORT void RightTextureEdge( float value ) { TextureEdge( RIGHT, value ); }
193
194 /// Shortcut to set the nine patch's top texture edge.
195 /// \param value The new texture edge value in pixels.
196 GLSGEN_GLSNINEPATCH_EXPORT void TopTextureEdge( float value ) { TextureEdge( TOP, value ); }
197
198 /// Shortcut to set the nine patch's bottom texture edge.
199 /// \param value The new texture edge value in pixels.
200 GLSGEN_GLSNINEPATCH_EXPORT void BottomTextureEdge( float value ) { TextureEdge( BOTTOM, value ); }
201
202 /// Set's the vertex edge at enum specified by index to the value specified as logical units.
203 /// \param index Refers to the vertex edge enumeration that will be modified.
204 /// \param value Is the logical unit(s) assigned to the specificed vertex edge enumeration.
205 GLSGEN_GLSNINEPATCH_EXPORT void VertexEdge( Edge index, float value );
206
207 /// Shortcut to set the nine patch's left vertex edge.
208 /// \param value The new vertex edge value in logical units.
209 GLSGEN_GLSNINEPATCH_EXPORT void LeftVertexEdge( float value ) { VertexEdge( LEFT, value ); }
210
211 /// Shortcut to set the nine patch's right vertex edge.
212 /// \param value The new vertex edge value in logical units.
213 GLSGEN_GLSNINEPATCH_EXPORT void RightVertexEdge( float value ) { VertexEdge( RIGHT, value ); }
214
215 /// Shortcut to set the nine patch's top vertex edge.
216 /// \param value The new vertex edge value in logical units.
217 GLSGEN_GLSNINEPATCH_EXPORT void TopVertexEdge( float value ) { VertexEdge( TOP, value ); }
218
219 /// Shortcut to set the nine patch's bottom vertex edge.
220 /// \param value The new vertex edge value in logical units.
221 GLSGEN_GLSNINEPATCH_EXPORT void BottomVertexEdge( float value ) { VertexEdge( BOTTOM, value ); }
222
223 /// Return the value in pixel units of the TextureEdge given at enumeration specified by index.
224 /// \param index Refers to the edge enumeration that the value will be gotten from.
225 /// \return A float value in pixel units that corresponds with the respective VertexEdge index/enum.
226 virtual GLSGEN_GLSNINEPATCH_EXPORT float TextureEdge( Edge index );
227
228 /// \return The left texture edge value in pixels.
229 GLSGEN_GLSNINEPATCH_EXPORT float LeftTextureEdge() { return TextureEdge( LEFT ); }
230
231 /// \return The right texture edge value in pixels.
232 GLSGEN_GLSNINEPATCH_EXPORT float RightTextureEdge() { return TextureEdge( RIGHT ); }
233
234 /// \return The top texture edge value in pixels.
235 GLSGEN_GLSNINEPATCH_EXPORT float TopTextureEdge() { return TextureEdge( TOP ); }
236
237 /// \return The bottom texture edge value in pixels.
238 GLSGEN_GLSNINEPATCH_EXPORT float BottomTextureEdge() { return TextureEdge( BOTTOM ); }
239
240 /// Return the value in logical units at the edge enumeration specified by index.
241 /// \param index Refers to the edge enumeration.
242 /// \return A float value in logical units that corresponds with the respective TextureEdge index/enum.
243 virtual GLSGEN_GLSNINEPATCH_EXPORT float VertexEdge( Edge index );
244
245 /// \return The left vertex edge value in logical units.
246 GLSGEN_GLSNINEPATCH_EXPORT float LeftVertexEdge() { return VertexEdge( LEFT ); }
247
248 /// \return The right vertex edge value in logical units.
249 GLSGEN_GLSNINEPATCH_EXPORT float RightVertexEdge() { return VertexEdge( RIGHT ); }
250
251 /// \return The top vertex edge value in logical units.
252 GLSGEN_GLSNINEPATCH_EXPORT float TopVertexEdge() { return VertexEdge( TOP ); }
253
254 /// \return The bottom vertex edge value in logical units.
255 GLSGEN_GLSNINEPATCH_EXPORT float BottomVertexEdge() { return VertexEdge( BOTTOM ); }
256
257 /// Getter function to determine whether or not the center will be drawn.
258 /// \return True being returned lets the user know that the Center of the NinePatch is visible.
259 GLSGEN_GLSNINEPATCH_EXPORT bool CenterVisible() { return _centerVisible; }
260
261 /// Set whether or not the center quad will be drawn..
262 /// \param value The new visibility flag for the center quad.
263 GLSGEN_GLSNINEPATCH_EXPORT void CenterVisible( bool value );
264
265 /// Sets the radii of the width vector in logical units.
266 /// \param v Will set the radii's width row's logical values of the glsNinePatch object.
267 GLSGEN_GLSNINEPATCH_EXPORT void WidthVector( const Vector& v );
268
269 /// Sets the radii of the height vector in logical units.
270 /// \param v Will set the radii's height row's logical values of the glsNinePatch object.
271 GLSGEN_GLSNINEPATCH_EXPORT void HeightVector( const Vector& v );
272
273 /// Gets the radii of the width vector in logical units.
274 /// \return The width of the NinePatch as a Vector.
275 GLSGEN_GLSNINEPATCH_EXPORT const Vector WidthVector() const { return _radii[ 0 ]; }
276
277 /// Gets the radii of the height vector in logical units.
278 /// \return The height of the NinePatch as a Vector.
279 GLSGEN_GLSNINEPATCH_EXPORT const Vector HeightVector() const { return _radii[ 1 ]; }
280
281 /// Setter function for the bottom left corner of the texture in the GlsNinePatch.
282 /// \param x A pixel unit value that is applied to the GlsNinePatch's first field in the 'Bottom Left Corner' vector.
283 /// \param y A pixel unit value that is applied to the GlsNinePatch's second field in the 'Bottom Left Corner' vector.
284 GLSGEN_GLSNINEPATCH_EXPORT void TextureBLC( const float x, const float y );
285
286 /// Setter function for the bottom left corner of the texture in the GlsNinePatch.
287 /// \param value A vector containing x and y pixel unit values to apply to the texture bottom left corner.
288 GLSGEN_GLSNINEPATCH_EXPORT void TextureBLC( const Vector& value ) { TextureBLC( value.x, value.y ); }
289
290 /// Setter function for the top right corner of the texture in the GlsNinePatch.
291 /// \param x A pixel unit value that is applied to the GlsNinePatch's first field in the 'Top Right Corner' vector.
292 /// \param y A pixel unit value that is applied to the GlsNinePatch's second field in the 'Top Right Corner' vector.
293 GLSGEN_GLSNINEPATCH_EXPORT void TextureTRC( const float x, const float y );
294
295 /// Setter function for the top right corner of the texture in the GlsNinePatch.
296 /// \param value A vector containing x and y pixel unit values to apply to the texture top right corner.
297 GLSGEN_GLSNINEPATCH_EXPORT void TextureTRC( const Vector& value ) { TextureTRC( value.x, value.y ); }
298
299 /// Getter function for the bottom left corner of the texture in the GlsNinePatch.
300 /// \return The vector in pixel units for the value of the 'Bottom Left Corner'.
301 GLSGEN_GLSNINEPATCH_EXPORT Vector TextureBLC() const { return _textureBLC; }
302
303 /// Getter function for the top right corner of the texture in the GLSNinePatch.
304 /// \return The vector in pixel units for the value of the 'Top Right Corner'.
305 GLSGEN_GLSNINEPATCH_EXPORT Vector TextureTRC() const { return _textureTRC; }
306
307 /// Setter function for the height of the GlsNinePatch in logical units.
308 /// \param value Sets the height of the GlsNinePatch in the direction of _radii[1].
309 GLSGEN_GLSNINEPATCH_EXPORT void Height( const float& value );
310
311 /// Setter function for the width of the GlsNinePatch in logical units.
312 /// \param value Sets the width of the GlsNinePatch in the direction of _radii[0].
313 GLSGEN_GLSNINEPATCH_EXPORT void Width( const float& value );
314
315 /// Getter function for the height of the GlsNinePatch in logical units.
316 /// \return The height of the NinePatch.
317 GLSGEN_GLSNINEPATCH_EXPORT float Height() const { return _height; }
318
319 /// Getter function for the width of the GlsNinePatch in logical units.
320 /// \return The width of the NinePatch.
321 GLSGEN_GLSNINEPATCH_EXPORT float Width() const { return _width; }
322
323 /// \return A pointer to the patch vertices.
324 virtual GLSGEN_GLSNINEPATCH_EXPORT const Vertex* GetPatchVerts();
325
326 /// \return A pointer to the texture points.
327 virtual GLSGEN_GLSNINEPATCH_EXPORT const Vector* GetPatchTex();
328
329 /// Gets the "child" rectangle. The child rectangle refers to the
330 /// inner rectangle of the nine patch, which is where normal content would be drawn.
331 /// \return The bounding box of the child rectangle.
332 GLSGEN_GLSNINEPATCH_EXPORT Rect3D GetChildRect();
333
334 /** Sets the reference texture width, which allows the nine patch to respond to changes of texture size.
335 * \param value The reference width of the texture in pixel units
336 * \note Setting this value is optional, but if it is not set and the physical texture size changes, the
337 * nine patch will not display will need to be reconfigured by hand. The reference width should
338 * generally be the width of the original texture. It will be automatically updated when image changes
339 * are detected.
340 * \sa ReferenceTextureWidth()
341 */
342 GLSGEN_GLSNINEPATCH_EXPORT void ReferenceTextureWidth( const unsigned int& value );
343
344 /** Sets the reference texture height, which allows the nine patch to respond to changes of texture size.
345 * \param value The reference height of the texture in pixel units
346 * \note Setting this value is optional, but if it is not set and the physical texture size changes, the
347 * nine patch will not display will need to be reconfigured by hand. The reference height should
348 * generally be the height of the original texture. It will be automatically updated when image changes
349 * are detected.
350 * \sa ReferenceTextureHeight()
351 */
352 GLSGEN_GLSNINEPATCH_EXPORT void ReferenceTextureHeight( const unsigned int& value );
353
354 /// Gets the reference texture width, which allows the nine patch to respond to changes of texture size.
355 /// \sa ReferenceTextureWidth()
356 /// \return The width of the nine patch texture in pixels.
357 GLSGEN_GLSNINEPATCH_EXPORT unsigned int ReferenceTextureWidth();
358
359 /// Gets the reference texture height, which allows the nine patch to respond to changes of texture size.
360 /// \sa ReferenceTextureHeight()
361 /// \return The height of the nine patch texture in pixels.
362 GLSGEN_GLSNINEPATCH_EXPORT unsigned int ReferenceTextureHeight();
363
364 /** Forces the nine patch to recalculate it's verts and it's texture verts.
365 * \sa ForceRecalculate()
366 */
367 GLSGEN_GLSNINEPATCH_EXPORT void ForceRecalculate();
368
369 protected:
370 /** Calculate the vertices for the nine patches */
371 void CalculatePatchVerts();
372
373 /** Calculate the texture coordinates for the nine patches */
374 void CalculateTextureVerts();
375
376 /// Calculates new values when a texture has been upsized or downsized.
377 /// \param tw The new texture width in pixels.
378 /// \param th The new texture height in pixels.
379 void CalculateTextureResize( const int tw, const int th );
380
381 /** Calculates _width, _height and _normal based on _radii */
382 void CalculateRadiiUnit();
383
384 /** callback called when the 9patch needs to be recalculated */
385 void SetNeedsRecalculate();
386
387 /** callback called when the 9patch texture coordinates need to be recalculated */
388 void SetNeedsTextureRecalculate();
389
390 /** Draws a grid displaying the 9 polygons on top of the image */
391 void DrawGuides();
392
393#ifdef GLES
394 /** Set a single attribute from the GLO file.
395 * \param data The attribute to set and its associated data.
396 */
397 virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
398#endif
399
400#ifndef GLES
401 /// Helper routine to draw the 9 patches.
402 /// \note Not normally called by users.
403 /// \param texture If true, draw with texturing enabled.
404 void DrawPatches( bool texture );
405
406 /** Performs OpenGL drawing commands */
407 void DrawGeometry();
408#endif
409
410 /** Array of vertices that defines the NinePatch, arranged as follows:
411 * 12--13---14---15
412 * | | | |
413 * 8----9---10---11
414 * | | | |
415 * 4----5----6----7
416 * | | | |
417 * 0----1----2----3
418 */
419 Vertex _patchVerts[ GLS_NINE_PATCH_ARRAY_SIZE ];
420
421 /** Array of texture coordinates, arranged the same way as _patchVerts */
422 Vector _patchTex[ GLS_NINE_PATCH_ARRAY_SIZE ];
423
424 /** Radius vectors that define the size of the NinePatch
425 * _radii[0] defines the width
426 * _radii[1] defines the height
427 */
428 Vector _radii[ 2 ];
429
430 Vector _normal; /**< Surface normal of the NinePatch. Computed from the _radii */
431 Vector _textureBLC; /**< Texture coordinate of bottom left corner of NinePatch */
432 Vector _textureTRC; /**< Texture coordinate of top right corner of NinePatch */
433 float _width; /**< Width of the NinePatch in the direction of _radii[0] */
434 float _height; /**< Height of the NinePatch in the direction of _radii[1] */
435
436 /** Values representing the distance from the edge of the texture that makes up the
437 * NinePatch borders. Units are in pixels and are the distance IN from the edge of the texture.
438 */
439 float _textureEdge[ 4 ];
440
441 /** Values representing the size of edges of the NinePatch. Units are in logical units measure
442 * going IN from the edge of the NinePatch
443 */
444 float _vertexEdge[ 4 ];
445
446 bool _centerVisible; /**< Whether or not the center patch will be drawn */
447 bool _needsRecalculate; /**< True when the vertices need to be recalculated */
448 bool _needsTextureRecalculate; /**< True when the texture coordinates need to be recalculated */
449 bool _guidesVisible; /**< If true, then "guides" will be drawn". Normally only set in the editor */
450 GlsColor _objectColor; /**< Fill color is normally stored in vertices, but we're not using these in GlsNinePatch */
451 unsigned int _texWidth; /**< Texture Width */
452 unsigned int _texHeight; /**< Texture Height */
453
454#ifdef GLES
455 GlsVertexArray _vertArray; ///< Defines the vertices that make up the triangles of this object.
456 GlsIndexArray _indexArray; ///< Array containing indices to each triangle vertex.
457#endif
458
459 unsigned int _referenceTexWidth; /**< Texture Width when the object was configured. Used to correctly adjust for new texture resolutions. */
460 unsigned int _referenceTexHeight; /**< Texture Height when the object was configured. Used to correctly adjust for new texture resolutions. */
461};
462
463} // namespace disti
464
465#endif
disti::Culler
Definition: cull.h:50
disti::DisplayObject
Definition: display.h:96
disti::DynamicArray
Definition: dynamic_array.h:79
disti::GLPolygon
The Polygon class. Implements Polygons.
Definition: glpolygon.h:56
disti::GlsColor
Definition: gls_color.h:54
disti::GlsGloFileAttribute
Definition: gls_glo_file.h:1243
disti::GlsIndexArray
Definition: gls_index_array.h:54
disti::GlsMatrixAffine< double >
disti::GlsNinePatch::Rect3D
Definition: gls_nine_patch.h:103
disti::GlsNinePatch::Rect3D::trc
Vector trc
The top right corner.
Definition: gls_nine_patch.h:107
disti::GlsNinePatch::Rect3D::blc
Vector blc
The bottom left corner.
Definition: gls_nine_patch.h:105
disti::GlsNinePatch::Rect3D::brc
Vector brc
The bottom right corner.
Definition: gls_nine_patch.h:106
disti::GlsNinePatch
Definition: gls_nine_patch.h:89
disti::GlsNinePatch::PolygonMode
virtual void PolygonMode(int mode) DISTI_METHOD_OVERRIDE
Definition: gls_nine_patch.h:167
disti::GlsNinePatch::TextureTRC
void TextureTRC(const float x, const float y)
disti::GlsNinePatch::SetAvailableAttributes
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::_textureBLC
Vector _textureBLC
Definition: gls_nine_patch.h:431
disti::GlsNinePatch::TextureBLC
void TextureBLC(const Vector &value)
Definition: gls_nine_patch.h:288
disti::GlsNinePatch::Draw
virtual void Draw() DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::_textureEdge
float _textureEdge[4]
Definition: gls_nine_patch.h:439
disti::GlsNinePatch::TextureTRC
Vector TextureTRC() const
Definition: gls_nine_patch.h:305
disti::GlsNinePatch::BottomTextureEdge
void BottomTextureEdge(float value)
Definition: gls_nine_patch.h:200
disti::GlsNinePatch::LeftTextureEdge
float LeftTextureEdge()
Definition: gls_nine_patch.h:229
disti::GlsNinePatch::SetNeedsTextureRecalculate
void SetNeedsTextureRecalculate()
disti::GlsNinePatch::CloneObject
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::SetFromGloData
virtual GLS_EXPORT void SetFromGloData(GlsGloFileAttribute &data) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::_vertArray
GlsVertexArray _vertArray
Defines the vertices that make up the triangles of this object.
Definition: gls_nine_patch.h:455
disti::GlsNinePatch::Hit
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::TopVertexEdge
void TopVertexEdge(float value)
Definition: gls_nine_patch.h:217
disti::GlsNinePatch::Edge
Edge
Definition: gls_nine_patch.h:171
disti::GlsNinePatch::CalculateTextureVerts
void CalculateTextureVerts()
disti::GlsNinePatch::VertexEdge
void VertexEdge(Edge index, float value)
disti::GlsNinePatch::SetValue
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::PreDraw
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::Height
void Height(const float &value)
disti::GlsNinePatch::RightVertexEdge
void RightVertexEdge(float value)
Definition: gls_nine_patch.h:213
disti::GlsNinePatch::_width
float _width
Definition: gls_nine_patch.h:433
disti::GlsNinePatch::LeftVertexEdge
void LeftVertexEdge(float value)
Definition: gls_nine_patch.h:209
disti::GlsNinePatch::RightVertexEdge
float RightVertexEdge()
Definition: gls_nine_patch.h:249
disti::GlsNinePatch::Rotate
virtual void Rotate(const Vector &orig, float angle, const Vector &axis) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::WidthVector
const Vector WidthVector() const
Definition: gls_nine_patch.h:275
disti::GlsNinePatch::HeightVector
const Vector HeightVector() const
Definition: gls_nine_patch.h:279
disti::GlsNinePatch::_guidesVisible
bool _guidesVisible
Definition: gls_nine_patch.h:449
disti::GlsNinePatch::ReferenceTextureHeight
void ReferenceTextureHeight(const unsigned int &value)
disti::GlsNinePatch::RightTextureEdge
float RightTextureEdge()
Definition: gls_nine_patch.h:232
disti::GlsNinePatch::Vertices
virtual Vertex * Vertices() DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::PolygonMode
virtual int PolygonMode() DISTI_METHOD_OVERRIDE
Definition: gls_nine_patch.h:161
disti::GlsNinePatch::_patchVerts
Vertex _patchVerts[16]
Definition: gls_nine_patch.h:419
disti::GlsNinePatch::_height
float _height
Definition: gls_nine_patch.h:434
disti::GlsNinePatch::_objectColor
GlsColor _objectColor
Definition: gls_nine_patch.h:450
disti::GlsNinePatch::LeftTextureEdge
void LeftTextureEdge(float value)
Definition: gls_nine_patch.h:188
disti::GlsNinePatch::TextureTRC
void TextureTRC(const Vector &value)
Definition: gls_nine_patch.h:297
disti::GlsNinePatch::TextureEdge
void TextureEdge(Edge index, float value)
disti::GlsNinePatch::Calculate
virtual void Calculate(double time) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::CreateInstance
static DisplayObject * CreateInstance()
disti::GlsNinePatch::_needsTextureRecalculate
bool _needsTextureRecalculate
Definition: gls_nine_patch.h:448
disti::GlsNinePatch::CenterVisible
void CenterVisible(bool value)
disti::GlsNinePatch::GetExtents
virtual void GetExtents(float &minx, float &miny, float &minz, float &maxx, float &maxy, float &maxz) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::_referenceTexWidth
unsigned int _referenceTexWidth
Definition: gls_nine_patch.h:459
disti::GlsNinePatch::_radii
Vector _radii[2]
Definition: gls_nine_patch.h:428
disti::GlsNinePatch::CopyGeometry
virtual void CopyGeometry(DisplayObject *srcArg) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::BottomTextureEdge
float BottomTextureEdge()
Definition: gls_nine_patch.h:238
disti::GlsNinePatch::TextureBLC
Vector TextureBLC() const
Definition: gls_nine_patch.h:301
disti::GlsNinePatch::ForceRecalculate
void ForceRecalculate()
disti::GlsNinePatch::WidthVector
void WidthVector(const Vector &v)
disti::GlsNinePatch::GetPatchVerts
virtual const Vertex * GetPatchVerts()
disti::GlsNinePatch::BottomVertexEdge
void BottomVertexEdge(float value)
Definition: gls_nine_patch.h:221
disti::GlsNinePatch::GlsNinePatch
GlsNinePatch(bool generateInstance=false)
disti::GlsNinePatch::_centerVisible
bool _centerVisible
Definition: gls_nine_patch.h:446
disti::GlsNinePatch::BottomVertexEdge
float BottomVertexEdge()
Definition: gls_nine_patch.h:255
disti::GlsNinePatch::TopVertexEdge
float TopVertexEdge()
Definition: gls_nine_patch.h:252
disti::GlsNinePatch::ReferenceTextureWidth
void ReferenceTextureWidth(const unsigned int &value)
disti::GlsNinePatch::CalculateTextureResize
void CalculateTextureResize(const int tw, const int th)
disti::GlsNinePatch::ReferenceTextureWidth
unsigned int ReferenceTextureWidth()
disti::GlsNinePatch::_texHeight
unsigned int _texHeight
Definition: gls_nine_patch.h:452
disti::GlsNinePatch::Height
float Height() const
Definition: gls_nine_patch.h:317
disti::GlsNinePatch::_vertexEdge
float _vertexEdge[4]
Definition: gls_nine_patch.h:444
disti::GlsNinePatch::VertexEdge
virtual float VertexEdge(Edge index)
disti::GlsNinePatch::CalculatePatchVerts
void CalculatePatchVerts()
disti::GlsNinePatch::CalculateRadiiUnit
void CalculateRadiiUnit()
disti::GlsNinePatch::GetPatchTex
virtual const Vector * GetPatchTex()
disti::GlsNinePatch::Scale
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::TopTextureEdge
void TopTextureEdge(float value)
Definition: gls_nine_patch.h:196
disti::GlsNinePatch::CopyProperties
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::_patchTex
Vector _patchTex[16]
Definition: gls_nine_patch.h:422
disti::GlsNinePatch::HeightVector
void HeightVector(const Vector &v)
disti::GlsNinePatch::ReferenceTextureHeight
unsigned int ReferenceTextureHeight()
disti::GlsNinePatch::TextureBLC
void TextureBLC(const float x, const float y)
disti::GlsNinePatch::_texWidth
unsigned int _texWidth
Definition: gls_nine_patch.h:451
disti::GlsNinePatch::UpdateBoundingVolume
virtual void UpdateBoundingVolume() DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::LeftVertexEdge
float LeftVertexEdge()
Definition: gls_nine_patch.h:246
disti::GlsNinePatch::RightTextureEdge
void RightTextureEdge(float value)
Definition: gls_nine_patch.h:192
disti::GlsNinePatch::GetFillColor
virtual GlsColor GetFillColor() DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::GetTransformedExtents
virtual void GetTransformedExtents(Vector &min, Vector &max, const GlsMatrixType &matrix, bool resetMinMax) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::Width
void Width(const float &value)
disti::GlsNinePatch::TopTextureEdge
float TopTextureEdge()
Definition: gls_nine_patch.h:235
disti::GlsNinePatch::_needsRecalculate
bool _needsRecalculate
Definition: gls_nine_patch.h:447
disti::GlsNinePatch::CenterVisible
bool CenterVisible()
Definition: gls_nine_patch.h:259
disti::GlsNinePatch::_textureTRC
Vector _textureTRC
Definition: gls_nine_patch.h:432
disti::GlsNinePatch::SetFillColor
virtual void SetFillColor(const GlsColor &color) DISTI_METHOD_OVERRIDE
disti::GlsNinePatch::GlsNinePatch
GlsNinePatch(const GlsNinePatch &that, const bool generateNames)
disti::GlsNinePatch::DrawGuides
void DrawGuides()
disti::GlsNinePatch::_referenceTexHeight
unsigned int _referenceTexHeight
Definition: gls_nine_patch.h:460
disti::GlsNinePatch::_indexArray
GlsIndexArray _indexArray
Array containing indices to each triangle vertex.
Definition: gls_nine_patch.h:456
disti::GlsNinePatch::_normal
Vector _normal
Definition: gls_nine_patch.h:430
disti::GlsNinePatch::Width
float Width() const
Definition: gls_nine_patch.h:321
disti::GlsNinePatch::TextureEdge
virtual float TextureEdge(Edge index)
disti::GlsNinePatch::SetNeedsRecalculate
void SetNeedsRecalculate()
disti::GlsNinePatch::GetChildRect
Rect3D GetChildRect()
disti::GlsVertexArray
Definition: gls_vertex_array.h:60
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
disti::VertexNoColor
Definition: vertex.h:85
disti::VertexNoColor::y
float y
The Y component.
Definition: vertex.h:88
disti::VertexNoColor::x
float x
The X component.
Definition: vertex.h:87
disti::Vertex
Definition: vertex.h:420
glpolygon.h
The disti::GLPolygon class. Implements Polygons.
gls_auto_lib.h
The gls_auto_lib.
gls_cpp_lang_support.h
Macros and helper code to determine what subset of C++11/14/17 is available.
DISTI_SPECIAL_MEM_FUN_DELETE
#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:246
DISTI_DEPRECATED
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
DISTI_METHOD_OVERRIDE
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:222
gls_display_list.h
The disti::GlsDisplayList class.
GLS_EXPORT
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
gls_index_array.h
The disti::GlsIndexArray class, for managing index buffers.
GLS_NINE_PATCH_ARRAY_SIZE
#define GLS_NINE_PATCH_ARRAY_SIZE
The number of vertices present in a nine patch.
Definition: gls_nine_patch.h:85
GLSGEN_GLSNINEPATCH_EXPORT
#define GLSGEN_GLSNINEPATCH_EXPORT
Provides support for creating DLLs.
Definition: gls_nine_patch.h:61
gls_vertex_array.h
An object for managing vertices, texture coordinates, colors and normals for GLPolygon and other disp...
disti
Definition: bmpimage.h:47
disti::POLY_MODE_FILLED
@ POLY_MODE_FILLED
Definition: display_types.h:86