source: trunk/src/core.h @ 2394

Last change on this file since 2394 was 2354, checked in by sam, 7 years ago

base: move headers around and promote gpu/ to lol/gpu/.

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
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//
12// The main header
13// ---------------
14//
15
16#if !defined __LOL_CORE_H__
17#define __LOL_CORE_H__
18
19// CPU features
20#undef LOL_FEATURE_CHEAP_BRANCHES
21#undef LOL_FEATURE_VERY_CHEAP_BRANCHES
22
23#if !defined __CELLOS_LV2__
24#   define LOL_FEATURE_CHEAP_BRANCHES
25#endif
26
27// Optimisation helpers
28#if defined __GNUC__
29#   define __likely(x)   __builtin_expect(!!(x), 1)
30#   define __unlikely(x) __builtin_expect(!!(x), 0)
31#   define INLINEATTR __attribute__((always_inline))
32#   if defined __CELLOS_LV2__ && !defined __SNC__
33#      define FP_USE(x) __asm__("" : "+f" (x))
34#   elif defined __x86_64__
35#      define FP_USE(x) __asm__("" : "+x" (x))
36#   elif defined __i386__ /* FIXME: this isn't good */
37#      define FP_USE(x) __asm__("" : "+m" (x))
38#   else
39#      define FP_USE(x) (void)(x)
40#   endif
41#else
42#   define __likely(x)   x
43#   define __unlikely(x) x
44#   define INLINEATTR
45#   define FP_USE(x) (void)(x)
46#endif
47
48/* Ensure isnan() is present even on systems that don't define it, or
49 * when -ffast-math is being used. */
50#include <cmath>
51#if defined __FAST_MATH__
52#   undef isnan
53#endif
54#if !defined isnan
55#   define isnan isnan
56#   include <stdint.h>
57static inline int isnan(float f)
58{
59    union { float f; uint32_t x; } u = { f };
60    return (u.x << 1) > 0xff000000u;
61}
62#endif
63
64/* External declaration for LolFx files. */
65#define LOLFX_RESOURCE_DECLARE(name) \
66    extern "C" char const *LOLFX_RESOURCE_NAME(name)
67#define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
68
69/* If using NaCl or Android, override main() with our version */
70#if defined __native_client__
71#   define main lol_nacl_main
72#elif defined __ANDROID__
73#   define main lol_android_main
74#endif
75
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
81// Base types
82#include <lol/base/base.h>
83#include <lol/math/math.h>
84#include <lol/sys/sys.h>
85#include <lol/image/image.h>
86#include <lol/gpu/gpu.h>
87
88#include "numeric.h"
89
90// Static classes
91#include "platform.h"
92#include "video.h"
93#include "audio.h"
94#include "scene.h"
95#include "input/input.h"
96#include "input/keyboard.h"
97#include "input/stick.h"
98#include "profiler.h"
99
100// Entities
101#include "entity.h"
102#include "worldentity.h"
103
104#include "camera.h"
105#include "light.h"
106#include "emitter.h"
107#include "font.h"
108#include "gradient.h"
109#include "sample.h"
110#include "sprite.h"
111#include "text.h"
112#include "tileset.h"
113#include "world.h"
114
115// Other objects
116#include "dict.h"
117#include "map.h"
118#include "layer.h"
119#include "mesh/mesh.h"
120#include "image/image.h"
121#include "application/application.h"
122#include "easymesh/csgbsp.h"
123#include "easymesh/easymesh.h"
124
125// Managers
126#include "ticker.h"
127#include "forge.h"
128#include "tiler.h"
129#include "sampler.h"
130
131#endif // __LOL_CORE_H__
132
Note: See TracBrowser for help on using the repository browser.