source: trunk/src/core.h @ 2506

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

base: start removing occurrences of NULL on our long journey to nullptr.

  • Property svn:keywords set to Id
File size: 3.2 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
49/* Ensure we have nullptr */
50#if defined nullptr
51    /* do nothing */
52#elif defined __GNUC__
53#   define nullptr __null
54#else
55#   include <cstddef>
56#   define nullptr NULL
57#endif
58
59
60/* Ensure isnan() is present even on systems that don't define it, or
61 * when -ffast-math is being used. */
62#include <cmath>
63#if defined __FAST_MATH__
64#   undef isnan
65#endif
66#if !defined isnan
67#   define isnan isnan
68#   include <stdint.h>
69static inline int isnan(float f)
70{
71    union { float f; uint32_t x; } u = { f };
72    return (u.x << 1) > 0xff000000u;
73}
74#endif
75
76/* External declaration for LolFx files. */
77#define LOLFX_RESOURCE_DECLARE(name) \
78    extern "C" char const *LOLFX_RESOURCE_NAME(name)
79#define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
80
81/* If using NaCl or Android, override main() with our version */
82#if defined __native_client__
83#   define main lol_nacl_main
84#elif defined __ANDROID__
85#   define main lol_android_main
86#endif
87
88/* If using SDL on Windows or OS X, let it override main() */
89#if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
90#   include <SDL_main.h>
91#endif
92
93// Base types
94#include <lol/base/base.h>
95#include <lol/math/math.h>
96#include <lol/sys/sys.h>
97#include <lol/image/image.h>
98#include <lol/gpu/gpu.h>
99#include <lol/debug/debug.h>
100
101#include "numeric.h"
102
103// Static classes
104#include "platform.h"
105#include "video.h"
106#include "audio.h"
107#include "scene.h"
108#include "input/input.h"
109#include "input/keyboard.h"
110#include "input/stick.h"
111#include "profiler.h"
112
113// Entities
114#include "entity.h"
115#include "worldentity.h"
116
117#include "camera.h"
118#include "light.h"
119#include "emitter.h"
120#include "font.h"
121#include "gradient.h"
122#include "sample.h"
123#include "sprite.h"
124#include "text.h"
125#include "tileset.h"
126#include "world.h"
127
128// Other objects
129#include "dict.h"
130#include "map.h"
131#include "layer.h"
132#include "mesh/mesh.h"
133#include "image/image.h"
134#include "application/application.h"
135#include "easymesh/csgbsp.h"
136#include "easymesh/easymesh.h"
137
138// Managers
139#include "ticker.h"
140#include "forge.h"
141#include "tiler.h"
142#include "sampler.h"
143
144#endif // __LOL_CORE_H__
145
Note: See TracBrowser for help on using the repository browser.