選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

165 行
3.6 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. // System and CPU features
  17. #undef LOL_FEATURE_THREADS
  18. #undef LOL_FEATURE_CHEAP_BRANCHES
  19. #undef LOL_FEATURE_VERY_CHEAP_BRANCHES
  20. #if !defined EMSCRIPTEN
  21. # define LOL_FEATURE_THREADS 1
  22. #endif
  23. #if !defined __CELLOS_LV2__
  24. # define LOL_FEATURE_CHEAP_BRANCHES 1
  25. #endif
  26. // Optimisation helpers
  27. #if defined __GNUC__
  28. # define __likely(x) __builtin_expect(!!(x), 1)
  29. # define __unlikely(x) __builtin_expect(!!(x), 0)
  30. # define INLINEATTR __attribute__((always_inline))
  31. # if defined __CELLOS_LV2__ && !defined __SNC__
  32. # define FP_USE(x) __asm__("" : "+f" (x))
  33. # elif defined __x86_64__
  34. # define FP_USE(x) __asm__("" : "+x" (x))
  35. # elif defined __i386__ /* FIXME: this isn't good */
  36. # define FP_USE(x) __asm__("" : "+m" (x))
  37. # else
  38. # define FP_USE(x) (void)(x)
  39. # endif
  40. #else
  41. # define __likely(x) x
  42. # define __unlikely(x) x
  43. # define INLINEATTR
  44. # define FP_USE(x) (void)(x)
  45. #endif
  46. /* Ensure we have nullptr */
  47. #if defined nullptr
  48. /* do nothing */
  49. #elif defined __GNUC__
  50. # define nullptr __null
  51. #else
  52. # include <cstddef>
  53. # define nullptr NULL
  54. #endif
  55. /* Ensure isnan() is present even on systems that don't define it, or
  56. * when -ffast-math is being used. */
  57. #include <cmath>
  58. #if defined __FAST_MATH__
  59. # undef isnan
  60. #endif
  61. #if !defined isnan
  62. # define isnan isnan
  63. # include <stdint.h>
  64. static inline int isnan(float f)
  65. {
  66. union { float f; uint32_t x; } u = { f };
  67. return (u.x << 1) > 0xff000000u;
  68. }
  69. #endif
  70. /* XXX: workaround for a compilation bug in NaCl headers */
  71. #if defined __native_client__
  72. # define typeid(x) (*(type_info*)nullptr)
  73. #endif
  74. /* XXX: workaround for X11 headers that try to #define these */
  75. #undef Always
  76. #define Always Always
  77. #undef None
  78. #define None None
  79. /* External declaration for LolFx files. */
  80. #define LOLFX_RESOURCE_DECLARE(name) \
  81. extern "C" char const *LOLFX_RESOURCE_NAME(name)
  82. #define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
  83. /* If using NaCl or Android, override main() with our version */
  84. #if defined __native_client__
  85. # define main lol_nacl_main
  86. #elif defined __ANDROID__
  87. # define main lol_android_main
  88. #endif
  89. /* If using SDL on Windows or OS X, let it override main() */
  90. #if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
  91. # include <SDL_main.h>
  92. #endif
  93. // Base types
  94. #include <lol/base/all.h>
  95. #include <lol/math/all.h>
  96. #include <lol/sys/all.h>
  97. #include <lol/gpu/all.h>
  98. #include <lol/image/all.h>
  99. #include <lol/debug/all.h>
  100. #include "numeric.h"
  101. // Static classes
  102. #include "platform.h"
  103. #include "video.h"
  104. #include "audio.h"
  105. #include "scene.h"
  106. #include "profiler.h"
  107. // Input
  108. #include "input/input.h"
  109. #include "input/controller.h"
  110. // Entities
  111. #include "entity.h"
  112. #include "worldentity.h"
  113. #include "camera.h"
  114. #include "light.h"
  115. #include "emitter.h"
  116. #include "font.h"
  117. #include "gradient.h"
  118. #include "sample.h"
  119. #include "sprite.h"
  120. #include "text.h"
  121. #include "tileset.h"
  122. #include "world.h"
  123. // Other objects
  124. #include "dict.h"
  125. #include "map.h"
  126. #include "layer.h"
  127. #include "mesh/mesh.h"
  128. #include "application/application.h"
  129. #include "easymesh/csgbsp.h"
  130. #include "easymesh/easymesh.h"
  131. // Managers
  132. #include "ticker.h"
  133. #include "forge.h"
  134. #include "tiler.h"
  135. #include "sampler.h"
  136. #endif // __LOL_CORE_H__