File Physics2D.c
FileList > engine > src > gameframework > layers > Game2D > Physics2D.c
Go to the source code of this file
#include "Physics2D.h"#include "box2d/box2d.h"#include "ObjectPool.h"#include "Game2DLayer.h"#include "AssertLib.h"#include "GameFramework.h"#include "Entities.h"
Classes
| Type | Name |
|---|---|
| struct | Body2D |
| struct | Phys2dWorld |
Public Functions
| Type | Name |
|---|---|
| void | Ph_DestroyBody (H2DBody body) |
| H2DBody | Ph_GetDynamicBody (HPhysicsWorld world, struct PhysicsShape2D * pShape, struct KinematicBodyOptions * pOptions, struct Transform2D * pTransform, HEntity2D entity, bool bIsSensor, int entityComponentIndex, bool bGenerateSensorEvents) |
| void | Ph_GetDynamicBodyPosition (H2DBody hBody, vec2 outPos) |
| void | Ph_GetDynamicBodyVelocity (H2DBody hBody, vec2 outVelocity) |
| HPhysicsWorld | Ph_GetPhysicsWorld (float gravityX, float gravityY, float pixelsPerMeter) |
| float | Ph_GetPixelsPerMeter (HPhysicsWorld world) |
| H2DBody | Ph_GetStaticBody2D (HPhysicsWorld world, struct PhysicsShape2D * pShape, struct Transform2D * pTransform, HEntity2D entity, bool bIsSensor, int entityComponentIndex, bool bGenerateSensorEvents) |
| void | Ph_Init () |
| u64 | Ph_PackShapeUserData (HEntity2D hEnt, u16 componentIndex, u16 bodyType) |
| void | Ph_PhysicsCoords2PixelCoords (HPhysicsWorld world, vec2 inPhysicsCoords, vec2 outPixelCoords) |
| void | Ph_PhysicsWorldDoCollisionEvents (struct GameFrameworkLayer * pLayer) |
| void | Ph_PhysicsWorldStep (HPhysicsWorld hWorld, float timestep, int substepCount) |
| void | Ph_PixelCoords2PhysicsCoords (HPhysicsWorld world, vec2 inPixelCoords, vec2 outPhysicsCoords) |
| void | Ph_SetDynamicBodyPosition (H2DBody hBody, vec2 inPos) |
| void | Ph_SetDynamicBodyVelocity (H2DBody hBody, vec2 velocity) |
| void | Ph_UnpackShapeUserData (void * pUserData, HEntity2D * pOutEnt, u16 * pOutCompIndex, u16 * pOutBodyType) |
Public Static Functions
| Type | Name |
|---|---|
| H2DBody | GetBody (HPhysicsWorld world, struct PhysicsShape2D * pShape, struct Transform2D * pTransform, b2BodyType type, HEntity2D entity, bool bIsSensor, int entityComponentIndex, bool bEnableSensorEvents) |
| static | OBJECT_POOL (struct Phys2dWorld) |
Public Functions Documentation
function Ph_DestroyBody
void Ph_DestroyBody (
H2DBody body
)
function Ph_GetDynamicBody
H2DBody Ph_GetDynamicBody (
HPhysicsWorld world,
struct PhysicsShape2D * pShape,
struct KinematicBodyOptions * pOptions,
struct Transform2D * pTransform,
HEntity2D entity,
bool bIsSensor,
int entityComponentIndex,
bool bGenerateSensorEvents
)
function Ph_GetDynamicBodyPosition
void Ph_GetDynamicBodyPosition (
H2DBody hBody,
vec2 outPos
)
function Ph_GetDynamicBodyVelocity
void Ph_GetDynamicBodyVelocity (
H2DBody hBody,
vec2 outVelocity
)
function Ph_GetPhysicsWorld
HPhysicsWorld Ph_GetPhysicsWorld (
float gravityX,
float gravityY,
float pixelsPerMeter
)
function Ph_GetPixelsPerMeter
float Ph_GetPixelsPerMeter (
HPhysicsWorld world
)
function Ph_GetStaticBody2D
H2DBody Ph_GetStaticBody2D (
HPhysicsWorld world,
struct PhysicsShape2D * pShape,
struct Transform2D * pTransform,
HEntity2D entity,
bool bIsSensor,
int entityComponentIndex,
bool bGenerateSensorEvents
)
function Ph_Init
void Ph_Init ()
function Ph_PackShapeUserData
u64 Ph_PackShapeUserData (
HEntity2D hEnt,
u16 componentIndex,
u16 bodyType
)
function Ph_PhysicsCoords2PixelCoords
void Ph_PhysicsCoords2PixelCoords (
HPhysicsWorld world,
vec2 inPhysicsCoords,
vec2 outPixelCoords
)
function Ph_PhysicsWorldDoCollisionEvents
void Ph_PhysicsWorldDoCollisionEvents (
struct GameFrameworkLayer * pLayer
)
function Ph_PhysicsWorldStep
void Ph_PhysicsWorldStep (
HPhysicsWorld hWorld,
float timestep,
int substepCount
)
function Ph_PixelCoords2PhysicsCoords
void Ph_PixelCoords2PhysicsCoords (
HPhysicsWorld world,
vec2 inPixelCoords,
vec2 outPhysicsCoords
)
function Ph_SetDynamicBodyPosition
void Ph_SetDynamicBodyPosition (
H2DBody hBody,
vec2 inPos
)
function Ph_SetDynamicBodyVelocity
void Ph_SetDynamicBodyVelocity (
H2DBody hBody,
vec2 velocity
)
function Ph_UnpackShapeUserData
void Ph_UnpackShapeUserData (
void * pUserData,
HEntity2D * pOutEnt,
u16 * pOutCompIndex,
u16 * pOutBodyType
)
Public Static Functions Documentation
function GetBody
static H2DBody GetBody (
HPhysicsWorld world,
struct PhysicsShape2D * pShape,
struct Transform2D * pTransform,
b2BodyType type,
HEntity2D entity,
bool bIsSensor,
int entityComponentIndex,
bool bEnableSensorEvents
)
function OBJECT_POOL
static static OBJECT_POOL (
struct Phys2dWorld
)
The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/src/gameframework/layers/Game2D/Physics2D.c