irrTypes.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include <cstdint>
  6. namespace irr
  7. {
  8. //! 8 bit unsigned variable.
  9. typedef uint8_t u8;
  10. //! 8 bit signed variable.
  11. typedef int8_t s8;
  12. //! 8 bit character variable.
  13. /** This is a typedef for char, it ensures portability of the engine. */
  14. typedef char c8;
  15. //! 16 bit unsigned variable.
  16. typedef uint16_t u16;
  17. //! 16 bit signed variable.
  18. typedef int16_t s16;
  19. //! 32 bit unsigned variable.
  20. typedef uint32_t u32;
  21. //! 32 bit signed variable.
  22. typedef int32_t s32;
  23. //! 64 bit unsigned variable.
  24. typedef uint64_t u64;
  25. //! 64 bit signed variable.
  26. typedef int64_t s64;
  27. //! 32 bit floating point variable.
  28. /** This is a typedef for float, it ensures portability of the engine. */
  29. typedef float f32;
  30. //! 64 bit floating point variable.
  31. /** This is a typedef for double, it ensures portability of the engine. */
  32. typedef double f64;
  33. } // end namespace irr
  34. //! Defines for snprintf_irr because snprintf method does not match the ISO C
  35. //! standard on Windows platforms.
  36. //! We want int snprintf_irr(char *str, size_t size, const char *format, ...);
  37. #if defined(_MSC_VER)
  38. #define snprintf_irr sprintf_s
  39. #else
  40. #define snprintf_irr snprintf
  41. #endif // _MSC_VER
  42. namespace irr
  43. {
  44. //! Type name for character type used by the file system (legacy).
  45. typedef char fschar_t;
  46. #define _IRR_TEXT(X) X
  47. } // end namespace irr
  48. //! define a break macro for debugging.
  49. #if defined(_DEBUG)
  50. #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)
  51. #include <crtdbg.h>
  52. #define _IRR_DEBUG_BREAK_IF(_CONDITION_) \
  53. if (_CONDITION_) { \
  54. _CrtDbgBreak(); \
  55. }
  56. #else
  57. #include <assert.h>
  58. #define _IRR_DEBUG_BREAK_IF(_CONDITION_) assert(!(_CONDITION_));
  59. #endif
  60. #else
  61. #define _IRR_DEBUG_BREAK_IF(_CONDITION_)
  62. #endif
  63. //! deprecated macro for virtual function override
  64. /** prefer to use the override keyword for new code */
  65. #define _IRR_OVERRIDE_ override
  66. //! creates four CC codes used in Irrlicht for simple ids
  67. /** some compilers can create those by directly writing the
  68. code like 'code', but some generate warnings so we use this macro here */
  69. #define MAKE_IRR_ID(c0, c1, c2, c3) \
  70. ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
  71. ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24))