public void draw() { background(200, 0, 0); // update the cam context.update(); // update nite context.update(sessionManager); // draw depthImageMap image(context.depthImage(), 0, 0); // draw the list pointDrawer.draw(); text(frameRate, 10, 10); }
public void draw() { background(0); fill(0, 255, 0); stroke(255); // get kinect color image context.update(); // scale to an arbitrary size and position (e.g. scale down 75%, and align to bottom / center) skeleton.updateSkeleton(); if (onePlayer) { paddles[0].update(skeleton.getScreenCoords(1, paddleSelector1).y); paddles[1].update(skeleton.getScreenCoords(1, paddleSelector2).y); } else { paddles[0].update(skeleton.getScreenCoords(1, paddleSelector1).y); try { paddles[1].update(skeleton.getScreenCoords(2, paddleSelector2).y); } catch (Exception e) { } } for (int i = 0; i < paddles.length; i++) { paddles[i].drawPaddle(); } ball.update(); ball.checkCollision(paddles); ball.drawBall(); /*PVector rHand = skeleton.getScreenCoords(1, SimpleOpenNI.SKEL_RIGHT_HAND) ; PVector lHand = skeleton.getScreenCoords(1, SimpleOpenNI.SKEL_LEFT_HAND) ; fill(255, 0, 0); ellipse(rHand.x, rHand.y, 20, 20); ellipse(lHand.x, lHand.y, 20, 20);*/ float offset = 80; text( str(paddles[0].points), width - (offset + (0.5f * textWidth(str(paddles[0].points)))), height - 50); text(str(paddles[1].points), offset, height - 50); fill(0, 255, 0, 255 - ((255 / (timer + 1)) * (timer + 1))); if (timer > 0) { String txt = "POINT"; text(txt, (width / 2) - (0.5f * textWidth(txt)), height / 2); timer--; } }