Skip to content

Commit

Permalink
Create seleccion_gpt.js
Browse files Browse the repository at this point in the history
  • Loading branch information
daranha authored Apr 30, 2024
1 parent 0bacc01 commit 6dfff9c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions seleccion_gpt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let startX, startY;
let endX, endY;
let selecting = false;

function setup() {
createCanvas(400, 400);
}

function draw() {
background(220);

if (selecting) {
let w = endX - startX;
let h = endY - startY;
rect(startX, startY, w, h);
}
}

function mousePressed() {
startX = mouseX;
startY = mouseY;
selecting = true;
}

function mouseReleased() {
endX = mouseX;
endY = mouseY;
selecting = false;
}

0 comments on commit 6dfff9c

Please sign in to comment.