|
Revision 186, 403 bytes
(checked in by why, 10 months ago)
|
|
* shoes/world.c: introduced the new shoes_world_t struct so I can start to implement multiple windows soon.
* shoes/app.c: the shoes_app struct is now wrapped by the App class.
* shoes/ruby.c: heavy reorganization of how blocks are called. prevalent use of instance_eval has been abandoned in favor of evaluation at the app-level and tracking of canvas nesting. i just think instance_eval was too confusing for beginners, I'm much happier with this. In this way, instance variables can be used to store elements rather than plain variables.
* samples/: use of instance variables to store controls and changes to reflect the new scoping. this revision breaks a lot of old code and doesn't yet compile on osx and win32.
|
| Line | |
|---|
| 1 | Shoes.app :width => 400, :height => 500 do |
|---|
| 2 | rectangles = proc do |
|---|
| 3 | 20.times do |
|---|
| 4 | nostroke |
|---|
| 5 | fill rgb((0.6..1.0).rand, (0.1..1.0).rand, (0.2..1.0).rand, (0.4..1.0).rand) |
|---|
| 6 | r = rand(300) + 60 |
|---|
| 7 | rect :left => (10..100).rand, :top => (10..200).rand, :width => r, :height => r |
|---|
| 8 | end |
|---|
| 9 | button "OK", :left => 300, :top => 400 do |
|---|
| 10 | clear &rectangles |
|---|
| 11 | end |
|---|
| 12 | end |
|---|
| 13 | |
|---|
| 14 | rectangles[] |
|---|
| 15 | end |
|---|