cmdfx 0.3.2
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
engine.hpp
Go to the documentation of this file.
1
11#pragma once
12
13extern "C" {
15}
16
19
20namespace CmdFX
21{
22
26namespace Engine
27{
28int start() {
29 return Engine_start();
30}
31
41std::vector<std::unique_ptr<Sprite>> tick() {
42 CmdFX_Sprite** modifiedSprites = Engine_tick();
43 std::vector<std::unique_ptr<Sprite>> sprites;
44
45 for (int i = 0; modifiedSprites[i] != nullptr; i++) {
46 sprites.emplace_back(std::make_unique<Sprite>(modifiedSprites[i]));
47 }
48
49 return sprites;
50}
51
52void cleanup() {
54}
55
56bool isSpriteStatic(Sprite& sprite) {
57 return Sprite_isStatic(sprite.getSprite()) != 0;
58}
59
60void setSpriteStatic(Sprite& sprite, bool isStatic) {
61 Sprite_setStatic(sprite.getSprite(), isStatic ? 1 : 0);
62}
63
64double getForceOfGravity() {
66}
67
68void setForceOfGravity(double force) {
70}
71
72double getTerminalVelocity() {
74}
75
76void setTerminalVelocity(double velocity) {
78}
79
80int getGroundY() {
81 return Engine_getGroundY();
82}
83
84void setGroundY(int y) {
86}
87
88double getDefaultFrictionCoefficient() {
90}
91
92void setDefaultFrictionCoefficient(double coefficient) {
94}
95
96double getCharacterMass(char c) {
98}
99
100void setCharacterMass(char c, double mass) {
102}
103}; // namespace Engine
104
105} // namespace CmdFX
Global physics engine declarations.
double Engine_getTerminalVelocity()
Gets the terminal velocity, in characters per second.
double Engine_getDefaultFrictionCoefficient()
Gets the default friction coefficient for a sprite.
int Engine_setGroundY(int y)
Sets the Y level of the ground for the physics engine.
double Engine_getCharacterMass(char c)
Gets the default mass of a character.
int Engine_setCharacterMass(char c, double mass)
Sets the default mass of a character.
int Engine_getGroundY()
Gets the Y level of the ground for the physics engine.
int Sprite_isStatic(CmdFX_Sprite *sprite)
Gets whether this sprite is static.
int Engine_cleanup()
Cleans up the physics engine.
int Engine_setTerminalVelocity(double velocity)
Sets the terminal velocity, in characters per second.
int Sprite_setStatic(CmdFX_Sprite *sprite, int isStatic)
Sets whether this sprite is static.
int Engine_setForceOfGravity(double force)
Sets the force of gravity, in characters per second squared.
CmdFX_Sprite ** Engine_tick()
Ticks the physics engine.
double Engine_getForceOfGravity()
Gets the force of gravity, in characters per second squared.
int Engine_start()
Starts up the physics engine.
int Engine_setDefaultFrictionCoefficient(double coefficient)
Sets the default friction coefficient for a sprite.
C++ Extensions for velocity and acceleration functions.
A C++ wrapper around the CmdFX Physics Engine.
Definition engine.hpp:27
std::vector< std::unique_ptr< Sprite > > tick()
Ticks the physics engine and returns modified sprites.
Definition engine.hpp:41
Primary namespace for CmdFX.
Definition cmdfx.hpp:26
C++ Extensions for the CmdFX Sprites API.
Represents a sprite that can be drawn to the terminal.
Definition sprites.h:31