You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

145 line
3.2 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. //
  11. // The main header
  12. // ---------------
  13. //
  14. #if !defined __LOL_CORE_H__
  15. #define __LOL_CORE_H__
  16. // CPU features
  17. #undef LOL_FEATURE_CHEAP_BRANCHES
  18. #undef LOL_FEATURE_VERY_CHEAP_BRANCHES
  19. #if !defined __CELLOS_LV2__
  20. # define LOL_FEATURE_CHEAP_BRANCHES
  21. #endif
  22. // Optimisation helpers
  23. #if defined __GNUC__
  24. # define __likely(x) __builtin_expect(!!(x), 1)
  25. # define __unlikely(x) __builtin_expect(!!(x), 0)
  26. # define INLINEATTR __attribute__((always_inline))
  27. # if defined __CELLOS_LV2__ && !defined __SNC__
  28. # define FP_USE(x) __asm__("" : "+f" (x))
  29. # elif defined __x86_64__
  30. # define FP_USE(x) __asm__("" : "+x" (x))
  31. # elif defined __i386__ /* FIXME: this isn't good */
  32. # define FP_USE(x) __asm__("" : "+m" (x))
  33. # else
  34. # define FP_USE(x) (void)(x)
  35. # endif
  36. #else
  37. # define __likely(x) x
  38. # define __unlikely(x) x
  39. # define INLINEATTR
  40. # define FP_USE(x) (void)(x)
  41. #endif
  42. /* Ensure we have nullptr */
  43. #if defined nullptr
  44. /* do nothing */
  45. #elif defined __GNUC__
  46. # define nullptr __null
  47. #else
  48. # include <cstddef>
  49. # define nullptr NULL
  50. #endif
  51. /* Ensure isnan() is present even on systems that don't define it, or
  52. * when -ffast-math is being used. */
  53. #include <cmath>
  54. #if defined __FAST_MATH__
  55. # undef isnan
  56. #endif
  57. #if !defined isnan
  58. # define isnan isnan
  59. # include <stdint.h>
  60. static inline int isnan(float f)
  61. {
  62. union { float f; uint32_t x; } u = { f };
  63. return (u.x << 1) > 0xff000000u;
  64. }
  65. #endif
  66. /* External declaration for LolFx files. */
  67. #define LOLFX_RESOURCE_DECLARE(name) \
  68. extern "C" char const *LOLFX_RESOURCE_NAME(name)
  69. #define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
  70. /* If using NaCl or Android, override main() with our version */
  71. #if defined __native_client__
  72. # define main lol_nacl_main
  73. #elif defined __ANDROID__
  74. # define main lol_android_main
  75. #endif
  76. /* If using SDL on Windows or OS X, let it override main() */
  77. #if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
  78. # include <SDL_main.h>
  79. #endif
  80. // Base types
  81. #include <lol/base/all.h>
  82. #include <lol/math/all.h>
  83. #include <lol/sys/all.h>
  84. #include <lol/gpu/all.h>
  85. #include <lol/image/all.h>
  86. #include <lol/debug/all.h>
  87. #include "numeric.h"
  88. // Static classes
  89. #include "platform.h"
  90. #include "video.h"
  91. #include "audio.h"
  92. #include "scene.h"
  93. #include "input/input.h"
  94. #include "input/keyboard.h"
  95. #include "input/stick.h"
  96. #include "profiler.h"
  97. // Entities
  98. #include "entity.h"
  99. #include "worldentity.h"
  100. #include "camera.h"
  101. #include "light.h"
  102. #include "emitter.h"
  103. #include "font.h"
  104. #include "gradient.h"
  105. #include "sample.h"
  106. #include "sprite.h"
  107. #include "text.h"
  108. #include "tileset.h"
  109. #include "world.h"
  110. // Other objects
  111. #include "dict.h"
  112. #include "map.h"
  113. #include "layer.h"
  114. #include "mesh/mesh.h"
  115. #include "application/application.h"
  116. #include "easymesh/csgbsp.h"
  117. #include "easymesh/easymesh.h"
  118. // Managers
  119. #include "ticker.h"
  120. #include "forge.h"
  121. #include "tiler.h"
  122. #include "sampler.h"
  123. #endif // __LOL_CORE_H__