Green Shoes v1.0
Red Shoes and Green Shoes
Green Shoes follows Red Shoes APIs, but not stick to 100% API compatible. Red Shoes includes it's own ruby interpreter. So, you don't have to install Ruby. Even if you've already install ruby interpreter, Red Shoes doesn't use that. Green Shoes is just a gem written in pure Ruby. Red Shoes is written in C and Ruby.
Let's talk about the difference.
TextBlock width
The following two snippets are same in Red Shoes.
Shoes.app do
para 'hello ' * 20
end
Shoes.app do
20.times{para 'hello '}
end
But in Green Shoes, need to add :width
size explicitly.
Shoes.app do
20.times{para 'hello ', width: 40}
end
If you don't specify the :width
size, Green Shoes makes a TextBlock object with the parent.width
.
Open two Shoes.app at a time
Shoes.app{para 'hello'}
Shoes.app{para 'hi'}
Red Shoes opens two Shoes.app windows at a time. But Green Shoes opens the first window only. If you want to open two windows at a time with Green Shoes, try out the following.
Shoes.app do
para 'hello'
Shoes.app{para 'hi'}
end
Calculate width and height
This snippet works well on Red Shoes. But doesn't on Green Shoes.
Shoes.app do
button 'hello', width: 0.5
list_box width: 0.5
end
Green Shoes needs a slot explicitly to calculate width and height.
Shoes.app do
stack do
button 'hello', width: 0.5
list_box width: 0.5
end
end
Color
In Red Shoes red
is an object of Shoes::Color class,
but in Green Shoes it's just an array.
Shoes.app do
para red #=> rgb(255, 0, 0) : [1.0, 0.0, 0.0]
para red.class #=> Shoes::Color : Array
end
& and <
Red Shoes can handle '&' and '<' normally.
Shoes.app do
para '& and <'
end
But in Green Shoes, you have to replace them to '&' and '<' as like as HTML specific characters.
Shoes.app do
para '& and <'
end