Bladeren bron

Usernames -> nicknames;

Bjorn 11 jaren geleden
bovenliggende
commit
c456d46d36
1 gewijzigde bestanden met toevoegingen van 14 en 14 verwijderingen
  1. 14 14
      data/menu/menulogin.lua

+ 14 - 14
data/menu/menulogin.lua

@@ -4,20 +4,18 @@ local g = love.graphics
 local w, h = g.width, g.height
 
 function MenuLogin:load()
-  ctx.ribbon.count = 3
+  ctx.ribbon.count = 2
   ctx.ribbon.margin = h(.1)
 
   ctx.input:clear()
-  ctx.input:addInput('username', username or love.filesystem.read('username') or 'username')
-  ctx.input:addInput('password', 'password')
+  ctx.input:addInput('nickname', username or love.filesystem.read('username') or 'nick')
 end
 
 function MenuLogin:mousepressed(x, y, button)
   local ribbon = ctx.ribbon:test(x, y)
 
-  if ribbon == 1 then ctx.input:focusInput('username')
-  elseif ribbon == 2 then ctx.input:focusInput('password')
-  elseif ribbon == 3 then self:login() end
+  if ribbon == 1 then ctx.input:focusInput('nickname')
+  elseif ribbon == 2 then self:login() end
 end
 
 function MenuLogin:keypressed(key)
@@ -31,19 +29,21 @@ function MenuLogin:draw()
   g.setFont('BebasNeue', h(.065))
   g.setColor(160, 160, 160)
   
-  if input.focused == 'username' then g.setColor(220, 220, 220) else g.setColor(160, 160, 160) end
-  g.printCenter('Username', w(.05), anchor - ctx.ribbon.margin, false, true)
-  g.printCenter(input:val('username'), w(.4), anchor - ctx.ribbon.margin, false, true)
+  if input.focused == 'nickname' then g.setColor(220, 220, 220) else g.setColor(160, 160, 160) end
+  g.printCenter('Nickname', w(.05), anchor - ctx.ribbon.margin / 2, false, true)
+  g.printCenter(input:val('nickname'), w(.4), anchor - ctx.ribbon.margin / 2, false, true)
   
-  if input.focused == 'password' then g.setColor(220, 220, 220) else g.setColor(160, 160, 160) end
+  --[[if input.focused == 'password' then g.setColor(220, 220, 220) else g.setColor(160, 160, 160) end
   g.printCenter('Password', w(.05), anchor, false, true)
-  g.printCenter(string.rep('•', #input:val('password')), w(.4), anchor, false, true)
+  g.printCenter(string.rep('•', #input:val('password')), w(.4), anchor, false, true)]]
   
   love.graphics.setColor(160, 160, 160)
-  g.printCenter('Login', w(.05), anchor + h(.1), false, true)
+  g.printCenter('Enter', w(.05), anchor + ctx.ribbon.margin / 2, false, true)
 end
 
 function MenuLogin:login()
-  username = ctx.input:val('username')
-  ctx:push(ctx.main)
+  username = ctx.input:val('nickname')
+  if #username > 0 then
+    ctx:push(ctx.main)
+  end
 end