Skip to content

Instantly share code, notes, and snippets.

@bigtunacan
Created September 1, 2015 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigtunacan/99833dccbeab0359c796 to your computer and use it in GitHub Desktop.
Save bigtunacan/99833dccbeab0359c796 to your computer and use it in GitHub Desktop.
Show Gosu and Tk running side by side so we can add tradition UI along with Gosu apps.
require 'gosu'
require 'tk'
class GameWindow < Gosu::Window
def initialize
super 640, 480
self.caption = "Gosu Tutorial Game"
@frog = Gosu::Image.new("./frog_cling_1.png")
@x = 0
end
def update
@x += 1
end
def draw
@frog.draw(@x,50,0)
end
end
window = GameWindow.new
root = TkRoot.new { title "ex1" }
def update(window, root)
window.tick
root.update
end
TkLabel.new(root){ text "Hello World"; pack { padx 15; pady 15; side "left"; };}
while true do
update(window, root)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment