pdeeee
This commit is contained in:
parent
227082ba65
commit
2c76f874c4
139
custodisco-kiosk.pde
Normal file
139
custodisco-kiosk.pde
Normal file
@ -0,0 +1,139 @@
|
||||
String title = "custodisco";
|
||||
String subtitle = "hi, what do you want to do?";
|
||||
String button1Text = "create item";
|
||||
String button2Text = "lookup item";
|
||||
|
||||
int state = 0;
|
||||
boolean button1Hovered = false;
|
||||
boolean button2Hovered = false;
|
||||
boolean button1Pressed = false;
|
||||
boolean button2Pressed = false;
|
||||
|
||||
boolean buttonYesHovered = false;
|
||||
boolean buttonNoHovered = false;
|
||||
boolean buttonYesPressed = false;
|
||||
boolean buttonNoPressed = false;
|
||||
|
||||
void setup() {
|
||||
fullScreen();
|
||||
textAlign(CENTER, CENTER);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(135, 206, 235); // Light sky blue
|
||||
checkButtonHover();
|
||||
int buttonY = height/2 + (height - height/2) / 2;
|
||||
|
||||
if(state == 0) {
|
||||
displayMainMenu(buttonY);
|
||||
} else if(state == 1) {
|
||||
displayCreateItemScreen(buttonY);
|
||||
}
|
||||
}
|
||||
|
||||
void displayMainMenu(int buttonY) {
|
||||
textSize(64);
|
||||
textFont(createFont("SansSerif", 64));
|
||||
fill(0); // Black
|
||||
text(title, width/2 - 50, height/4);
|
||||
drawSparkle(width/2 + 150, height/4 - 20); // Draw the sparkle next to the title
|
||||
|
||||
textSize(32);
|
||||
textFont(createFont("Serif", 32, true)); // true for italics
|
||||
text(subtitle, width/2, height/3);
|
||||
|
||||
// Button 1
|
||||
displayButton(button1Hovered, button1Pressed, width/3, buttonY, button1Text);
|
||||
|
||||
// Button 2
|
||||
displayButton(button2Hovered, button2Pressed, 2*width/3, buttonY, button2Text);
|
||||
}
|
||||
|
||||
void displayCreateItemScreen(int buttonY) {
|
||||
textSize(64);
|
||||
textFont(createFont("SansSerif", 64));
|
||||
fill(0); // Black
|
||||
text("do you have an existing Scuttlebutt account?", width/2, height/4);
|
||||
|
||||
// Button "Yes"
|
||||
displayButton(buttonYesHovered, buttonYesPressed, width/3, buttonY, "yes");
|
||||
|
||||
// Button "No"
|
||||
displayButton(buttonNoHovered, buttonNoPressed, 2*width/3, buttonY, "no, I'd like to create one now");
|
||||
}
|
||||
|
||||
void displayButton(boolean buttonHovered, boolean buttonPressed, int buttonX, int buttonY, String buttonText) {
|
||||
if(buttonHovered){
|
||||
if(buttonPressed){
|
||||
fill(205, 175, 149); // Dark Peach color for button press
|
||||
}else{
|
||||
fill(235, 200, 175); // Slightly darker Peach color for hover
|
||||
}
|
||||
} else {
|
||||
fill(255, 218, 185); // Original Peach color
|
||||
}
|
||||
|
||||
stroke(0); // Black
|
||||
strokeWeight(5); // Thick border
|
||||
rectMode(CENTER);
|
||||
rect(buttonX, buttonY, 200, 100, 20);
|
||||
|
||||
fill(0); // Black
|
||||
textSize(24);
|
||||
textFont(createFont("SansSerif", 24));
|
||||
text(buttonText, buttonX, buttonY);
|
||||
}
|
||||
|
||||
void mousePressed() {
|
||||
if(state == 0) {
|
||||
button1Pressed = button1Hovered;
|
||||
button2Pressed = button2Hovered;
|
||||
} else if(state == 1) {
|
||||
buttonYesPressed = buttonYesHovered;
|
||||
buttonNoPressed = buttonNoHovered;
|
||||
}
|
||||
}
|
||||
|
||||
void mouseReleased() {
|
||||
if(state == 0) {
|
||||
if(button1Pressed && button1Hovered){
|
||||
state = 1;
|
||||
println("Going to create item screen");
|
||||
} else if(button2Pressed && button2Hovered){
|
||||
state = 2;
|
||||
println("Going to lookup item screen");
|
||||
}
|
||||
} else if(state == 1) {
|
||||
if(buttonYesPressed && buttonYesHovered){
|
||||
println("You selected Yes");
|
||||
// You can change state here to go to another screen
|
||||
} else if(buttonNoPressed && buttonNoHovered){
|
||||
println("You selected No");
|
||||
// You can change state here to go to another screen
|
||||
}
|
||||
}
|
||||
button1Pressed = false;
|
||||
button2Pressed = false;
|
||||
buttonYesPressed = false;
|
||||
buttonNoPressed = false;
|
||||
}
|
||||
|
||||
void checkButtonHover() {
|
||||
int buttonY = height/2 + (height - height/2) / 2;
|
||||
if(state == 0) {
|
||||
button1Hovered = mouseX > width/3 - 100 && mouseX < width/3 + 100 && mouseY > buttonY - 50 && mouseY < buttonY + 50;
|
||||
button2Hovered = mouseX > 2 * width/3 - 100 && mouseX < 2 * width/3 + 100 && mouseY > buttonY - 50 && mouseY < buttonY + 50;
|
||||
} else if(state == 1) {
|
||||
buttonYesHovered = mouseX > width/3 - 100 && mouseX < width/3 + 100 && mouseY > buttonY - 50 && mouseY < buttonY + 50;
|
||||
buttonNoHovered = mouseX > 2 * width/3 - 100 && mouseX < 2 * width/3 + 100 && mouseY > buttonY - 50 && mouseY < buttonY + 50;
|
||||
}
|
||||
}
|
||||
|
||||
void drawSparkle(int x, int y) {
|
||||
stroke(255, 223, 0); // Yellow for the sparkle
|
||||
strokeWeight(2);
|
||||
line(x - 10, y - 10, x + 10, y + 10);
|
||||
line(x + 10, y - 10, x - 10, y + 10);
|
||||
line(x, y - 15, x, y + 15);
|
||||
line(x - 15, y, x + 15, y);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user