arbitrary config.h update and proper compensation for framerate in gravity acceleration

This commit is contained in:
Ole Morud
2022-06-08 18:50:10 +02:00
parent ecd1d2469e
commit b5b822d5ad
2 changed files with 10 additions and 10 deletions

View File

@@ -4,11 +4,11 @@
#define ON 'x' #define ON 'x'
#define OFF '.' #define OFF ' '
#define HEIGHT 40 #define HEIGHT 100
#define WIDTH 40 #define WIDTH 100
#define FRAMERATE 60 #define FRAMERATE 60
#define GRAVITY 0.001f #define GRAVITY 15.0f
#define LINENUMBERS 0 #define LINENUMBERS 1
#endif #endif

View File

@@ -56,19 +56,19 @@ int main(){
// Add 4 points, link them, and add points and links to respective arrays // Add 4 points, link them, and add points and links to respective arrays
Point a = { 10.0, 10.0, Point a = { 10.0, 10.0,
11.0, 10.0, 11.0, 10.0,
0.0, GRAVITY/FRAMERATE}; 0.0, GRAVITY/(FRAMERATE*FRAMERATE)};
Point b = { 20.0, 10.0, Point b = { 20.0, 10.0,
20.0, 10.0, 20.0, 10.0,
0.0, GRAVITY/FRAMERATE}; 0.0, GRAVITY/(FRAMERATE*FRAMERATE)};
Point c = { 20.0, 20.0, Point c = { 20.0, 20.0,
19.0, 20.0, 19.0, 20.0,
0.0, GRAVITY/FRAMERATE}; 0.0, GRAVITY/(FRAMERATE*FRAMERATE)};
Point d = { 10.0, 20.0, Point d = { 10.0, 20.0,
10.0, 20.0, 10.0, 20.0,
0.0, GRAVITY/FRAMERATE}; 0.0, GRAVITY/(FRAMERATE*FRAMERATE)};
Link *l_ab = link_points(&a, &b); Link *l_ab = link_points(&a, &b);
Link *l_bc = link_points(&b, &c); Link *l_bc = link_points(&b, &c);
@@ -83,7 +83,7 @@ int main(){
while(1){ while(1){
// clear canvas, calculate next frame and draw // clear canvas, calculate next frame and draw
memset(cnv.data, '.', cnv.x * cnv.y); memset(cnv.data, OFF, cnv.x * cnv.y);
for(int i=0; i<6; i++) for(int i=0; i<6; i++)