Tag Archives: MacRuby

Since my last post here, I've started working at a software start-up. Its product is a platform for educational iOS apps. As a result, I've gained a decent familiarity with objective C and Cocoa. I haven't had a chance to learn much ruby since starting there, but it's been a good experience for me on the whole.

Before I started I was working through a fantastic book by Topher Cyll, called Practical Ruby Projects: Ideas for the Eclectic Programmer. It's got all kinds of cool things from musical composition to genetic algorithms, and each chapter is genuinely interesting in its own right, independent from anything it teaches about Ruby.


Code starts at 2m27s, MacRuby part at 3m, and game at 9m40s

I should offer a warning, though. The publishers lied when it comes to the difficulty of the book! It's way the heck harder than a followup for "anyone who has mastered the basics of ruby". I attempted to tackle it right after an introductory book and it was very challenging. Progress was slow, and it's only the extreme interestingness of the material that has kept me going. I did parts of various chapters and the only one that I fully finished was for a text-based game he called Dinowars.

The next chapter in the book was on how to use RubyCocoa to make a native Mac front end for the game. Initially I skipped the chapter because I didn't have a Mac and I found all the Cocoa stuff alien. But when I returned to it last week, the material was much more understandable! I leapt in immediately! Not only that, but I decided to delve into MacRuby (an even more compelling technology for anyone who wants to use Ruby to build Cocoa), and I've successfully converted Dinowars' front-end to MacRuby.

This video goes over some MacRuby basics, includes a one page program that pops up a window and reads text with a voice synthesizer, and then shows the final result of my Dinowars port.


Resources

Planet cute tiles: Danc's Miraculously Flexible Game Prototyping Tiles
Source Code from the book publisher: Apress
My source code files: tryrc.rb, trymr.rb, trymr2.rb, and mrstrat.rb.