42 #ifndef INCLUDED_GLS_RUNTIME_UTIL_H
43 #define INCLUDED_GLS_RUNTIME_UTIL_H
45 #include "ConvertUTF.h"
75 #if defined( LINUX ) || defined( __VXWORKS__ ) || defined( __APPLE__ ) || defined( QNX )
80 # include <android/asset_manager.h>
83 const int DIALOG_MAX_DIRECTORY_LENGTH = 1024;
88 #if defined( GLS_DEBUG ) || !defined( NDEBUG )
89 # define GLS_DEBUG_CODE( x ) x
91 # define GLS_DEBUG_CODE( x )
109 inline int strcasecmp(
const char*
const x,
const char*
const y )
111 return _stricmp( x, y );
119 const char PARSER_CLEARSTRING_DELIMETER_START[] =
"#$STRING_START$#";
120 const char PARSER_CLEARSTRING_DELIMETER_END[] =
"#$STRING_END$#";
122 const double HIT_TOLERANCE = 5.0;
125 template<
class X,
class X1,
class X2>
126 bool BETWEEN(
const X& x,
const X1& x1,
const X2& x2 )
128 return ( x >= x1 && x <= x2 )
129 || ( x >= x2 && x <= x1 );
134 bool IS_NEGATIVE(
const X& x ) {
return std::fabs( x ) > 0.0001 ? ( x < 0.0 ) : 0; }
138 bool IS_POSITIVE(
const X& x ) {
return std::fabs( x ) > 0.0001 ? ( x > 0.0 ) : 0; }
144 return std::fabs( x ) < threshold;
162 # define MIN( A, B ) ( ( A ) < ( B ) ? ( A ) : ( B ) )
168 # define MAX( A, B ) ( ( A ) > ( B ) ? ( A ) : ( B ) )
177 GLS_EXPORT
bool gltIsExtSupported(
const char* extension );
182 # define GLSTUDIO_CLAMP_TO_EDGE ( OpenGLVersion() >= 1.2f ? 0x812F : GL_CLAMP )
184 # define GLSTUDIO_CLAMP_TO_EDGE GL_CLAMP_TO_EDGE
212 if( ( index < 0 ) || ( index >= GLS_COLOR_MAX ) )
213 return glsDefinedColors[ 0 ];
215 return glsDefinedColors[ index ];
223 unsigned char alpha )
225 if( ( index >= 0 ) && ( index < GLS_COLOR_MAX ) )
227 glsDefinedColors[ index ][ 0 ] = red;
228 glsDefinedColors[ index ][ 1 ] = green;
229 glsDefinedColors[ index ][ 2 ] = blue;
230 glsDefinedColors[ index ][ 3 ] = alpha;
241 typedef unsigned short char_type;
242 typedef int int_type;
243 typedef std::streampos pos_type;
244 typedef std::streamoff off_type;
245 typedef std::mbstate_t state_type;
247 static void assign( char_type& c1,
const char_type& c2 )
252 static bool eq(
const char_type& c1,
const char_type& c2 )
257 static bool lt(
const char_type& c1,
const char_type& c2 )
262 static int compare(
const char_type* s1,
const char_type* s2,
size_t n )
272 return ( *s1 - *( s2 - 1 ) );
282 static size_t length(
const char_type* s )
292 static const char_type* find(
const char_type* s,
size_t n,
const char_type& a )
305 static char_type* move( char_type* s1,
const char_type* s2,
size_t n )
307 return static_cast<char_type*
>( memmove( s1, s2, n *
sizeof( char_type ) ) );
310 static char_type* copy( char_type* s1,
const char_type* s2,
size_t n )
312 return static_cast<char_type*
>( memcpy( s1, s2, n *
sizeof( char_type ) ) );
315 static char_type* assign( char_type* s,
size_t n, char_type a )
317 for(
size_t idx = 0u; idx < n; ++idx )
324 static char_type to_char_type(
const int_type& c )
326 return static_cast<char_type
>( c );
329 static int_type to_int_type(
const char_type& c )
331 return static_cast<int_type
>( c );
334 static bool eq_int_type(
const int_type& c1,
const int_type& c2 )
339 static int_type eof()
341 return static_cast<int_type
>( EOF );
344 static int_type not_eof(
const int_type& c )
346 return ( c == eof() ) ? 0 : c;
350 typedef std::basic_string<unsigned short, CharTraitsUnsignedShort> UTF16String;
351 typedef std::ofstream UTF16Outfilestream;
352 typedef std::ostream UTF16Outstream;
353 typedef std::string UnicodeString;
354 typedef std::ofstream UnicodeOutfilestream;
355 typedef std::ostream UnicodeOutstream;
359 typedef std::wstring UTF16String;
360 typedef std::wofstream UTF16Outfilestream;
361 typedef std::wostream UTF16Outstream;
362 typedef std::wstring UnicodeString;
363 typedef std::wofstream UnicodeOutfilestream;
364 typedef std::wostream UnicodeOutstream;
376 if( src.size() > 0u )
379 const unsigned int srcLen = (
unsigned int)src.size();
380 const unsigned int utf16BufLen = (
unsigned int)( src.size() + 1u );
381 UTF16* utf16Buf =
new UTF16[ src.size() + 1u ];
383 memset( utf16Buf, 0, ( utf16BufLen *
sizeof( UTF16 ) ) );
387 const UTF8* srcUTF8 = (
const UTF8*)( src.c_str() );
388 UTF16* targetUTF16 = utf16Buf;
389 ConvertUTF8toUTF16( &srcUTF8, &srcUTF8[ srcLen ], &targetUTF16, &( targetUTF16[ utf16BufLen - 1u ] ), strictConversion );
392 utf16Buf[ utf16BufLen - 1u ] = 0;
395 ret.assign( (
wchar_t*)utf16Buf );
397 ret.assign( (
unsigned short*)utf16Buf );
401 delete[]( utf16Buf );
420 template<
class T1,
class T2>
421 bool Equal( T1 x, T2 y,
float precision = 0.001f )
423 return ( x - precision ) <= y && y <= ( x + precision );
432 const T&
Min(
const T& x,
const T& y )
434 return x < y ? x : y;
443 const T&
Max(
const T& x,
const T& y )
445 return x < y ? y : x;
453 template<
class T,
class Pred>
454 const T&
Min(
const T& x,
const T& y, Pred pr )
456 return pr( x, y ) ? x : y;
464 template<
class T,
class Pred>
465 const T&
Max(
const T& x,
const T& y, Pred pr )
467 return pr( x, y ) ? y : x;
532 rotation_scaling( 0, 0 ) = new_i.x;
533 rotation_scaling( 0, 1 ) = new_j.x;
534 rotation_scaling( 0, 2 ) = new_k.x;
535 rotation_scaling( 1, 0 ) = new_i.y;
536 rotation_scaling( 1, 1 ) = new_j.y;
537 rotation_scaling( 1, 2 ) = new_k.y;
538 rotation_scaling( 2, 0 ) = new_i.z;
539 rotation_scaling( 2, 1 ) = new_j.z;
540 rotation_scaling( 2, 2 ) = new_k.z;
543 rotation_scaling.
Invert();
546 return rotation_scaling * transform;
552 GlsMatrixAffine<T> transform;
553 GlsMatrixAffine<T> rotation_scaling;
557 transform.Translate( -new_origin );
561 rotation_scaling( 0, 0 ) = new_i.x;
562 rotation_scaling( 0, 1 ) = new_j.x;
563 rotation_scaling( 0, 2 ) = new_k.x;
564 rotation_scaling( 1, 0 ) = new_i.y;
565 rotation_scaling( 1, 1 ) = new_j.y;
566 rotation_scaling( 1, 2 ) = new_k.y;
567 rotation_scaling( 2, 0 ) = new_i.z;
568 rotation_scaling( 2, 1 ) = new_j.z;
569 rotation_scaling( 2, 2 ) = new_k.z;
572 rotation_scaling.Invert();
575 result = rotation_scaling * transform;
647 int& index1,
int& index2,
int& index3,
648 bool isVectorArray =
true );
671 GLS_EXPORT
int EncodeString(
char* dest,
const char* src,
const int dest_str_length );
677 GLS_EXPORT std::string
EncodeString(
const std::string& src );
690 GLS_EXPORT
int C_EncodeString(
char* dest,
const char* src,
const int dest_str_length );
704 GLS_EXPORT
int DecodeString(
char* dest,
const char* src,
const int dest_str_length );
710 GLS_EXPORT std::string
DecodeString(
const std::string& src );
718 unsigned char* pixels;
721 GLS_EXPORT
char* MakeRelativePath(
const char* originalPath,
const char* relativePath );
722 GLS_EXPORT
void ConvertBackslashToSlash(
char* str );
723 GLS_EXPORT
void ConvertBackslashToSlash( std::string& str );
740 GLS_EXPORT
int range_check(
int num,
double val, ... );
749 GLS_EXPORT
int Safe_fopen(
const char* filename,
char* flags, FILE** f );
751 GLS_EXPORT
int Safe_fopen(
const char* filename,
char* flags, std::fstream& outstr );
760 GLS_EXPORT
void EnableDirectAssetLoading(
bool enableDirectAssetLoading );
768 GLS_EXPORT
bool HasAssetExtension(
const char* filename );
776 GLS_EXPORT
bool AssetExists(
const char* filename );
783 GLS_EXPORT
void SetAssetManager( AAssetManager* assetManager );
786 #if defined( ANDROID ) || ( defined( __APPLE__ ) && defined( GLES ) ) || ( defined( LINUX ) && defined( GLES ) ) || defined( QNX ) || defined( INTEGRITY )
792 GLS_EXPORT std::string
ResolvePath(
const char* filename_ );
798 GLS_EXPORT
void SetResourcePath(
const char* resourcePath );
809 GLS_EXPORT FILE*
gls_fopen(
const char* filename,
const char* flags );
834 GLS_EXPORT std::string
ResolvePath(
const char* path );
837 inline std::string
ResolvePath(
const std::string& path )
848 GLS_EXPORT FILE*
gls_fopen(
const char* filename,
const char* flags );
860 #if defined( __APPLE__ ) && defined( GLES )
867 GLS_EXPORT std::string GetAbsolutePathAndFileNameInDefaultResourceBundle(
const char* fileName );
880 GLS_EXPORT
bool FileExists(
const char* filename );
881 GLS_EXPORT
bool FileExists(
const std::string& filename );
886 GLS_EXPORT
bool IsDirectory(
const char* filename );
887 GLS_EXPORT
bool IsDirectory(
const std::string& filename );
892 GLS_EXPORT std::string
FileExtension(
const std::string& filepath );
897 GLS_EXPORT std::string
FileName(
const std::string& filepath );
903 GLS_EXPORT std::string
FilePath(
const std::string& filepath );
911 GLS_EXPORT
const char*
GetFilePath(
const char* name );
937 GLS_EXPORT
char*
PathToOS(
const char* path );
944 GLS_EXPORT std::string
GetExtension(
const std::string& filename );
950 GLS_EXPORT
const char*
GetBaseName(
const char* path );
975 GLS_EXPORT
void TrimSpaces( std::string& entry );
989 GLS_EXPORT
bool ContainsNonBlank(
const std::string& val );
991 GLS_EXPORT
bool GetNoSpaces( FILE* f,
char* result,
int maxLen );
992 GLS_EXPORT
bool GetToEnd( std::istream& instr, std::string& result,
bool decode );
993 GLS_EXPORT
bool GetVertex( std::istream& instr, Vertex* vert,
bool getColor );
998 GLS_EXPORT
bool GetComponentClassNames(
const char* dllFileName, DynamicArray<std::string>& nameList,
const char* createClassTag =
"CreateComponent_" );
1014 #if !defined( GLES ) || defined( GLES_ANGLE )
1015 GLS_EXPORT
bool OpenFileDialog( Fl_Window* win,
char* filePath,
unsigned int filePathSize,
1016 char* directory = NULL,
const char* filterStr = NULL,
1017 const char* defaultExt = NULL,
const char* title = NULL,
1018 bool multiSelect =
false,
bool createFile =
false,
1019 bool fileMustExist =
false,
bool pathMustExist =
false,
1020 bool noChangeDirectory =
false );
1022 GLS_EXPORT
bool SaveFileDialog( Fl_Window* win,
char* filePath,
unsigned int filePathSize,
1023 char* directory = NULL,
const char* filterStr = NULL,
1024 const char* defaultExt = NULL,
const char* title = NULL,
1025 bool createFile =
false,
1026 bool fileMustExist =
false,
bool pathMustExist =
false,
1027 bool noChangeDirectory =
false );
1029 GLS_EXPORT
void CheckGLError(
void );
1039 GLS_EXPORT std::string
Uppercase(
const std::string& str );
1041 GLS_EXPORT std::string ReplaceEnvironmentVariables(
const char* originalPath );
1048 GLS_EXPORT
void ReadCommandLine(
int argc,
char** argv );
1049 GLS_EXPORT
void Usage();
1057 static GLS_EXPORT glsCommandLine* Instance();
1073 GLS_EXPORT InterfaceDescriptionClass(
const char* code,
const char* usage,
const char* comment );
1075 GLS_EXPORT ~InterfaceDescriptionClass();
1076 GLS_EXPORT InterfaceDescriptionClass(
const InterfaceDescriptionClass& source );
1077 GLS_EXPORT InterfaceDescriptionClass& operator=(
const InterfaceDescriptionClass& source );
1079 GLS_EXPORT
void Code(
const char* );
1080 GLS_EXPORT
void Usage(
const char* );
1081 GLS_EXPORT
void Comment(
const char* );
1083 const char* Code()
const {
return _code; }
1084 const char* Usage()
const {
return _usage; }
1085 const char* Comment()
const {
return _comment; }
1087 #if defined( DISTI_HAS_RVAL_REFS )
1088 InterfaceDescriptionClass( InterfaceDescriptionClass&& source )
1093 StealFrom( source );
1096 InterfaceDescriptionClass& operator=( InterfaceDescriptionClass&& source )
1098 if(
this != &source )
1105 StealFrom( source );
1111 void StealFrom( InterfaceDescriptionClass& source )
1114 _code = source._code;
1115 _usage = source._usage;
1116 _comment = source._comment;
1119 source._code = NULL;
1120 source._usage = NULL;
1121 source._comment = NULL;
1135 typedef std::ostream ostreamType;
1136 typedef std::istream istreamType;
1138 virtual void StreamOut( ostreamType& outstr )
const = 0;
1139 virtual void StreamIn( istreamType& instr ) = 0;
1173 if(
typeid( T2 ) !=
typeid(
void* ) )
1177 if(
typeid( T3 ) !=
typeid(
void* ) )
1181 if(
typeid( T4 ) !=
typeid(
void* ) )
1185 if(
typeid( T5 ) !=
typeid(
void* ) )
1189 if(
typeid( T6 ) !=
typeid(
void* ) )
1193 if(
typeid( T7 ) !=
typeid(
void* ) )
1197 if(
typeid( T8 ) !=
typeid(
void* ) )
1201 if(
typeid( T9 ) !=
typeid(
void* ) )
1205 if(
typeid( T10 ) !=
typeid(
void* ) )
1237 : _val1( src._val1 )
1238 , _val2( src._val2 )
1239 , _val3( src._val3 )
1240 , _val4( src._val4 )
1241 , _val5( src._val5 )
1242 , _val6( src._val6 )
1243 , _val7( src._val7 )
1244 , _val8( src._val8 )
1245 , _val9( src._val9 )
1246 , _val10( src._val10 )
1265 const T2& val2 = T2(),
1266 const T3& val3 = T3(),
1267 const T4& val4 = T4(),
1268 const T5& val5 = T5(),
1269 const T6& val6 = T6(),
1270 const T7& val7 = T7(),
1271 const T8& val8 = T8(),
1272 const T9& val9 = T9(),
1273 const T10& val10 = T10() )
1296 case 10: rval &= ( _val10 == val._val10 );
1297 case 9: rval &= ( _val9 == val._val9 );
1298 case 8: rval &= ( _val8 == val._val8 );
1299 case 7: rval &= ( _val7 == val._val7 );
1300 case 6: rval &= ( _val6 == val._val6 );
1301 case 5: rval &= ( _val5 == val._val5 );
1302 case 4: rval &= ( _val4 == val._val4 );
1303 case 3: rval &= ( _val3 == val._val3 );
1304 case 2: rval &= ( _val2 == val._val2 );
1306 rval &= ( _val1 == val._val1 );
1317 return !( *
this == val );
1328 outstr <<
" " << _val2;
1330 outstr <<
" " << _val3;
1332 outstr <<
" " << _val4;
1334 outstr <<
" " << _val5;
1336 outstr <<
" " << _val6;
1338 outstr <<
" " << _val7;
1340 outstr <<
" " << _val8;
1342 outstr <<
" " << _val9;
1343 if( _numVals >= 10 )
1344 outstr <<
" " << _val10;
1394 if( _numVals >= 10 )
1402 GLS_EXPORT std::ostream&
operator<<( std::ostream& outstr,
const GlsMultiValBase& multiVal );
1403 GLS_EXPORT std::istream& operator>>( std::istream& instr, GlsMultiValBase& multiVal );
1415 std::string _string;
1436 : _string( str ? str :
"" )
1440 operator std::string()
const
1456 return str1._string == str2._string;
1462 return !( str1 == str2 );
1466 inline std::ostream&
operator<<( std::ostream& outstr,
const GlsPropString& str )
1471 inline std::istream& operator>>( std::istream& instr, GlsPropString& str )
1474 disti::GetToEnd( instr, temp,
false );
1487 std::string _string;
1510 operator std::string()
const
1515 std::string& String()
1522 return str._string == _string;
1526 inline std::ostream&
operator<<( std::ostream& outstr,
const GlsPropStringQuoted& str )
1532 inline std::istream& operator>>( std::istream& instr, GlsPropStringQuoted& str )
1539 if( instr.peek() !=
'\"' )
1541 disti::GetToEnd( instr, temp,
false );
1551 while( instr.good() )
1553 lastChar = currChar;
1554 currChar = instr.get();
1555 if( currChar != -1 )
1557 if( currChar ==
'\"' && lastChar !=
'\\' )
1559 temp += (char)currChar;
1570 void SpawnBrowser(
const char* url );
1580 GLS_EXPORT
bool CheckDistiLicense(
const char* licenseGroupName,
const char* feature,
const char* version,
bool quiet );
1614 T Clamp(
const T& val,
const T& min,
const T& max )
1616 return std::min( max, std::max( min, val ) );
1629 inline void Split(
const std::string& s,
const char delim, std::vector<std::string>& elems,
const std::size_t maxElems = 0 )
1631 std::istringstream ss( s );
1633 while( std::getline( ss, item, delim ) )
1635 elems.push_back( DISTI_RVAL_MOVE( item ) );
1636 if( elems.size() == maxElems )
1641 if( elems.size() == maxElems && ss.good() && maxElems > 0 )
1643 std::string remainder;
1644 std::getline( ss, remainder,
'\0' );
1645 elems.back() += delim + remainder;
1659 inline std::vector<std::string> Split(
const std::string& s,
const char delim,
const std::size_t maxElems = 0 )
1661 std::vector<std::string> elems;
1662 Split( s, delim, elems, maxElems );
1667 inline std::string MakeString(
const char*
const cStr )
1669 return ( cStr ? cStr :
"" );
1676 class IGlsStateManager;
1679 class TextureLoaderList;
1713 void operator=(
const GlsGlobals& ) DISTI_SPECIAL_MEM_FUN_DELETE;
1720 inline void _checkPointerSize()
1724 || ( DISTI_IS_BITNESS( 32 ) &&
sizeof(
void* ) == 4 ),
1725 "Pointer size is unexpected for this bitness" );
1726 DISTI_STATIC_ASSERT_STR( DISTI_IS_BITNESS( 64 ) ^ DISTI_IS_BITNESS( 32 ),
"Expected one bitness to be detected." );
1733 GLS_EXPORT
void glsPerspective(
double fovy,
double aspect,
double zNear,
double zFar );
1735 #ifdef MATRIX_TYPE_FLOAT
1736 GLS_EXPORT
bool glsProject(
double objx,
double objy,
double objz,
1737 const float modelMatrix[ 16 ],
1738 const float projMatrix[ 16 ],
1739 const int viewport[ 4 ],
1740 double* winx,
double* winy,
double* winz );
1742 GLS_EXPORT
bool glsUnProject(
double winx,
double winy,
double winz,
1743 const float modelMatrix[ 16 ],
1744 const float projMatrix[ 16 ],
1745 const int viewport[ 4 ],
1746 double* objx,
double* objy,
double* objz );
1748 GLS_EXPORT
bool glsProject(
double objx,
double objy,
double objz,
1749 const double modelMatrix[ 16 ],
1750 const double projMatrix[ 16 ],
1751 const int viewport[ 4 ],
1752 double* winx,
double* winy,
double* winz );
1754 GLS_EXPORT
bool glsUnProject(
double winx,
double winy,
double winz,
1755 const double modelMatrix[ 16 ],
1756 const double projMatrix[ 16 ],
1757 const int viewport[ 4 ],
1758 double* objx,
double* objy,
double* objz );
The DistiUnhideGlobalsDummyClass class.
const T & Min(const T &x, const T &y)
Definition: util.h:432
int EncodedStringMinLength()
GlsPropStringQuoted(const std::string &str)
Definition: util.h:1497
virtual void StreamOut(ostreamType &outstr) const
Definition: util.h:1324
#define DISTI_STATIC_ASSERT_STR(expr, msg)
Uses C++11's static_assert() because it is available on this platform.
Definition: gls_cpp_lang_support.h:384
std::string GetExtension(const std::string &filename)
GlsDefinedColorEnum
Definition: util.h:189
bool IS_NEGATIVE(const X &x)
Definition: util.h:134
const int INLINE_TEXTURE_LINE_LENGTH
Definition: util.h:116
std::string & String()
Definition: util.h:1448
std::string FileExtension(const std::string &filepath)
void GlsGetPerspective(GlsMatrixType &m, double fovy, double aspect, double zNear, double zFar)
GlsPropString(const char *str)
Definition: util.h:1435
unsigned char glsDefinedColors[GLS_COLOR_MAX][4]
bool IsNearZero(X x)
Definition: util.h:153
virtual bool operator!=(const GlsMultiVal &val) const
Definition: util.h:1315
Definition: dynamic_array.h:66
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:471
std::string FileName(const std::string &filepath)
const char * GetBaseName(const char *path)
bool VeryCloseToZero(X x)
Definition: util.h:149
int EncodeString(char *dest, const char *src, const int dest_str_length)
void TrimSpaces(std::string &entry)
The GlsMatrixAffine class.
void AppendTrailingSlash(char *s)
GlsFontMan & GetFontMan()
Gets the global font manager.
void RemoveDoubleSlashes(char *path, char slash= '/')
Definition: texture_loader.h:55
bool CheckDistiLicense(const char *licenseGroupName, const char *feature, const char *version, bool quiet)
std::string GetQualifiedInstanceName(const DisplayFrame *topFrame, const DisplayObject *obj)
Hold global objects so we can control order of destruction.
Definition: util.h:1682
std::string GetDefaultComponentClassName(const char *dllFileName)
bool BETWEEN(const X &x, const X1 &x1, const X2 &x2)
Definition: util.h:126
GlsMultiVal()
Definition: util.h:1226
char * PathToOS(const char *path)
bool IS_ZERO(X x)
Definition: util.h:157
Definition: gls_state_manager_interface.h:67
void RemoveSpaces(std::string &entry)
const T & Max(const T &x, const T &y)
Definition: util.h:443
virtual bool operator==(const GlsMultiVal &val) const
Definition: util.h:1289
GlsPropStringQuoted(const char *str)
Definition: util.h:1505
bool SilentMode() const
Definition: util.h:1055
A file for all GL Studio files to include.
Mutex & GetImageListMutex()
Gets the mutex for protecting the image list.
int range_check(int num, double val,...)
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
Defines the stream out operator.
bool GetObjectCoordinatesTransformSameView(DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
UTF16String ConvertUTF8ToWide(const std::string &src)
Definition: util.h:373
float AngularDistanceRad(float angle1, float angle2)
std::string Uppercase(const std::string &str)
void ChangeGlsDefinedColor(GlsDefinedColorEnum index, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
Definition: util.h:218
Definition: scoped_ptr.h:53
GlsPropString()
Definition: util.h:1418
bool GetComponentClassNames(const char *dllFileName, DynamicArray< std::string > &nameList, const char *createClassTag="CreateComponent_")
VertexNoColor Vector
Definition: gls_font_base.h:66
DisplayFrame * GetTopLevelDisplayFrame(DisplayFrame *frame)
GlsMatrixAffine< T > FindCoordinateTransformation(const Vector &new_origin, const Vector &new_i, const Vector &new_j, const Vector &new_k)
Definition: util.h:521
bool FindNonColinearVertices(int arraySize, Vector array[], int &index1, int &index2, int &index3, bool isVectorArray=true)
bool GetObjectCoordinatesTransform(DisplayObject *from, DisplayObject *to, GlsMatrixType *outTransform)
int DecodeString(char *dest, const char *src, const int dest_str_length)
bool CalculateTexPointsFromTexCoords(DisplayObject *object)
TextureLoaderList & GetTextureLoaders()
Gets the global list of texture loaders.
Definition: gls_mutex.h:52
friend bool operator!=(const GlsPropString &str1, const GlsPropString &str2)
Definition: util.h:1460
The disti::Vertex class. A class for manipulating 3D vertices.
GlsMultiVal(const GlsMultiVal &src)
Definition: util.h:1236
void PushResourcePath(const char *resourcePath)
IGlsStateManager & GetStateManager()
Gets the global state manager instance.
void Translate(Type x, Type y, Type z)
Definition: gls_matrix_affine.h:198
int gls_unlink(const char *filename)
bool FileExists(const char *filename)
int C_EncodeString(char *dest, const char *src, const int dest_str_length)
static GlsGlobals & Instance()
Singleton instance.
virtual void StreamIn(istreamType &instr)
Definition: util.h:1351
GlsMultiVal(const T1 &val1, const T2 &val2=T2(), const T3 &val3=T3(), const T4 &val4=T4(), const T5 &val5=T5(), const T6 &val6=T6(), const T7 &val7=T7(), const T8 &val8=T8(), const T9 &val9=T9(), const T10 &val10=T10())
Definition: util.h:1263
FILE * gls_fopen(const char *filename, const char *flags)
bool IsDirectory(const char *filename)
float AngularDistanceDeg(float angle1, float angle2)
std::string FilePath(const std::string &filepath)
Definition: gls_font_man.h:59
bool Equal(T1 x, T2 y, float precision=0.001f)
Definition: util.h:421
char * GetFileName(const char *name)
List_c & GetImageList()
Gets the image list.
bool NotColinear(const Vector &a, const Vector &b, const Vector &c)
const char * GetFilePath(const char *name)
std::string ResolveRuntimeResourcePath(const char *fileName)
void PushResourceFinder(std::string(*finder)(const std::string &))
A smart pointer with unique ownership – poor man's std::unique_ptr.
std::string ResolvePath(const char *path)
bool CloseToZero(const X x, const X threshold=X(1e-1))
Definition: util.h:142
friend bool operator==(const GlsPropString &str1, const GlsPropString &str2)
Definition: util.h:1454
Contains the DistiAssert macro.
Macros and helper code to determine what subset of C++11/14/17 is available.
void GlsGetOrtho(GlsMatrixType &m, double left, double right, double bottom, double top, double zNear, double zFar)
GlsPropString(const std::string &str)
Definition: util.h:1426
int Safe_fopen(const char *filename, char *flags, FILE **f)
unsigned char * GlsDefinedColor(GlsDefinedColorEnum index)
Definition: util.h:210
Definition: bmpimage.h:46
GlsPropStringQuoted()
Definition: util.h:1490
bool IS_POSITIVE(const X &x)
Definition: util.h:138