Added data requesting for score page

This commit is contained in:
sam
2024-01-17 16:37:25 +01:00
parent 17a9e2d7e9
commit f8edb2fea6

View File

@@ -1,7 +1,7 @@
let buttonSelectScore = 0; let buttonSelectScore = 0;
let searchName = ''; let searchName = '';
let scorescreenOn = false; let scorescreenOn = false;
let dataIsCalled = false;
function keyPressed() { function keyPressed() {
// Check if the back button was selected and the Enter key was pressed // Check if the back button was selected and the Enter key was pressed
if (keyCode == ENTER && buttonSelectScore == 0) { if (keyCode == ENTER && buttonSelectScore == 0) {
@@ -84,11 +84,19 @@ function scoremenu() {
fill(0, 0, 0, 0) fill(0, 0, 0, 0)
rect(width / 2, height / 3, 90, 40) rect(width / 2, height / 3, 90, 40)
pop() pop()
if (!dataIsCalled) {
getData(nameHS);
dataIsCalled = true;
}
} }
else { else {
nameDraw(3); nameDraw(3);
} }
for (let i = 0; i < requesteddata.length; i++) {
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width / 5, height / 3 + (i * 30))
}
push() push()
stroke(4, 217, 255) stroke(4, 217, 255)
strokeWeight(5) strokeWeight(5)