Changeset 132 for trunk/samples

Show
Ignore:
Timestamp:
08/23/2007 11:23:01 (13 months ago)
Author:
why
Message:

* shoes/ruby.c: adding gdk-pixbuf dep, which gives JPEG and GIF support to the image method. also added Image.size and Image.move methods.
* Rakefile: gdk-pixbuf linking. some platforms are going to be broken until i update the build environments.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/samples/bounce.rb

    r131 r132  
    1 size = 60 
    21xspeed, yspeed = 8.4, 6.6 
    32xdir, ydir = 1, 1 
    43 
    54Shoes.app do 
     5  background greenyellow 
    66  nostroke 
     7  icon = image "static/shoes-icon.png", :left => 100, :top => 100 
     8 
    79  x, y = self.width / 2, self.height / 2 
     10  size = icon.size 
    811  animate(30) do 
    9     clear do 
    10       background greenyellow 
    11       x += xspeed * xdir 
    12       y += yspeed * ydir 
     12    x += xspeed * xdir 
     13    y += yspeed * ydir 
    1314     
    14       xdir *= -1 if x > self.width - size or x < 0 
    15       ydir *= -1 if y > self.height - size or y < 0 
     15    xdir *= -1 if x > self.width - size[0] or x < 0 
     16    ydir *= -1 if y > self.height - size[1] or y < 0 
    1617 
    17       oval :left => x + size / 2, :top => y + size / 2, :radius => size, :center => true 
    18     end 
     18    icon.move x.to_i, y.to_i 
    1919  end 
    2020end