Code Sketch
Bixuu02
Category: Programming
// ============================================================
// IPL 2026 CRICKET TEAMS, WICKET-KEEPERS & PLAYERS GUIDE BY BIXUU
// ============================================================
cleari()
originBottomLeft()
// ============================================================
// APP STATES & VARIABLES
// ============================================================
var screen = 0 // 0: Welcome, 1: Team Selection, 2: Category, 3: Players List, 4: Player Details
var selectedTeam = ""
var selectedCategory = "" // "Batters" or "Bowlers"
var selectedPlayer = ""
// Background Star Animation Class
class Star(val x: Double, val y: Double, val size: Double) {
var phase = randomDouble(6.28)
def step() { phase += 0.04 }
def view(canvas: CanvasDraw) {
val brightness = 150 + (math.sin(phase) * 80).toInt
canvas.noStroke()
canvas.fill(200, 220, 255, brightness)
canvas.ellipse(x, y, size, size)
}
}
val stars = ArrayBuffer.empty[Star]
for (i <- 0 until 50) {
stars.append(new Star(randomDouble(cwidth), randomDouble(cheight), 1.0 + randomDouble(2.5)))
}
// ============================================================
// IPL 2026 TEAMS & FULL FORMS
// ============================================================
val teamNames = Array("RCB", "CSK", "MI", "SRH", "GT", "RR", "KKR", "PBKS", "LSG")
val teamFullNames = Array(
"Royal Challengers Bengaluru",
"Chennai Super Kings",
"Mumbai Indians",
"Sunrisers Hyderabad",
"Gujarat Titans",
"Rajasthan Royals",
"Kolkata Knight Riders",
"Punjab Kings",
"Lucknow Super Giants"
)
// ============================================================
// IPL 2026 SQUADS (BATTERS & WICKET-KEEPERS INCLUDED)
// ============================================================
def getTeamBatters(team: String): Array[String] = {
team match {
case "RCB" => Array("Virat Kohli", "Rajat Patidar", "Phil Salt (WK)", "Jitesh Sharma (WK)", "Devdutt Padikkal", "Tim David", "Krunal Pandya")
case "CSK" => Array("Ruturaj Gaikwad", "MS Dhoni (WK)", "Devon Conway (WK)", "Shivam Dube", "Ajinkya Rahane", "Ravindra Jadeja")
case "MI" => Array("Rohit Sharma", "Suryakumar Yadav", "Ishan Kishan (WK)", "Hardik Pandya", "Tilak Varma", "Tim David", "Ryan Rickelton (WK)")
case "SRH" => Array("Travis Head", "Abhishek Sharma", "Heinrich Klaasen (WK)", "Ishan Kishan", "Nitish Kumar Reddy", "Aniket Verma")
case "GT" => Array("Shubman Gill", "Sai Sudharsan", "Jos Buttler (WK)", "Anuj Rawat (WK)", "David Miller", "Rahul Tewatia")
case "RR" => Array("Yashasvi Jaiswal", "Sanju Samson (WK)", "Dhruv Jurel (WK)", "Riyan Parag", "Shimron Hetmyer", "Vaibhav Suryavanshi")
case "KKR" => Array("Shreyas Iyer", "Phil Salt (WK)", "Rinku Singh", "Venkatesh Iyer", "Ramandeep Singh", "Angkrish Raghuvanshi")
case "PBKS" => Array("Shreyas Iyer", "Prabhsimran Singh (WK)", "Nehal Wadhera", "Shashank Singh", "Marcus Stoinis", "Vishnu Vinod (WK)")
case _ => Array("Rishabh Pant (WK)", "KL Rahul (WK)", "Nicholas Pooran (WK)", "Ayush Badoni", "Aiden Markram", "Abdul Samad")
}
}
// 2026 Bowlers List (Including Bhuvneshwar Kumar for RCB)
def getTeamBowlers(team: String): Array[String] = {
team match {
case "RCB" => Array("Bhuvneshwar Kumar", "Yash Dayal", "Josh Hazlewood", "Nuwan Thushara", "Rasikh Salam", "Suyash Sharma")
case "CSK" => Array("Deepak Chahar", "Matheesha Pathirana", "Tushar Deshpande", "Maheesh Theekshana", "Mustafizur Rahman")
case "MI" => Array("Jasprit Bumrah", "Trent Boult", "Deepak Chahar", "Mayank Markande", "Ashwani Kumar")
case "SRH" => Array("Pat Cummins", "Bhuvneshwar Kumar", "Harshal Patel", "T. Natarajan", "Jaydev Unadkat", "Zeeshan Ansari")
case "GT" => Array("Rashid Khan", "Mohammed Siraj", "Kagiso Rabada", "Mohit Sharma", "Noor Ahmad", "Prasidh Krishna")
case "RR" => Array("Trent Boult", "Yuzvendra Chahal", "Sandeep Sharma", "Avesh Khan", "Jofra Archer", "Nandre Burger")
case "KKR" => Array("Sunil Narine", "Varun Chakaravarthy", "Harshit Rana", "Suyash Sharma", "Anukul Roy", "Vaibhav Arora")
case "PBKS" => Array("Arshdeep Singh", "Yuzvendra Chahal", "Kagiso Rabada", "Harpreet Brar", "Marco Jansen", "Lockie Ferguson")
case _ => Array("Mayank Yadav", "Mohsin Khan", "Avesh Khan", "Ravi Bishnoi", "Naveen-ul-Haq", "M. Siddharth")
}
}
// Player Detailed Information Lookup (2026 Updated Stats)
def getPlayerDetails(player: String): Array[String] = {
player match {
// --- RCB 2026 Key Players ---
case "Bhuvneshwar Kumar" => Array("Born: 5 Feb 1990", "Role: Swing King Bowler", "Started Cricket at Age: 12", "Current Age: 36", "IPL Wickets: 180+")
case "Krunal Pandya" => Array("Born: 24 Mar 1991", "Role: All-Rounder (Spinner)", "Started Cricket at Age: 10", "Current Age: 35", "IPL Runs: 1600+ & Wickets: 75+")
case "Virat Kohli" => Array("Born: 5 Nov 1988", "Role: Batting Legend", "Started Cricket at Age: 9", "Current Age: 37", "Centuries: 80+ International")
case "Phil Salt (WK)" => Array("Born: 28 Aug 1996", "Role: Wicket-Keeper Opener", "Started Cricket at Age: 8", "Current Age: 30", "T20 Runs: 3000+")
case "Jitesh Sharma (WK)" => Array("Born: 22 Oct 1993", "Role: Wicket-Keeper Finisher", "Started Cricket at Age: 10", "Current Age: 33", "IPL Strike Rate: 150+")
case "MS Dhoni (WK)" => Array("Born: 7 Jul 1981", "Role: Legendary WK Captain", "Started Cricket at Age: 12", "Current Age: 44", "Centuries: 17 International")
case "Rishabh Pant (WK)" => Array("Born: 4 Oct 1997", "Role: WK Captain & Batter", "Started Cricket at Age: 10", "Current Age: 28", "Centuries: 6+ International")
case "KL Rahul (WK)" => Array("Born: 18 Apr 1992", "Role: WK & Opening Batsman", "Started Cricket at Age: 10", "Current Age: 34", "Centuries: 17 International")
case "Sanju Samson (WK)" => Array("Born: 11 Nov 1994", "Role: Captain & WK", "Started Cricket at Age: 11", "Current Age: 31", "IPL Runs: 4200+")
case "Jasprit Bumrah" => Array("Born: 6 Dec 1993", "Role: Pace Spearhead", "Started Cricket at Age: 14", "Current Age: 32", "Wickets Taken: 400+ International")
case "Rashid Khan" => Array("Born: 20 Sep 1998", "Role: Star Leg-Spinner", "Started Cricket at Age: 10", "Current Age: 27", "T20 Wickets: 580+")
case _ => Array("Born: 15 Jan 1995", "Role: Professional Cricketer", "Started Cricket at Age: 10", "Current Age: 31", "Match Winner / Key Squad Member")
}
}
// ============================================================
// SCREENS UI LOGIC
// ============================================================
def drawLetterScreen(canvas: CanvasDraw) {
canvas.background(15, 25, 45)
repeatFor(stars) { s => s.view(canvas) }
canvas.fill(255, 252, 245)
canvas.stroke(0, 150, 255)
canvas.strokeWeight(4)
canvas.rect(cwidth/2 - 250, cheight/2 - 190, 500, 380)
canvas.fill(0, 102, 204)
canvas.text("IPL 2026 CRICKET TEAMS & WICKET-KEEPERS", cwidth/2 - 175, cheight/2 + 150)
canvas.fill(40, 40, 40)
canvas.text("Hello Cricket Lover,", cwidth/2 - 220, cheight/2 + 110)
canvas.text("Explore all 2026 IPL squads including RCB", cwidth/2 - 220, cheight/2 + 80)
canvas.text("(Bhuvneshwar, Krunal), WK icons & team colors.", cwidth/2 - 220, cheight/2 + 55)
canvas.text("Check Batters, Wicket-Keepers & Bowlers easily.", cwidth/2 - 220, cheight/2 + 30)
canvas.fill(0, 120, 0)
canvas.text("Click below to start exploring.", cwidth/2 - 220, cheight/2 - 10)
canvas.fill(255, 102, 0)
canvas.noStroke()
canvas.rect(cwidth/2 - 150, cheight/2 - 110, 300, 50)
canvas.fill(255, 255, 255)
canvas.text("EXPLORE IPL 2026 TEAMS", cwidth/2 - 95, cheight/2 - 80)
}
def drawTeamSelectionScreen(canvas: CanvasDraw) {
canvas.background(20, 15, 30)
repeatFor(stars) { s => s.view(canvas) }
canvas.fill(255, 215, 0)
canvas.text("SELECT AN IPL 2026 TEAM", cwidth/2 - 105, cheight - 30)
for (i <- 0 until 9) {
val col = i % 3
val row = i / 3
val bx = (cwidth/2 - 235) + (col * 158)
val by = (cheight/2 + 120) - (row * 62)
val tName = teamNames(i)
if (tName == "MI") canvas.fill(0, 50, 150)
else if (tName == "CSK") canvas.fill(180, 140, 0)
else if (tName == "RCB") canvas.fill(180, 20, 20)
else if (tName == "SRH") canvas.fill(200, 80, 0)
else if (tName == "GT") canvas.fill(10, 40, 80)
else if (tName == "RR") canvas.fill(150, 0, 100)
else if (tName == "KKR") canvas.fill(75, 0, 130)
else if (tName == "PBKS") canvas.fill(180, 0, 0)
else canvas.fill(0, 100, 120)
canvas.stroke(255, 215, 0)
canvas.strokeWeight(2)
canvas.rect(bx, by, 150, 48)
canvas.fill(255, 255, 255)
canvas.noStroke()
canvas.text(tName, bx + 12, by + 28)
}
canvas.fill(100, 100, 100)
canvas.noStroke()
canvas.rect(cwidth/2 - 80, 12, 160, 28)
canvas.fill(255, 255, 255)
canvas.text("BACK TO HOME", cwidth/2 - 45, 28)
}
def drawCategoryScreen(canvas: CanvasDraw) {
canvas.background(15, 25, 35)
repeatFor(stars) { s => s.view(canvas) }
canvas.fill(255, 215, 0)
canvas.text("TEAM: " + selectedTeam + " - CHOOSE CATEGORY", cwidth/2 - 130, cheight - 35)
canvas.fill(0, 120, 200)
canvas.stroke(255, 215, 0)
canvas.strokeWeight(3)
canvas.rect(cwidth/2 - 200, cheight/2 + 40, 400, 55)
canvas.fill(255, 255, 255)
canvas.noStroke()
canvas.text("BATTERS & WICKET-KEEPERS", cwidth/2 - 110, cheight/2 + 75)
canvas.fill(180, 80, 0)
canvas.stroke(255, 215, 0)
canvas.strokeWeight(3)
canvas.rect(cwidth/2 - 200, cheight/2 - 40, 400, 55)
canvas.fill(255, 255, 255)
canvas.noStroke()
canvas.text("BOWLERS", cwidth/2 - 45, cheight/2 - 5)
canvas.fill(150, 50, 50)
canvas.rect(cwidth/2 - 100, 15, 200, 32)
canvas.fill(255, 255, 255)
canvas.text("BACK TO TEAMS", cwidth/2 - 50, 32)
}
def drawPlayersListScreen(canvas: CanvasDraw) {
canvas.background(15, 25, 35)
repeatFor(stars) { s => s.view(canvas) }
canvas.fill(255, 215, 0)
canvas.text(selectedTeam + " " + selectedCategory + " (Click player for stats)", cwidth/2 - 150, cheight - 35)
val players = if (selectedCategory == "Batters") getTeamBatters(selectedTeam) else getTeamBowlers(selectedTeam)
for (i <- 0 until players.length) {
val py = (cheight/2 + 115) - (i * 40)
canvas.fill(245, 245, 220)
canvas.stroke(0, 120, 200)
canvas.strokeWeight(2)
canvas.rect(cwidth/2 - 220, py, 440, 34)
canvas.fill(50, 30, 0)
canvas.noStroke()
canvas.text((i + 1) + ". " + players(i), cwidth/2 - 200, py + 22)
}
canvas.fill(180, 50, 50)
canvas.rect(cwidth/2 - 110, 12, 220, 30)
canvas.fill(255, 255, 255)
canvas.text("BACK TO CATEGORIES", cwidth/2 - 75, 28)
}
def drawPlayerDetailsScreen(canvas: CanvasDraw) {
canvas.background(25, 15, 35)
repeatFor(stars) { s => s.view(canvas) }
canvas.fill(255, 215, 0)
canvas.text("PLAYER PROFILE: " + selectedPlayer, cwidth/2 - 120, cheight - 35)
canvas.fill(250, 248, 235)
canvas.stroke(255, 165, 0)
canvas.strokeWeight(3)
canvas.rect(cwidth/2 - 240, cheight/2 - 140, 480, 260)
canvas.fill(30, 30, 30)
canvas.noStroke()
val details = getPlayerDetails(selectedPlayer)
for (i <- 0 until details.length) {
val dy = (cheight/2 + 65) - (i * 38)
canvas.fill(120, 50, 0)
canvas.text("- " + details(i), cwidth/2 - 210, dy)
}
canvas.fill(0, 120, 150)
canvas.rect(cwidth/2 - 110, 15, 220, 32)
canvas.fill(255, 255, 255)
canvas.text("BACK TO LIST", cwidth/2 - 45, 31)
}
// ============================================================
// CLICK HANDLER
// ============================================================
def handleClick(x: Double, y: Double) {
if (screen == 0) {
if (x >= cwidth/2 - 150 && x <= cwidth/2 + 150 && y >= cheight/2 - 110 && y <= cheight/2 - 60) {
screen = 1
}
}
else if (screen == 1) {
if (x >= cwidth/2 - 80 && x <= cwidth/2 + 80 && y >= 12 && y <= 42) {
screen = 0
} else {
for (i <- 0 until 9) {
val col = i % 3
val row = i / 3
val bx = (cwidth/2 - 235) + (col * 158)
val by = (cheight/2 + 120) - (row * 62)
if (x >= bx && x <= bx + 150 && y >= by && y <= by + 48) {
selectedTeam = teamNames(i)
screen = 2
}
}
}
}
else if (screen == 2) {
if (x >= cwidth/2 - 100 && x <= cwidth/2 + 100 && y >= 15 && y <= 47) {
screen = 1
} else if (x >= cwidth/2 - 200 && x <= cwidth/2 + 200 && y >= cheight/2 + 40 && y <= cheight/2 + 95) {
selectedCategory = "Batters"
screen = 3
} else if (x >= cwidth/2 - 200 && x <= cwidth/2 + 200 && y >= cheight/2 - 40 && y <= cheight/2 + 15) {
selectedCategory = "Bowlers"
screen = 3
}
}
else if (screen == 3) {
if (x >= cwidth/2 - 110 && x <= cwidth/2 + 110 && y >= 12 && y <= 42) {
screen = 2
} else {
val players = if (selectedCategory == "Batters") getTeamBatters(selectedTeam) else getTeamBowlers(selectedTeam)
for (i <- 0 until players.length) {
val py = (cheight/2 + 115) - (i * 40)
if (x >= cwidth/2 - 220 && x <= cwidth/2 + 220 && y >= py && y <= py + 34) {
selectedPlayer = players(i)
screen = 4
}
}
}
}
else if (screen == 4) {
if (x >= cwidth/2 - 110 && x <= cwidth/2 + 110 && y >= 15 && y <= 47) {
screen = 3
}
}
}
onMouseClick { (x, y) => handleClick(x, y) }
// ============================================================
// MAIN LOOP
// ============================================================
animateWithCanvasDraw { canvas =>
repeatFor(stars) { s => s.step() }
if (screen == 0) drawLetterScreen(canvas)
else if (screen == 1) drawTeamSelectionScreen(canvas)
else if (screen == 2) drawCategoryScreen(canvas)
else if (screen == 3) drawPlayersListScreen(canvas)
else if (screen == 4) drawPlayerDetailsScreen(canvas)
}