![]() |
cmdfx 0.2.0
Lightweight game engine for your terminal
|
Force-related physics declarations. More...
Go to the source code of this file.
Functions | |
CmdFX_Vector ** | Sprite_getAllForces (CmdFX_Sprite *sprite) |
Gets all of the forces acting on a sprite. | |
int | Sprite_getAllForcesCount (CmdFX_Sprite *sprite) |
Gets the number of forces acting on a sprite. | |
CmdFX_Vector * | Sprite_getNetForce (CmdFX_Sprite *sprite) |
Gets the net force acting on a sprite. | |
int | Sprite_addForce (CmdFX_Sprite *sprite, CmdFX_Vector *force) |
Adds a force to a sprite. | |
int | Sprite_removeForce (CmdFX_Sprite *sprite, CmdFX_Vector *force) |
Removes a force from a sprite. | |
int | Sprite_removeAllForces (CmdFX_Sprite *sprite) |
Removes all forces from a sprite. | |
int | Sprite_clearAllForces () |
Removes all forces for every sprite and frees the array. | |
double | Sprite_getFrictionCoefficient (CmdFX_Sprite *sprite) |
Gets the friction coefficient of a sprite. | |
int | Sprite_setFrictionCoefficient (CmdFX_Sprite *sprite, double coefficient) |
Sets the friction coefficient of a sprite. | |
int | Sprite_resetFrictionCoefficient (CmdFX_Sprite *sprite) |
Resets the friction coefficient of a sprite. | |
int | Sprite_addForceFor (CmdFX_Sprite *sprite, CmdFX_Vector *force, int duration) |
Adds a temporary force to a sprite. | |
Force-related physics declarations.
int Sprite_addForce | ( | CmdFX_Sprite * | sprite, |
CmdFX_Vector * | force ) |
Adds a force to a sprite.
sprite | The sprite to use. |
force | The force to add. |
int Sprite_addForceFor | ( | CmdFX_Sprite * | sprite, |
CmdFX_Vector * | force, | ||
int | duration ) |
Adds a temporary force to a sprite.
sprite | The sprite to use. |
force | The force to add. |
duration | The duration of the force, in milliseconds. |
int Sprite_clearAllForces | ( | ) |
Removes all forces for every sprite and frees the array.
This will free all forces in the sprite's force array, and then free the array itself.
CmdFX_Vector ** Sprite_getAllForces | ( | CmdFX_Sprite * | sprite | ) |
Gets all of the forces acting on a sprite.
sprite | The sprite to use. |
int Sprite_getAllForcesCount | ( | CmdFX_Sprite * | sprite | ) |
Gets the number of forces acting on a sprite.
sprite | The sprite to use. |
double Sprite_getFrictionCoefficient | ( | CmdFX_Sprite * | sprite | ) |
Gets the friction coefficient of a sprite.
The friction coefficient is a value between 0 and 1 that determines how much a sprite will slow down when moving on the ground.
If the sprite does not have a custom friction coefficient, the default value of Engine_getDefaultFrictionCoefficient
will be returned.
sprite | The sprite to use. |
CmdFX_Vector * Sprite_getNetForce | ( | CmdFX_Sprite * | sprite | ) |
Gets the net force acting on a sprite.
This creates a new vector that is the sum of all the forces acting on the sprite. The vector should be freed after use.
sprite | The sprite to use. |
int Sprite_removeAllForces | ( | CmdFX_Sprite * | sprite | ) |
Removes all forces from a sprite.
Removing all forces will free all forces in the sprite's force array, and then free the array itself.
sprite | The sprite to use. |
int Sprite_removeForce | ( | CmdFX_Sprite * | sprite, |
CmdFX_Vector * | force ) |
Removes a force from a sprite.
The force will be removed if it is found in the sprite's force array and will not be freed.
sprite | The sprite to use. |
force | The force to remove. |
int Sprite_resetFrictionCoefficient | ( | CmdFX_Sprite * | sprite | ) |
Resets the friction coefficient of a sprite.
The friction coefficient will be reset to the default value.
sprite | The sprite to use. |
int Sprite_setFrictionCoefficient | ( | CmdFX_Sprite * | sprite, |
double | coefficient ) |
Sets the friction coefficient of a sprite.
The friction coefficient is a value between 0 and 1 that determines how much a sprite will slow down when moving on the ground.
sprite | The sprite to use. |
coefficient | The friction coefficient to set. |