arbitrary config.h update and proper compensation for framerate in gravity acceleration
This commit is contained in:
10
config.h
10
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
|
||||
|
||||
10
physics.c
10
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++)
|
||||
|
||||
Reference in New Issue
Block a user