From 3102095c9ff4939dfc0438339c7208ee7b2e2957 Mon Sep 17 00:00:00 2001
From: ubq323 <ubq323@ubq323.website>
Date: Sat, 26 Aug 2023 06:23:34 +0100
Subject: print usernames better, and respond to remote players usernames

---
 client/game.lua | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'client')

diff --git a/client/game.lua b/client/game.lua
index 1a6cd54..e219fef 100644
--- a/client/game.lua
+++ b/client/game.lua
@@ -116,7 +116,12 @@ local function draw_player(pl,islocal)
 	end
 
 	if pl.username then
-		util.print_good(pl.username, pl.pos.x, pl.pos.y)
+		-- think of a better way to unscale but keep transformation
+		love.graphics.push()
+		love.graphics.translate(pl.pos.x, pl.pos.y)
+		love.graphics.scale(1/camera.zoom)
+		util.print_good(pl.username, 0, 0)
+		love.graphics.pop()
 	end
 end
 
@@ -189,7 +194,8 @@ local function handle_net()
 				local pl = j.pl
 				remote_players[pl.id] = {
 					pos=coords.Pos:make(pl.x,pl.y),
-					color=pl.color, id=pl.id
+					color=pl.color, id=pl.id,
+					username = pl.username,
 				}
 				msgbox.add(pl.id.." joined")
 			elseif op == "leave" then
@@ -205,7 +211,8 @@ local function handle_net()
 				local pl = j.pl
 				local_player = {
 					pos=coords.Pos:make(pl.x,pl.y),
-					color=pl.color, id=pl.id, username=pl.username
+					color=pl.color, id=pl.id,
+					username=pl.username,
 				}
 			elseif op == "chunk" then
 				local ch = ChunkC:from_packet_data(j)
-- 
cgit v1.2.3