cmdfx 0.1.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
mass.h File Reference

Mass-related physics declarations. More...

Go to the source code of this file.

Functions

int Sprite_getDefaultMass (CmdFX_Sprite *sprite)
 Gets the default mass of a sprite.
 
int Sprite_getMass (CmdFX_Sprite *sprite)
 Gets the mass of a sprite.
 
int Sprite_setMass (CmdFX_Sprite *sprite, int mass)
 Sets the mass of a sprite.
 
int Sprite_resetMass (CmdFX_Sprite *sprite)
 Resets the mass of a sprite.
 

Detailed Description

Mass-related physics declarations.

Author
Gregory Mitchell (me@gm.nosp@m.itch.nosp@m.215.x.nosp@m.yz)
Version
0.1.1
Date
2025-02-09

Function Documentation

◆ Sprite_getDefaultMass()

int Sprite_getDefaultMass ( CmdFX_Sprite * sprite)

Gets the default mass of a sprite.

The default 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 sprite.

Parameters
spriteThe sprite to use.
Returns
The default mass of the sprite.

◆ Sprite_getMass()

int Sprite_getMass ( CmdFX_Sprite * sprite)

Gets the mass of a sprite.

This will default to Sprite_getDefaultMass if a custom mass has not been set.

Parameters
spriteThe sprite to use.
Returns
The mass of the sprite.

◆ Sprite_resetMass()

int Sprite_resetMass ( CmdFX_Sprite * sprite)

Resets the mass of a sprite.

This method will reset the mass of a sprite to the default value.

Parameters
spriteThe sprite to use.
Returns
0 if successful, -1 if an error occurred.

◆ Sprite_setMass()

int Sprite_setMass ( CmdFX_Sprite * sprite,
int mass )

Sets the mass of a sprite.

This method can be used to set custom mass values for a sprite. You can still calculate the original value with Sprite_getDefaultMass.

Parameters
spriteThe sprite to use.
massThe mass of the sprite.
Returns
The mass of the sprite.