Box2D 3.2.0
A 2D physics engine for games
Loading...
Searching...
No Matches

Base functionality. More...

Data Structures

struct  b2Version
 Version numbering scheme. More...

Macros

#define B2_NULL_INDEX   ( -1 )
 Used to indicate an unset or invalid index value.
#define B2_VERSION_MAJOR   3
 Significant API and behavior changes.
#define B2_VERSION_MINOR   2
 API changes and features.
#define B2_VERSION_REVISION   0
 Bug fixes. No API changes.

Typedefs

typedef void * b2AllocCallbackFcn(size_t size, int alignment)
 Prototype for user allocation function.
typedef void b2FreeCallbackFcn(void *mem, size_t size)
 Prototype for user free function.
typedef int b2AssertCallbackFcn(const char *condition, const char *fileName, int lineNumber)
 Prototype for the user assert callback. Return 0 to skip the debugger break.
typedef void b2LogCallbackFcn(const char *message)
 Prototype for user log callback. Used to log warnings.

Functions

void b2SetAllocator (b2AllocCallbackFcn *allocFcn, b2FreeCallbackFcn *freeFcn)
 This allows the user to override the allocation functions.
size_t b2GetByteCount (void)
void b2SetAssertCallback (b2AssertCallbackFcn *assertFcn)
 Override the default assert function.
void b2SetLogCallback (b2LogCallbackFcn *logFcn)
 Override the default log function.
b2Version b2GetVersion (void)
 Get the current version of Box2D.
bool b2IsDoublePrecision (void)
bool b2IsAVX2Available (void)

Detailed Description

Base functionality.


Data Structure Documentation

◆ b2Version

struct b2Version

Version numbering scheme.

See https://semver.org/

Data Fields
int major Significant changes.
int minor Incremental changes.
int revision Bug fixes.

Typedef Documentation

◆ b2AllocCallbackFcn

typedef void * b2AllocCallbackFcn(size_t size, int alignment)

Prototype for user allocation function.

Parameters
sizethe allocation size in bytes
alignmentthe required alignment, guaranteed to be a power of 2

◆ b2FreeCallbackFcn

typedef void b2FreeCallbackFcn(void *mem, size_t size)

Prototype for user free function.

Parameters
memthe memory previously allocated through b2AllocCallbackFcn
sizethe allocation size in bytes

Function Documentation

◆ b2GetByteCount()

size_t b2GetByteCount ( void )
Returns
the total bytes allocated by Box2D

◆ b2IsAVX2Available()

bool b2IsAVX2Available ( void )
Returns
true if the current CPU has the AVX2 instruction set.

◆ b2IsDoublePrecision()

bool b2IsDoublePrecision ( void )
Returns
true if the library was built with BOX2D_DOUBLE_PRECISION (large world mode)

◆ b2SetAllocator()

void b2SetAllocator ( b2AllocCallbackFcn * allocFcn,
b2FreeCallbackFcn * freeFcn )

This allows the user to override the allocation functions.

These should be set during application startup.

◆ b2SetAssertCallback()

void b2SetAssertCallback ( b2AssertCallbackFcn * assertFcn)

Override the default assert function.

Parameters
assertFcna non-null assert callback

◆ b2SetLogCallback()

void b2SetLogCallback ( b2LogCallbackFcn * logFcn)

Override the default log function.

Parameters
logFcna non-null log callback