externals
box2d
src
common
b2_settings.cpp
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
#define _CRT_SECURE_NO_WARNINGS
24
25
#include "
box2d/b2_settings.h
"
26
#include <stdio.h>
27
#include <stdarg.h>
28
#include <stdlib.h>
29
30
b2Version
b2_version
= {2, 4, 0};
31
32
// Memory allocators. Modify these to use your own allocator.
33
void
*
b2Alloc_Default
(
int32
size)
34
{
35
return
malloc(size);
36
}
37
38
void
b2Free_Default
(
void
* mem)
39
{
40
free(mem);
41
}
42
43
// You can modify this to use your logging facility.
44
void
b2Log_Default
(
const
char
*
string
, va_list
args
)
45
{
46
vprintf(
string
,
args
);
47
}
48
49
FILE*
b2_dumpFile
=
nullptr
;
50
51
void
b2OpenDump
(
const
char
*
fileName
)
52
{
53
b2Assert
(
b2_dumpFile
==
nullptr
);
54
b2_dumpFile
= fopen(
fileName
,
"w"
);
55
}
56
57
void
b2Dump
(
const
char
*
string
, ...)
58
{
59
if
(
b2_dumpFile
==
nullptr
)
60
{
61
return
;
62
}
63
64
va_list
args
;
65
va_start(
args
,
string
);
66
vfprintf(
b2_dumpFile
,
string
,
args
);
67
va_end(
args
);
68
}
69
70
void
b2CloseDump
()
71
{
72
fclose(
b2_dumpFile
);
73
b2_dumpFile
=
nullptr
;
74
}
fileName
static const char * fileName
Definition:
settings.cpp:28
b2_settings.h
b2OpenDump
void b2OpenDump(const char *fileName)
Dump to a file. Only one dump file allowed at a time.
Definition:
b2_settings.cpp:51
b2Version
Definition:
b2_common.h:128
b2Log_Default
void b2Log_Default(const char *string, va_list args)
Default logging function.
Definition:
b2_settings.cpp:44
simple-obstacle-avoidance.args
args
Definition:
simple-obstacle-avoidance.py:38
b2Free_Default
void b2Free_Default(void *mem)
Definition:
b2_settings.cpp:38
b2_version
b2Version b2_version
Current version.
Definition:
b2_settings.cpp:30
b2Dump
void b2Dump(const char *string,...)
Definition:
b2_settings.cpp:57
b2CloseDump
void b2CloseDump()
Definition:
b2_settings.cpp:70
b2Alloc_Default
void * b2Alloc_Default(int32 size)
Default allocation functions.
Definition:
b2_settings.cpp:33
b2_dumpFile
FILE * b2_dumpFile
Definition:
b2_settings.cpp:49
int32
signed int int32
Definition:
b2_types.h:28
args
b2Assert
#define b2Assert(A)
Definition:
b2_common.h:37
mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:07