Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Variables
- */
- int time_now;
- int time_old;
- int time_delta;
- int countdown_start;
- int countdown;
- int time_counter_started;
- boolean start;
- /*
- * Funcion incializacion
- */
- void setup() {
- size(800, 400);
- // size(800, 400, P2D);
- // size(800, 400, P3D);
- background(0, 0, 0);
- stroke(255, 255, 255);
- frameRate(10);
- time_old = 0;
- countdown_start = 10;
- countdown = countdown_start;
- time_counter_started = 0;
- start = false;
- }
- /*
- * Funcion de repintado
- */
- void draw() {
- time_now = millis();
- time_delta = time_now - time_old;
- time_old = time_now;
- background(0, 0, 0);
- textSize(30);
- text(time_delta, 50, 35);
- text("ms entre frames", 130, 35);
- text("Cuenta atrás: " + countdown, 50, 70);
- if (start && countdown > 0) {
- countdown = countdown_start - (time_now - time_counter_started) / 1000;
- }
- }
- /*
- * Captura click raton
- */
- void mousePressed() {
- start = true;
- time_counter_started = millis();
- }
Add Comment
Please, Sign In to add comment