Fungus fungus; SkanaarKey sk; PFont font; PImage grass, sky; float avatarPos=0; //-------------- void setup() { size(300,340,P3D); sk = new SkanaarKey(); frameRate(30); //smooth(); font = loadFont("Silkscreen-8.vlw"); textFont(font); textMode(SCREEN); grass = loadImage("grass.png"); sky = loadImage("sky.jpg"); fungus = new Fungus(); } //-------------- void draw() { if(sk.keyDown(sk.LEFT)) fungus.topRotation += 0.02; if(sk.keyDown(sk.RIGHT)) fungus.topRotation -= 0.02; if(sk.keyDown(sk.UP)) fungus.baseFlaring -= 0.05; if(sk.keyDown(sk.DOWN)) fungus.baseFlaring += 0.05; if(sk.keyDown('q')) fungus.topFlaring -= 0.05; if(sk.keyDown('w')) fungus.topFlaring += 0.05; fungus.hatWidth = fungus.topWidth/fungus.hat.width; fungus.hatHeight = fungus.topWidth/fungus.hat.height; if(sk.keyDown('a')) fungus.topWidth -= 1; if(sk.keyDown('s')) fungus.topWidth += 1; if(sk.keyDown('z')) fungus.baseWidth -= 1; if(sk.keyDown('x')) fungus.baseWidth += 1; fungus.calcBezierPatch(); background(192,192,255); image(sky,0,0); pushMatrix(); translate(width*0.5,height*0.8); fungus.visualize(); popMatrix(); noStroke(); fill(64,192,0); rect(0,height*0.8-1,width,height*0.3); fill(255); image(grass,0,height*0.66); stroke(0); rect(0,height*0.89,width,height*0.3); noFill(); rect(0,0,width-1,height-1); fill(0); textAlign(LEFT); text("click : set top location",5,height-25); text("left,right : +/- top rotation",5,height-15); text("up,down : +/- base flaring",5,height-5); textAlign(RIGHT); text("[q],[w] : +/- top flaring",width-5,height-25); text("[a],[s] : +/- top width",width-5,height-15); text("[z],[x] : +/- base width",width-5,height-5); } //------------------------- void keyPressed(){ sk.keyPressed(key,keyCode); } //------------------------- void keyReleased(){ if(key==' '){ println("x "+fungus.topX); println("y "+fungus.topY); println("rot "+fungus.topRotation); println("tflare "+fungus.topFlaring); println("bflare "+fungus.baseFlaring); println("tw "+fungus.topWidth); println("bw "+fungus.baseWidth); } sk.keyReleased(key,keyCode); } //-------------- void mousePressed(){ fungus.topX = mouseX-width*0.5; fungus.topY = mouseY-height*0.8; fungus.calcBezierPatch(); } //-------------- void mouseReleased() { } //--------------