Skip to content

Commit

Permalink
Fix focus bugs?
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed May 15, 2024
1 parent 6c352f6 commit 2bf00dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions examples/flappy-bird/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ def initialize(...)
@prompt = "Press Space to Start"
end

def close
if @game
@game.stop
@game = nil
end

super
end

def handle(event)
case event[:type]
when "keypress"
Expand Down Expand Up @@ -252,6 +261,8 @@ def start_game!
end

self.reset!
self.update!
self.script("this.querySelector('.flappy').focus()")
@game = self.run!
end

Expand Down
2 changes: 1 addition & 1 deletion examples/flappy-bird/gems.locked
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
lively (0.8.0)
lively (0.9.0)
falcon (~> 0.47)
live (~> 0.9)
xrb
Expand Down

0 comments on commit 2bf00dd

Please sign in to comment.