Skip to content

Instantly share code, notes, and snippets.

@AnimaWish
Last active December 10, 2015 16:58
Show Gist options
  • Select an option

  • Save AnimaWish/4464289 to your computer and use it in GitHub Desktop.

Select an option

Save AnimaWish/4464289 to your computer and use it in GitHub Desktop.
Shoes.app :margin => 20, :width => 360 do
flow :width => 1.0, :height => 30 do
background gray(0.5)
stack :width => 0.5 do
para strong "Magic Tool", :size => 14
end
stack :width => 0.25
stack :width => 0.25 do
flow do
button("+") {}
button("-") {}
end
end
end
stack :width => 1.0, :height => 2 do
background black
end
flow :width => 1.0 do
# class Player
# attr_accessor :life, :width
# def initialize(width)
# @life = 20
# @width = width
# def draw(width, life)
# stack :width => width do
# background gray(0.75)
# flow do
# para "life: ", :size => 14
# @lifecounter = edit_line(:width => 20)
# @lifecounter.text = @life.to_s
# #@life = @lifecounter.text.to_i
# end
# flow do
# button("+") {@life += 1; @lifecounter.text = @life.to_s}
# button("-") {@life -= 1; @lifecounter.text = @life.to_s}
# end
# end
# end
# end
class Player
attr_accessor :life
def initialize
@life = 20
end
end
def player(size, person)
stack :width => size do
background gray(0.75)
flow do
para "life: ", :size => 14
@lifecounter = edit_line(:width => 20)
@lifecounter.text = person::life.to_s
#@life = @lifecounter.text.to_i
end
flow do
button("+") {person::life += 1; @lifecounter.text = person::life.to_s}
button("-") {person::life -= 1; @lifecounter.text = person::life.to_s}
end
end
end
player1 = Player.new
player2 = Player.new
player(179, player1)
stack :width => 2 do
background black
end
player(179, player2)
end
end
#windowsize = (360 - (x-1)*2)/x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment