#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 = 0x000000; int pqty = 100; int vis = 0; 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(); } init_screen(maxx, maxy); double dx, dy, dist, rad; while(1){ ColorFill(color, maxx, maxy); e.move(); // move the electron e.show(); // show the electron if(vis > 0){ n.move(); // move the neutron n.show(); // show the neutron } for(x = 0; x < vis; x ++){ p[x].move(); // move all visible protons p[x].show(); // show all visible protons 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'){ scale += .01; } if(c == 'm'){ vis += 1; } if(c == 'l'){ if(vis > 0) vis -= 1; } if(c == 's'){ scale -= .01; } if(c == 'c'){ color = rand() % 0xffffff; } SDL_UpdateRect(screen, minx, miny, maxx, maxy); } }