| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box2D.Base
Description
Low-level bindings to box2d/base.h: version info, global allocator /
assert / log hooks, and timing helpers.
Synopsis
- data Version = Version {}
- getVersion :: IO Version
- isDoublePrecision :: IO Bool
- type AllocFcn = CSize -> CInt -> IO (Ptr ())
- type FreeFcn = Ptr () -> CSize -> IO ()
- setAllocator :: FunPtr AllocFcn -> FunPtr FreeFcn -> IO ()
- getByteCount :: IO Int64
- type AssertFcn = CString -> CString -> CInt -> IO CInt
- type LogFcn = CString -> IO ()
- setAssertFcn :: FunPtr AssertFcn -> IO ()
- setLogFcn :: FunPtr LogFcn -> IO ()
- getTicks :: IO Word64
- getMilliseconds :: Word64 -> IO CFloat
- getMillisecondsAndReset :: Ptr Word64 -> IO CFloat
- yield :: IO ()
- hash :: Word32 -> Ptr Word8 -> CInt -> IO Word32
Version
Version numbering scheme, see https://semver.org/.
Constructors
| Version | |
Fields
| |
Instances
| Storable Version Source # | |
| Show Version Source # | |
| Eq Version Source # | |
getVersion :: IO Version Source #
Get the current version of Box2D.
Allocator
type AllocFcn = CSize -> CInt -> IO (Ptr ()) Source #
User allocation function: void* (size_t size, int alignment).
setAllocator :: FunPtr AllocFcn -> FunPtr FreeFcn -> IO () Source #
Override the default allocation functions. Set during application startup.
The FunPtrs must point to C functions: the engine calls the hooks from
inside unsafe FFI calls, where re-entering Haskell is undefined
behaviour, so wrapping Haskell functions is not supported yet.
getByteCount :: IO Int64 Source #
Total bytes allocated by Box2D.
Assert / log hooks
type AssertFcn = CString -> CString -> CInt -> IO CInt Source #
Assert callback: int (const char* condition, const char* file, int line).
Return 0 to skip the debugger break.
setAssertFcn :: FunPtr AssertFcn -> IO () Source #
Override the default assert callback. Must point to a C function, see
setAllocator.
setLogFcn :: FunPtr LogFcn -> IO () Source #
Override the default logging callback. Must point to a C function, see
setAllocator.