![]() |
cmdfx 0.1.1
Lightweight game engine for your terminal
|
Global physics engine declarations. More...
#include "cmdfx/core/sprites.h"
Go to the source code of this file.
Functions | |
int | Sprite_isStatic (CmdFX_Sprite *sprite) |
Gets whether this sprite is static. | |
int | Sprite_setStatic (CmdFX_Sprite *sprite, int isStatic) |
Sets whether this sprite is static. | |
int | Engine_getForceOfGravity () |
Gets the force of gravity, in characters per second squared. | |
int | Engine_setForceOfGravity (int force) |
Sets the force of gravity, in characters per second squared. | |
int | Engine_getTerminalVelocity () |
Gets the terminal velocity, in characters per second. | |
int | Engine_setTerminalVelocity (int velocity) |
Sets the terminal velocity, in characters per second. | |
int | Engine_getGroundY () |
Gets the Y level of the ground for the physics engine. | |
int | Engine_setGroundY (int y) |
Sets the Y level of the ground for the physics engine. | |
double | Engine_getDefaultFrictionCoefficient () |
Gets the default friction coefficient for a sprite. | |
int | Engine_setDefaultFrictionCoefficient (double coefficient) |
Sets the default friction coefficient for a sprite. | |
int | Engine_getCharacterMass (char c) |
Gets the default mass of a character. | |
int | Engine_setCharacterMass (char c, int mass) |
Sets the default mass of a character. | |
int | Engine_start () |
Starts up the physics engine. | |
void | Engine_tick () |
Ticks the physics engine. | |
int | Engine_cleanup () |
Cleans up the physics engine. | |
int | Engine_end () |
Stops the physics engine. | |
Global physics engine declarations.
int Engine_cleanup | ( | ) |
Cleans up the physics engine.
This is different from Engine_end
, in that it claens up any loose variables before stopping the engine. This is automatically called by Engine_end
and is not intended to be called independently to avoid undefined behavior.
int Engine_end | ( | ) |
Stops the physics engine.
int Engine_getCharacterMass | ( | char | c | ) |
Gets the default mass of a character.
The mass of a sprite is calculated by the number of non-whitespace characters in a sprite map. ANSI codes have no effect on the mass of a character.
You can modify the output value of Sprite_getDefaultMass
by changing the default mass of a character. Every character by default has a mass of 1.
double Engine_getDefaultFrictionCoefficient | ( | ) |
Gets the default friction coefficient for a sprite.
The default friction coefficient is a value between 0 and 1 that determines how much friction is applied to a sprite. A value of 0 means no friction, while a value of 1 means full friction, meaning it will stop immediately.
The default value is 0.25.
int Engine_getForceOfGravity | ( | ) |
Gets the force of gravity, in characters per second squared.
This method returns the force of gravity, in characters per second squared. The default value is 1 c/s^2.
int Engine_getGroundY | ( | ) |
Gets the Y level of the ground for the physics engine.
The default value is the canvas height. The Y level of the ground helps determine when a sprite has landed on the ground.
int Engine_getTerminalVelocity | ( | ) |
Gets the terminal velocity, in characters per second.
This method returns the terminal velocity, in characters per second. The default value is 10 c/s.
int Engine_setCharacterMass | ( | char | c, |
int | mass ) |
Sets the default mass of a character.
The mass of a sprite is calculated by the number of non-whitespace characters in a sprite map. ANSI codes have no effect on the mass of a character.
You can modify the output value of Sprite_getDefaultMass
by changing the default mass of a character. Every character by default has a mass of 1.
c | The character to set the mass of. |
mass | The default mass of the character. |
int Engine_setDefaultFrictionCoefficient | ( | double | coefficient | ) |
Sets the default friction coefficient for a sprite.
The default friction coefficient is a value between 0 and 1 that determines how much friction is applied to a sprite. A value of 0 means no friction, while a value of 1 means full friction, meaning it will stop immediately.
The default value is 0.25.
coefficient | The default friction coefficient. |
int Engine_setForceOfGravity | ( | int | force | ) |
Sets the force of gravity, in characters per second squared.
This method sets the force of gravity, in characters per second squared. The default value is 1 c/s^2.
force | The force of gravity, in c/s^2. |
int Engine_setGroundY | ( | int | y | ) |
Sets the Y level of the ground for the physics engine.
The default value is the canvas height. The Y level of the ground helps determine when a sprite has landed on the ground.
y | The Y level of the ground. |
int Engine_setTerminalVelocity | ( | int | velocity | ) |
Sets the terminal velocity, in characters per second.
This method sets the terminal velocity, in characters per second. The default value is 10 c/s.
velocity |
int Engine_start | ( | ) |
Starts up the physics engine.
void Engine_tick | ( | ) |
Ticks the physics engine.
This method ticks the physcis engine, if it is running. This is automatically called once per frame.
int Sprite_isStatic | ( | CmdFX_Sprite * | sprite | ) |
Gets whether this sprite is static.
A sprite is static if it is not affected by the physics engine.
sprite | The sprite to check. |
int Sprite_setStatic | ( | CmdFX_Sprite * | sprite, |
int | isStatic ) |
Sets whether this sprite is static.
A sprite is static if it is not affected by the physics engine. Use this method to set whether a sprite is static or not.
sprite | The sprite to modify. |
isStatic | 1 if the sprite is static, 0 otherwise. |