config refactor pt.2
This commit is contained in:
12
physics.c
12
physics.c
@@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "graphics.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "graphics.h"
|
||||||
#define FRAMERATE 60
|
#include "config.h"
|
||||||
#define GRAVITY 0.001f
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Points store position, position in previous frame and forces
|
* Points store position, position in previous frame and forces
|
||||||
@@ -42,8 +40,8 @@ void update_point(Point* p);
|
|||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
int main(){
|
int main(){
|
||||||
char *data = malloc(40*40);
|
char *data = malloc(WIDTH*HEIGHT);
|
||||||
Canvas cnv = {40, 40, data};
|
Canvas cnv = {WIDTH, HEIGHT, data};
|
||||||
|
|
||||||
// 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,
|
||||||
@@ -139,5 +137,7 @@ void update_point(Point* p){
|
|||||||
void update_link(Link* l){
|
void update_link(Link* l){
|
||||||
double cur_dist = distance(l->a, l->b);
|
double cur_dist = distance(l->a, l->b);
|
||||||
double delta = l->length - cur_dist;
|
double delta = l->length - cur_dist;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user