From b5b822d5ad858abb950705a7bdd43eeb9e0b933b Mon Sep 17 00:00:00 2001 From: Ole Morud Date: Wed, 8 Jun 2022 18:50:10 +0200 Subject: [PATCH] arbitrary config.h update and proper compensation for framerate in gravity acceleration --- config.h | 10 +++++----- physics.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config.h b/config.h index 0c87a04..c3c6ebd 100644 --- a/config.h +++ b/config.h @@ -4,11 +4,11 @@ #define ON 'x' -#define OFF '.' -#define HEIGHT 40 -#define WIDTH 40 +#define OFF ' ' +#define HEIGHT 100 +#define WIDTH 100 #define FRAMERATE 60 -#define GRAVITY 0.001f -#define LINENUMBERS 0 +#define GRAVITY 15.0f +#define LINENUMBERS 1 #endif diff --git a/physics.c b/physics.c index 7219ba4..54fe277 100644 --- a/physics.c +++ b/physics.c @@ -56,19 +56,19 @@ int main(){ // Add 4 points, link them, and add points and links to respective arrays Point a = { 10.0, 10.0, 11.0, 10.0, - 0.0, GRAVITY/FRAMERATE}; + 0.0, GRAVITY/(FRAMERATE*FRAMERATE)}; Point b = { 20.0, 10.0, 20.0, 10.0, - 0.0, GRAVITY/FRAMERATE}; + 0.0, GRAVITY/(FRAMERATE*FRAMERATE)}; Point c = { 20.0, 20.0, 19.0, 20.0, - 0.0, GRAVITY/FRAMERATE}; + 0.0, GRAVITY/(FRAMERATE*FRAMERATE)}; Point d = { 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_bc = link_points(&b, &c); @@ -83,7 +83,7 @@ int main(){ while(1){ // 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++)