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.
 
 
 

133 rivejä
3.0 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 isnan() is present even on systems that don't define it, or
  43. * when -ffast-math is being used. */
  44. #include <cmath>
  45. #if defined __FAST_MATH__
  46. # undef isnan
  47. #endif
  48. #if !defined isnan
  49. # define isnan isnan
  50. # include <stdint.h>
  51. static inline int isnan(float f)
  52. {
  53. union { float f; uint32_t x; } u = { f };
  54. return (u.x << 1) > 0xff000000u;
  55. }
  56. #endif
  57. /* External declaration for LolFx files. */
  58. #define LOLFX_RESOURCE_DECLARE(name) \
  59. extern "C" char const *LOLFX_RESOURCE_NAME(name)
  60. #define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
  61. /* If using NaCl or Android, override main() with our version */
  62. #if defined __native_client__
  63. # define main lol_nacl_main
  64. #elif defined __ANDROID__
  65. # define main lol_android_main
  66. #endif
  67. /* If using SDL on Windows or OS X, let it override main() */
  68. #if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
  69. # include <SDL_main.h>
  70. #endif
  71. // Base types
  72. #include <lol/base/base.h>
  73. #include <lol/math/math.h>
  74. #include <lol/sys/sys.h>
  75. #include <lol/image/image.h>
  76. #include <lol/gpu/gpu.h>
  77. #include "numeric.h"
  78. // Static classes
  79. #include "platform.h"
  80. #include "video.h"
  81. #include "audio.h"
  82. #include "scene.h"
  83. #include "input/input.h"
  84. #include "input/keyboard.h"
  85. #include "input/stick.h"
  86. #include "profiler.h"
  87. // Entities
  88. #include "entity.h"
  89. #include "worldentity.h"
  90. #include "camera.h"
  91. #include "light.h"
  92. #include "emitter.h"
  93. #include "font.h"
  94. #include "gradient.h"
  95. #include "sample.h"
  96. #include "sprite.h"
  97. #include "text.h"
  98. #include "tileset.h"
  99. #include "world.h"
  100. // Other objects
  101. #include "dict.h"
  102. #include "map.h"
  103. #include "layer.h"
  104. #include "mesh/mesh.h"
  105. #include "image/image.h"
  106. #include "application/application.h"
  107. #include "easymesh/csgbsp.h"
  108. #include "easymesh/easymesh.h"
  109. // Managers
  110. #include "ticker.h"
  111. #include "forge.h"
  112. #include "tiler.h"
  113. #include "sampler.h"
  114. #endif // __LOL_CORE_H__