Physac v1.1 - 2D Physics library for videogames.
DESCRIPTION:
Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop to simulate physics. A physics step contains the following phases: get collision information, apply dynamics, collision solving and position correction. It uses a very simple struct for physic bodies with a position vector to be used in any 3D rendering API.
CONFIGURATION:
#define PHYSAC_IMPLEMENTATION Generates the implementation of the library into the included file. If not defined, the library is in header only mode and can be included in other headers or source files without problems. But only ONE file should hold the implementation.
#define PHYSAC_DEBUG Show debug traces log messages about physic bodies creation/destruction, physic system errors, some calculations results and NULL reference exceptions.
#define PHYSAC_AVOID_TIMMING_SYSTEM Disables internal timming system, used by UpdatePhysics() to launch timmed physic steps, it allows just running UpdatePhysics() automatically on a separate thread at a desired time step. In case physics steps update needs to be controlled by user with a custom timming mechanism, just define this flag and the internal timming mechanism will be avoided, in that case, timming libraries are neither required by the module.
#define PHYSAC_MALLOC() #define PHYSAC_CALLOC() #define PHYSAC_FREE() You can define your own malloc/free implementation replacing stdlib.h malloc()/free() functions. Otherwise it will include stdlib.h and use the C standard library malloc()/free() function.
COMPILATION:
Use the following code to compile with GCC: gcc -o .exe -s -static -lraylib -lopengl32 -lgdi32 -lwinmm -std=c99
VERSIONS HISTORY: 1.1 (20-Jan-2021) @raysan5: Library general revision Removed threading system (up to the user) Support MSVC C++ compilation using CLITERAL() Review DEBUG mechanism for TRACELOG() and all TRACELOG() messages Review internal variables/functions naming for consistency Allow option to avoid internal timming system, to allow app manage the steps 1.0 (12-Jun-2017) First release of the library
LICENSE: zlib/libpng
Copyright (c) 2016-2022 Victor Fisac (@victorfisac) and Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
- The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
- Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
- This notice may not be removed or altered from any source distribution.
Definition at line 86 of file physac.h.