Good morning interwebs!
Admittedly not the morning from the last post, but hey, an entry is an entry. I'm getting it out there.
Last night was oddly productive. Especially for me. Thursday I had wrestled flash onto my mac and came to the conclusion that future users of flash should make a point of mentioning flex, the sdk that basically is flash from a programmers view. Anyway, the point is, I can now write actionscript programs on my mac from the command line and any text editor I feel like. That's a good day, but we're not talking about that day.
Getting back to last night, while zoning out in front of the national and the escapist and randomly googled "Ruby graphics" and just for good measure, appended "mac" (mac users will be familiar with that last step. It's usually mandatory). I came up with 3 promising hits: Rubygame, Gosu, and Shoes. Shoes showed itself more as a gui library and didn't have the level of documentation I was looking for. Rubygame was a nice idea, but it had some issues on mac with Rake and I didn't want another massive file hunt on my hands. This led me to Gosu.
The installation was pretty easy. Gosu is a gem, which means the Ruby gems system can handle the installation on its own. And that it did. It even cam with an example game as a tutorial. The whole game was in one file, ~3 pages (ish. I can only judge from vim scrolling time). I tried running it through the Ruby interpreter and presto! There it was.
Two thoughts occurred to me at that moment:
Firstly: God I love this language!
Secondly: God I don't want to figure out that example without a half decent IDE.
So part 2 of the project became the setting up of a Ruby plugin for a half decent IDE. I had eclipse handy, so I went with that.
Now when I did this with c++ it was kind of a nightmare, but the subsequent python install went pretty smoothly. So I had no idea how this was going to go. Consulting the internet, I found the plugin I needed was called DLTK. I have no idea what this stands for, but with all the batman hype lately, I choose to believe it stands for Dark Like The Knight. Anyway the Knight's installation was pretty smooth, save one exception. On of the things you rely on as a programmer is the standard out feed on the console for debugging purposes. This Ruby plugin's only problem was that where other programs printed something, it printed nothing. When a one line hello world program fails to print, it's a sad day. A little more research revealed that this was a unix eclipse bug and that it had been fixed in the next version. After I downloaded that it was a breeze.
Now there was only one hurdle left: get the tutorial file to execute through eclipse. I hit a bug on my first attempt to run it. But I didn't really look at the error message. I was instead focused on a mysterious point at which eclipse misread a '"' and proceded to colour the rest of the program as a string. A little trial and error, and I discovered that under the right circumstances, an escape character is needed for a '/'. Of course that didn't fix the error. The program was failing because the code was here and the images and sounds were in a media folder back in the gem, bu that was easily fixed. After that it worked perfectly. I'm almost waiting for something to go wrong.
But it hasn't yet and it didn't last night. I was up late working on a more important goal for today, but I'm saving that for another post. I think I'll type that one up after I get back from the shower.
Anyhoo, to sum up: Ruby awesome. Ruby on eclipse awesome so far. Ruby and Gosu on eclipse freaking awesome. Last night amazingly awesome. More posts to come. Soon
Until then, to paraphrase a more interesting man: "Stay bored my friends."
No comments:
Post a Comment