Using the Ruby Shoes GUI toolkit, how would I go about being able to edit my GUI in different areas of code -
i'm writing horse race/bet game using shoes , wondering how able change gui in different areas of code. when run this, horse on 1 application , race line on application, want them both on same application. need set actual shoes app variable itself?
class horse def initialize() #puts "yoyoyoyo" #@number=i shoes.app{ @icon= image 'horsey.jpg' @icon.left = 100 @icon.top = 50 } end def neigh() #puts "neighhhh" end def racetime() time=rand(100)%20 return time+10 end end class horseicon def initialize(h) @horse= h @imageloc='horsey.jpg' end end class game def initialize(h1, h2) contestants=[h1, h2] shoes.app{ @icon= image 'raceline.jpg' @icon.left = 100 @icon.top = 70 } end def race() end end game= game.new(1,2) seabiscuit= horse.new()
you using 2 separate shoes.app classes. think that's problem.
judging code seem have background in other language, python. suggest clone shoes git , @ 'shoes/samples' directory , play around it. or @ this.
it see code should like.
ps : give pointers toward ruby style. don't use {} block when using multiple lines. use:
shoes.app # code goes here end
Comments
Post a Comment