![]() |
cmdfx 1.0.1
Lightweight game engine for your terminal
|
A C++ wrapper around the CmdFX Physics Engine. More...
Functions | |
| int | start () |
| std::vector< std::unique_ptr< Sprite > > | tick () |
| Ticks the physics engine and returns modified sprites. | |
| void | cleanup () |
| int | end () |
| bool | isSpriteStatic (Sprite &sprite) |
| void | setSpriteStatic (Sprite &sprite, bool isStatic) |
| double | getForceOfGravity () |
| void | setForceOfGravity (double force) |
| double | getTerminalVelocity () |
| void | setTerminalVelocity (double velocity) |
| int | getGroundY () |
| void | setGroundY (int y) |
| double | getDefaultFrictionCoefficient () |
| void | setDefaultFrictionCoefficient (double coefficient) |
| double | getCharacterMass (char c) |
| void | setCharacterMass (char c, double mass) |
| bool | isMotionDebugEnabled () |
| Checks if motion debugging is enabled. | |
| void | enableMotionDebug () |
| Enables motion debugging. | |
| void | disableMotionDebug () |
| Disables motion debugging. | |
| void | applyMotion (Sprite &sprite) |
| Applies the motion of a sprite. | |
| void | applyMotion (const std::unique_ptr< Sprite > &sprite) |
| void CmdFX::Engine::applyMotion | ( | Sprite & | sprite | ) |
Applies the motion of a sprite.
This method applies the motion of a sprite by updating its position based on its velocity and acceleration. The motion is applied in the opposite direction of the Y axis, so the sprite will move up when the Y velocity is positive and down when the Y velocity is negative.
| sprite | The sprite to use. |
| void CmdFX::Engine::enableMotionDebug | ( | ) |
Enables motion debugging.
This method enables motion debugging, which will print all sprite motion updates to the console at (3, <sprite id + 1>).
| bool CmdFX::Engine::isMotionDebugEnabled | ( | ) |
Checks if motion debugging is enabled.
If motion debugging is enabled, the physics engine will print all sprite motion updates to the console at (3, <sprite id + 1>).
| std::vector< std::unique_ptr< Sprite > > CmdFX::Engine::tick | ( | ) |
Ticks the physics engine and returns modified sprites.
This method ticks the physics engine, which processes all sprites and applies physics calculations to them. It returns a vector of unique_ptr<Sprite> objects that were modified during the tick.