Skip to content

Commit

Permalink
Fixing Timers not updating in menu (closes #30)
Browse files Browse the repository at this point in the history
Also checkbox now can only be clicked when the mouse is exactly above
it.
  • Loading branch information
yancouto committed Dec 14, 2018
1 parent e8d4eb0 commit b2da7e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions client/gamestates/connection_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function state:update(dt)
if connect or hit then
connect_to_server(options, host_input.text, chars[chosen_char])
end

Util.updateTimers(dt)
end

function state:draw()
Expand Down
16 changes: 11 additions & 5 deletions client/gamestates/wait_room.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local larger_font
local title_font

local room_input = { text = "" }
local ready_checkbox = { text = "Ready", checked = false }
local ready_checkbox = { checked = false }

function state:enter(prev, options, char_type)
room = 'none'
Expand Down Expand Up @@ -45,7 +45,7 @@ function state:enter(prev, options, char_type)
if options.auto_ready then
MAIN_TIMER:after(tonumber(options.auto_ready) or 0, function()
ready_checkbox.checked = true
Client.send('ready', ready)
Client.send('ready', true)
end)
end

Expand All @@ -70,9 +70,13 @@ function state:update(dt)
Client.send('change room', room)
end

if suit.Checkbox(ready_checkbox, suit.layout:row()).hit then
Client.send('ready', ready_checkbox.checked)
end
suit.layout:push(suit.layout:row())
if suit.Checkbox(ready_checkbox, suit.layout:row(50, 50)).hit then
Client.send('ready', ready_checkbox.checked)
end
suit.Label("Ready", {align = 'left', font = larger_font}, suit.layout:col(100, 50))
suit.layout:pop()

suit.Label("Current Room: " .. room, {font = larger_font}, suit.layout:row(400, 40))

-- Players list
Expand All @@ -85,6 +89,8 @@ function state:update(dt)
end
suit.layout:row()
end

Util.updateTimers(dt)
end

function state:draw()
Expand Down

0 comments on commit b2da7e5

Please sign in to comment.