/** * Created by Skanaar
* kallincl AT kth DOT se */ //######################### float rotX, rotY; float sigma, roe, beta; int[][] screenImage; Pellet[] pellet; SkanaarGUI gui; int pelletCount = 500; int opacity = 32; boolean playing = true, antialias = false; int[][] spectrums; int[] spectrum; //--------------------------------------------- void setup(){ initialize(); size(450,502); framerate(30); screenImage = new int[width][width]; spectrums = new int[5][]; spectrums[0] = new int[]{ 0,2,4 }; spectrums[1] = new int[]{ 2,0,4 }; spectrums[2] = new int[]{ 3,1,0 }; spectrums[3] = new int[]{ 1,1,5 }; spectrums[4] = new int[]{ 1,1,1 }; spectrum = spectrums[0]; gui = new SkanaarGUI(); gui.setDesign( loadFont("silkscreen.vlw") ); //-- playback and system controls gui.addLayer("lay_play"); gui.hideLayer("lay_play"); gui.layer("lay_play").addButton("play", "play (p)", 8, height-43); gui.addLayer("lay_pause"); gui.showLayer("lay_pause"); gui.layer("lay_pause").addButton("pause", "pause (p)", 8, height-43); if(!online) gui.addButton("save_image", "save image", 8, height-23); //-- simulation interaction gui.addText("t_opacity", "opacity", 80+(width-280)/2-73, height-43); gui.addSliderH("slid_opacity", 80+(width-280)/2-73, height-33, 50, 0.5); gui.addText("t_spectrum", "spectrum", 80+(width-280)/2-73, height-23); gui.addSliderH("slid_spectrum", 80+(width-280)/2-73, height-13, 50, 0.25); gui.addText("t_sigma", "sigma", 80+(width-280)/2, height-43); gui.addSliderH("slid_sigma", 80+(width-280)/2, height-33, 50, 0.5); gui.addText("t_roe", "roe", 80+(width-280)/2+60, height-43); gui.addSliderH("slid_roe", 80+(width-280)/2+60, height-33, 50, 0.5); gui.addText("t_beta", "beta", 80+(width-280)/2+120, height-43); gui.addSliderH("slid_beta", 80+(width-280)/2+120, height-33, 50, 0.5); gui.addText("t_density", "density", 80+(width-280)/2, height-23); gui.addSliderH("slid_density", 80+(width-280)/2, height-13, 50, 0.5); gui.addText("t_rotx", "rotate x", 80+(width-280)/2+60, height-23); gui.addSliderH("slid_rotx", 80+(width-280)/2+60, height-13, 50, 0.5); gui.addText("t_roty", "rotate y", 80+(width-280)/2+120, height-23); gui.addSliderH("slid_roty", 80+(width-280)/2+120, height-13, 50, 0.5); gui.addButton("respawn", "respawn", width-68, height-43); gui.addRect("rect",-1,width,80,52); gui.addRect("rect",79,width,75,52); gui.addRect("rect",-1,width,width+2,52); background(0); pellet = new Pellet[pelletCount]; for(int i=0;i>8)>>spectrum[0], (screenImage[x][y]*opacity>>8)>>spectrum[1], (screenImage[x][y]*opacity>>8)>>spectrum[2]); updatePixels(); } updateGUI(); } //--------------------------------------------- void initialize(){ sigma = 10; roe = 28; beta = 8.0/3.0; } //--------------------------------------------- void updateGUI(){ opacity = (int)( 64*gui.getValue("slid_opacity") ); gui.visualize(); if(mousePressed) gui.mouseDrag(mouseX,mouseY); } //--------------------------------------------- void clearScreen(){ for(int x=0;x