/
Core.h
97 lines (88 loc) · 2.44 KB
/
Core.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef CC_CORE_H
#define CC_CORE_H
/* Core fixed-size integer and floating point types, and common small structs.
Copyright 2017 ClassicalSharp | Licensed under BSD-3
*/
#if _MSC_VER
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
#define NOINLINE_ __declspec(noinline)
#define ALIGN_HINT_(x) /* TODO: Why does this cause LNK2005 errors */
#define EXPORT_ __declspec(dllexport, noinline)
#elif __GNUC__
#include <stdint.h>
#define NOINLINE_ __attribute__((noinline))
#define ALIGN_HINT_(x) __attribute__((aligned(x)))
#define EXPORT_ __attribute__((visibility("default"), noinline))
#else
#error "I don't recognise this compiler. You'll need to add required definitions in Core.h!"
#endif
typedef uint16_t Codepoint;
typedef uint8_t bool;
#define true 1
#define false 0
#define NULL ((void*)0)
#define EXTENDED_BLOCKS
#ifdef EXTENDED_BLOCKS
typedef uint16_t BlockID;
#else
typedef uint8_t BlockID;
#endif
#define EXTENDED_TEXTURES
#ifdef EXTENDED_TEXTURES
typedef uint16_t TextureLoc;
#else
typedef uint8_t TextureLoc;
#endif
typedef uint8_t BlockRaw;
typedef uint8_t EntityID;
typedef uint8_t Face;
typedef uint32_t ReturnCode;
typedef uint64_t TimeMS;
typedef struct Rect2D_ { int X, Y, Width, Height; } Rect2D;
typedef struct Point2D_ { int X, Y; } Point2D;
typedef struct Size2D_ { int Width, Height; } Size2D;
typedef struct FontDesc_ { void* Handle; uint16_t Size, Style; } FontDesc;
typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
typedef struct Bitmap_ { uint8_t* Scan0; int Width, Height; } Bitmap;
/*#define CC_BUILD_GL11*/
/*#define CC_BUILD_SOLARIS*/
#ifndef CC_BUILD_MANUAL
#ifdef _WIN32
#define CC_BUILD_D3D9
#define CC_BUILD_WIN
#endif
#ifdef __linux__
#define CC_BUILD_NIX
#define CC_BUILD_POSIX
#define CC_BUILD_X11
#endif
#ifdef __APPLE__
#define CC_BUILD_OSX
#define CC_BUILD_POSIX
#endif
#ifdef __sun__
#define CC_BUILD_SOLARIS
#define CC_BUILD_POSIX
#define CC_BUILD_X11
#endif
#endif
#ifdef CC_BUILD_D3D9
typedef void* GfxResourceID;
#define GFX_NULL NULL
#else
typedef uint32_t GfxResourceID;
#define GFX_NULL 0
#endif
#endif