From: Jonathan P. <jp...@dc...> - 2006-02-22 10:37:20
|
On 22 Feb 2006, at 7:23, Tim Burks wrote: > This evening I spoke to the San Francisco Ruby Meetup group about > RubyCocoa. I thought it would be fun to describe RubyCocoa with an > example, so I presented a simple arcade-style game written in Ruby > that uses RubyCocoa to draw and handle user events. I also wrote > it up as a tutorial and put it online here: http:// > www.rubycocoa.com/ruby-rocks. Great stuff! A few comments on the tutorial: Probably worth mentioning up front that a game wouldn't normally be a document-based application (and say at the end what would be different to use a non-document application template). Rather than editing the pbxproj file manually: Targets inspector -> rubyrocks -> Info.plist Entries -> Document Types -> Document Class I couldn't see any instructions for binding GameView.game to the Game instance (File's Owner) in Interface Builder. The instructions for adding the 'game' outlet aren't as detailed as the result of the instructions in Interface Builder. You can just use [a,b,c,d] instead of OSX::NSRect.new(a,b,c,d) (similarly for NSPoint), unless you want to hang on to the object and use .x, .y etc. The moveWithBounds_ and initWithPosition_ methods etc don't need a trailing underscore. The model objects (Sprite and descendents) can be plain Ruby objects rather than NSObject descendents. This means you can use a normal ruby initialize method (instead of .alloc.initWith...). Cheers, Jonathan |