#include #include #include #include #include #include #include "graph.h" int main(int argc, char **argv) { char c; int x = 0, y = 0; maxx = 1920; maxy = 1150; scale = .15; int color = 0xaaeeff; int pqty = 100; int vis = 4; seconds = time (NULL); unsigned int sec = seconds; srand(sec); electron e; e.init(); neutron n; n.init(); proton p[pqty]; for(x = 0; x < pqty; x++){ p[x].id = x; p[x].init(); } p[0].m *= p[0].m; // Massive proton test init_screen(maxx, maxy); double dx, dy, dist, rad; while(1){ ColorFill(color, maxx, maxy); e.move(); e.show(); n.move(); n.show(); for(x = 0; x < vis; x ++){ p[x].move(); p[x].show(); n.bump(p[x]); for(y = x + 1; y < vis; y ++){ p[x].bump(p[y]); } } SDL_Delay(1); c = keystroke(); if(c == 'q') break; if(c == 'g'){ for(x = 0; x < vis; x ++){ p[x].z += .01; } e.z += .01; } if(c == 'm'){ vis += 1; } if(c == 'l'){ if(vis > 1) vis -= 1; } if(c == 's'){ for(x = 0; x < vis; x ++){ if(p[x].z > .03){ p[x].z -= .01; } } e.z -= .01; } SDL_UpdateRect(screen, minx, miny, maxx, maxy); } }