From 598bd4332deddd5f4c506689cbd136f495835ea7 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 18 Jun 2023 03:34:03 +0100 Subject: actually send the username --- client/game.lua | 6 +++++- client/main.lua | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/game.lua b/client/game.lua index 31e02b8..c5cdffb 100644 --- a/client/game.lua +++ b/client/game.lua @@ -343,6 +343,7 @@ end local connected = false local sent_hshake = false +local username = nil function SCENE.update(dt) if connected then return update(dt) @@ -367,11 +368,14 @@ function SCENE.draw() end end -function SCENE.load(username) +function SCENE.load(_username) love.keyboard.setKeyRepeat(true) -- require"profile".start(10,io.open("./trace","w")) host = enet.host_create() peer = host:connect(SERVER_HOSTNAME..":8473",2) + username = _username + print("got username",_username) + end function SCENE.quit() diff --git a/client/main.lua b/client/main.lua index 1d9409f..7388c67 100644 --- a/client/main.lua +++ b/client/main.lua @@ -42,7 +42,7 @@ function titlescene.keypressed(k,s,r) username = username:sub(1,b-1) end elseif k=="return" then - switch_scene(gamescene) + switch_scene(gamescene, username) end end -- cgit v1.2.3