box2d 3.0.0
A 2D physics engine for games
 
Loading...
Searching...
No Matches
api.h
1// SPDX-FileCopyrightText: 2023 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include <stdint.h>
7
8#ifdef __cplusplus
9#define BOX2D_CPP extern "C"
10#else
11#define BOX2D_CPP
12#endif
13
14#if defined(_WIN32) && defined(BOX2D_BUILD_DLL)
15// Building Box2D as a DLL
16#define BOX2D_API BOX2D_CPP __declspec(dllexport)
17#elif defined(_WIN32) && defined(BOX2D_DLL)
18// Using Box2D as a DLL
19#define BOX2D_API BOX2D_CPP __declspec(dllimport)
20#elif defined(__GNUC__) && defined(BOX2D_BUILD_DLL)
21// Building Box2D as a shared library
22#define BOX2D_API BOX2D_CPP __attribute__((visibility("default")))
23#else
24#define BOX2D_API BOX2D_CPP
25#endif
26
30typedef void* b2AllocFcn(uint32_t size, int32_t alignment);
31
34typedef void b2FreeFcn(void* mem);
35
38BOX2D_API void b2SetAllocator(b2AllocFcn* allocFcn, b2FreeFcn* freeFcn);
39
41BOX2D_API uint32_t b2GetByteCount(void);
42
44typedef int b2AssertFcn(const char* condition, const char* fileName, int lineNumber);
45
48BOX2D_API void b2SetAssertFcn(b2AssertFcn* assertFcn);