PolyGlobals.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. Copyright (C) 2011 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #pragma once
  20. // Polycode CORE LIBRARY CONFIGURATION SECTION
  21. // Compile support for lua bindings.
  22. //#define _COMPILE_LUA
  23. #define COMPILE_GL_RENDERER
  24. #ifdef _WINDOWS
  25. #define WIN32_LEAN_AND_MEAN
  26. #pragma warning(disable:4251)
  27. #pragma warning(disable:4305)
  28. #pragma warning(disable:4244)
  29. #pragma warning(disable:4018)
  30. #pragma warning(disable:4996)
  31. #pragma warning(disable:4309)
  32. #define NULL 0
  33. #endif
  34. #include <stdint.h>
  35. #ifndef NULL
  36. #define NULL 0
  37. #endif
  38. #define PI 3.14159265
  39. #define RADIANS 57.2957795
  40. #define TODEGREES 57.2957795
  41. #define TORADIANS 0.0174532925
  42. #if defined(_WINDOWS) && defined(Polycore_EXPORTS)
  43. #define _PolyExport __declspec(dllexport)
  44. #else
  45. #define _PolyExport
  46. #endif
  47. //#define COMPILE_SDL_CORE 1
  48. #define PLATFORM_WINDOWS 1
  49. #define PLATFORM_MAC 2
  50. #define PLATFORM_UNIX 3
  51. #ifdef _WINDOWS
  52. #define PLATFORM PLATFORM_WINDOWS
  53. #elif defined(__APPLE__) && defined(__MACH__)
  54. #define PLATFORM PLATFORM_MAC
  55. #else
  56. #include <cstddef>
  57. #define PLATFORM PLATFORM_UNIX
  58. #endif
  59. typedef double Number;
  60. #define RANDOM_NUMBER ((Number)rand()/(Number)RAND_MAX)
  61. inline Number clampf(Number x, Number a, Number b)
  62. {
  63. return x < a ? a : (x > b ? b : x);
  64. }
  65. #define MIN(a, b) (((a) < (b)) ? (a) : (b))
  66. #define MAX(a, b) (((a) > (b)) ? (a) : (b))
  67. // Special flag read by create_lua_library parser, suppresses Lua bindings for item.
  68. #define POLYIGNORE
  69. class _PolyExport PolyBase {};