152 lines
5.6 KiB
Text
152 lines
5.6 KiB
Text
# Soup - Client
|
|
# Voxel Battle Royale Client
|
|
# Main game UI and home page with menu
|
|
|
|
fn main() -> int do
|
|
# Initialize graphics
|
|
init_window(1280, 720, "Soup - Voxel Battle Royale")
|
|
defer close_window()
|
|
|
|
enable_msaa_4x()
|
|
|
|
# Game state
|
|
let mut current_screen = 0 # 0 = Home, 1 = Lobby, 2 = Game
|
|
let mut player_name = "Player"
|
|
let mut server_host = "127.0.0.1"
|
|
let mut server_port = 8888
|
|
|
|
# Show FPS meter
|
|
show_fps_meter(Vec2 { x: 10.0, y: 10.0 })
|
|
|
|
# Main loop
|
|
while window_should_close() == false do
|
|
begin_drawing()
|
|
clear_background(30, 30, 40, 255) # Dark blue background
|
|
|
|
if current_screen == 0 do
|
|
# ===== HOME SCREEN =====
|
|
|
|
# Title
|
|
draw_text("SOUP", 450, 80, 120, 100, 200, 255, 255) # Cyan title
|
|
draw_text("Voxel Battle Royale", 400, 220, 40, 200, 200, 200, 255) # Subtitle
|
|
|
|
# Main buttons
|
|
# Play button
|
|
draw_rectangle(450, 320, 380, 80, 50, 150, 255, 255) # Blue button
|
|
draw_rectangle_lines(450, 320, 380, 80, 100, 200, 255, 255) # Border
|
|
draw_text("PLAY", 600, 350, 40, 255, 255, 255, 255)
|
|
|
|
# Settings button
|
|
draw_rectangle(450, 430, 380, 80, 100, 100, 100, 255) # Gray button
|
|
draw_rectangle_lines(450, 430, 380, 80, 150, 150, 150, 255)
|
|
draw_text("SETTINGS", 540, 460, 40, 255, 255, 255, 255)
|
|
|
|
# Quit button
|
|
draw_rectangle(450, 540, 380, 80, 150, 50, 50, 255) # Red button
|
|
draw_rectangle_lines(450, 540, 380, 80, 200, 100, 100, 255)
|
|
draw_text("QUIT", 600, 570, 40, 255, 255, 255, 255)
|
|
|
|
# Footer
|
|
draw_text("v0.1.0 - Early Access", 500, 680, 20, 150, 150, 150, 255)
|
|
|
|
# Check for button clicks
|
|
let mouse_x = get_mouse_x() as int
|
|
let mouse_y = get_mouse_y() as int
|
|
let is_mouse_clicked = is_mouse_button_pressed(MOUSE_BUTTON_LEFT)
|
|
|
|
# Play button click
|
|
if mouse_x >= 450 and mouse_x <= 830 and mouse_y >= 320 and mouse_y <= 400 do
|
|
if is_mouse_clicked != 0 do
|
|
current_screen = 1 # Go to lobby
|
|
end
|
|
end
|
|
|
|
# Settings button click
|
|
if mouse_x >= 450 and mouse_x <= 830 and mouse_y >= 430 and mouse_y <= 510 do
|
|
if is_mouse_clicked != 0 do
|
|
current_screen = 2 # Go to settings
|
|
end
|
|
end
|
|
|
|
# Quit button click
|
|
if mouse_x >= 450 and mouse_x <= 830 and mouse_y >= 540 and mouse_y <= 620 do
|
|
if is_mouse_clicked != 0 do
|
|
break
|
|
end
|
|
end
|
|
|
|
end else if current_screen == 1 do
|
|
# ===== LOBBY SCREEN =====
|
|
|
|
draw_text("MATCHMAKING", 450, 100, 60, 100, 200, 255, 255)
|
|
|
|
# Status message
|
|
draw_text("Connecting to server...", 400, 250, 30, 200, 200, 200, 255)
|
|
draw_text("Host: 127.0.0.1:8888", 400, 310, 20, 150, 150, 150, 255)
|
|
|
|
# Player info
|
|
draw_text("Your Name: Player", 400, 380, 20, 200, 200, 200, 255)
|
|
draw_text("Players in Queue: 0/100", 400, 420, 20, 200, 200, 200, 255)
|
|
|
|
# Loading animation (simple dots)
|
|
draw_text("Loading...", 550, 500, 30, 100, 200, 255, 255)
|
|
|
|
# Back button
|
|
draw_rectangle(100, 630, 150, 60, 150, 50, 50, 255)
|
|
draw_rectangle_lines(100, 630, 150, 60, 200, 100, 100, 255)
|
|
draw_text("BACK", 120, 650, 30, 255, 255, 255, 255)
|
|
|
|
# Cancel button
|
|
let mouse_x = get_mouse_x() as int
|
|
let mouse_y = get_mouse_y() as int
|
|
let is_mouse_clicked = is_mouse_button_pressed(MOUSE_BUTTON_LEFT)
|
|
|
|
if mouse_x >= 100 and mouse_x <= 250 and mouse_y >= 630 and mouse_y <= 690 do
|
|
if is_mouse_clicked != 0 do
|
|
current_screen = 0 # Back to home
|
|
end
|
|
end
|
|
|
|
end else if current_screen == 2 do
|
|
# ===== SETTINGS SCREEN =====
|
|
|
|
draw_text("SETTINGS", 450, 100, 60, 100, 200, 255, 255)
|
|
|
|
# Settings options
|
|
draw_text("Player Name:", 250, 200, 24, 200, 200, 200, 255)
|
|
draw_rectangle(450, 190, 300, 50, 50, 50, 50, 255)
|
|
draw_rectangle_lines(450, 190, 300, 50, 100, 100, 100, 255)
|
|
draw_text("Player", 460, 205, 20, 255, 255, 255, 255)
|
|
|
|
draw_text("Server Host:", 250, 300, 24, 200, 200, 200, 255)
|
|
draw_rectangle(450, 290, 300, 50, 50, 50, 50, 255)
|
|
draw_rectangle_lines(450, 290, 300, 50, 100, 100, 100, 255)
|
|
draw_text("127.0.0.1", 460, 305, 20, 255, 255, 255, 255)
|
|
|
|
draw_text("Server Port:", 250, 400, 24, 200, 200, 200, 255)
|
|
draw_rectangle(450, 390, 300, 50, 50, 50, 50, 255)
|
|
draw_rectangle_lines(450, 390, 300, 50, 100, 100, 100, 255)
|
|
draw_text("8888", 460, 405, 20, 255, 255, 255, 255)
|
|
|
|
# Back button
|
|
draw_rectangle(450, 550, 300, 70, 100, 100, 100, 255)
|
|
draw_rectangle_lines(450, 550, 300, 70, 150, 150, 150, 255)
|
|
draw_text("BACK TO HOME", 495, 577, 30, 255, 255, 255, 255)
|
|
|
|
let mouse_x = get_mouse_x() as int
|
|
let mouse_y = get_mouse_y() as int
|
|
let is_mouse_clicked = is_mouse_button_pressed(MOUSE_BUTTON_LEFT)
|
|
|
|
if mouse_x >= 450 and mouse_x <= 750 and mouse_y >= 550 and mouse_y <= 620 do
|
|
if is_mouse_clicked != 0 do
|
|
current_screen = 0 # Back to home
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end_drawing()
|
|
end
|
|
|
|
0
|
|
end
|