Box2D
2.4.1
A 2D physics engine for games
Toggle main menu visibility
Loading...
Searching...
No Matches
b2_settings.h
Go to the documentation of this file.
1
// MIT License
2
3
// Copyright (c) 2019 Erin Catto
4
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#ifndef B2_SETTINGS_H
24
#define B2_SETTINGS_H
25
26
#include "b2_types.h"
27
#include "b2_api.h"
28
32
34
#ifdef B2_USER_SETTINGS
35
38
#include "b2_user_settings.h"
39
40
#else
41
42
#include <stdarg.h>
43
#include <stdint.h>
44
45
// Tunable Constants
46
49
#define b2_lengthUnitsPerMeter 1.0f
50
53
#define b2_maxPolygonVertices 8
54
55
// User data
56
58
struct
B2_API b2BodyUserData
59
{
60
b2BodyUserData()
61
{
62
pointer
= 0;
63
}
64
66
uintptr_t
pointer
;
67
};
68
70
struct
B2_API b2FixtureUserData
71
{
72
b2FixtureUserData()
73
{
74
pointer
= 0;
75
}
76
78
uintptr_t
pointer
;
79
};
80
82
struct
B2_API b2JointUserData
83
{
84
b2JointUserData()
85
{
86
pointer
= 0;
87
}
88
90
uintptr_t
pointer
;
91
};
92
93
// Memory Allocation
94
96
B2_API
void
*
b2Alloc_Default
(int32 size);
97
B2_API
void
b2Free_Default(
void
* mem);
98
100
inline
void
*
b2Alloc
(int32 size)
101
{
102
return
b2Alloc_Default
(size);
103
}
104
106
inline
void
b2Free
(
void
* mem)
107
{
108
b2Free_Default(mem);
109
}
110
112
B2_API
void
b2Log_Default
(
const
char
*
string
, va_list args);
113
115
inline
void
b2Log
(
const
char
*
string
, ...)
116
{
117
va_list args;
118
va_start(args,
string
);
119
b2Log_Default
(
string
, args);
120
va_end(args);
121
}
122
123
#endif
// B2_USER_SETTINGS
124
125
#include "
b2_common.h
"
126
127
#endif
b2_common.h
b2Alloc_Default
B2_API void * b2Alloc_Default(int32 size)
Default allocation functions.
b2Free
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition
b2_settings.h:106
b2Log_Default
B2_API void b2Log_Default(const char *string, va_list args)
Default logging function.
b2Alloc
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition
b2_settings.h:100
b2Log
void b2Log(const char *string,...)
Implement this to use your own logging.
Definition
b2_settings.h:115
b2BodyUserData::pointer
uintptr_t pointer
For legacy compatibility.
Definition
b2_settings.h:66
b2FixtureUserData::pointer
uintptr_t pointer
For legacy compatibility.
Definition
b2_settings.h:78
b2JointUserData::pointer
uintptr_t pointer
For legacy compatibility.
Definition
b2_settings.h:90
include
box2d
b2_settings.h
Generated by
1.18.0