Created
September 1, 2015 03:32
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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