Thumbnail for {{ page.title }}

Articles

Articles are single-page pieces that give a whirlwind tour of a specific topic.

They’re different from series, which go very in-depth, taking many detours.

February 2013

Things I struggle with

Putting thoughts in bits

I think about lots of things but when it comes down to writing them, drawing them, implementing them, it’s not that easy. Even with years of practice in each of these trades, it’s still an uphill battle.

Which is why I am not going to read that article after I wrote it and will go straight to publication.

Not assuming nobody cares

Next power of two

While looking to write a pure ooc version of ftgl, I was reading the source of ftgl-gl3 and I stumbled upon this piece of code:

static inline GLuint NextPowerOf2(GLuint in) { in -= 1; in |= in >> 16; in |= in >> 8; in |= in >> 4; in |= in >> 2; in |= in >> 1; return in + 1; }

This is needed because dealing with power-of-two textures (32x32, 64x64, 128x128, etc.) is more efficient with OpenGL (some implementations don’t even support non-power-of-two textures!).

rock 0.9.6 is on the loose!

Just 8 days after the last release, rock 0.9.6 is out.

To update, run git pull && make rescue as usual. To install from scratch, clone the repo, cd into it, and run make rescue from there - it’ll download the latest bootstrap, compile itself from C, then recompile itself from ooc.

Running rock -V should give you something like this:

rock 0.9.6 codename loki, built on Wed Feb 20 15:09:08 2013

Android development with rock 0.9.5

rock 0.9.5 is out! It’s the meanest, slimmest, baddest rock release yet.

To update, run git pull && make rescue as usual. To install from scratch, clone the repo, cd into it, and run make rescue from there - it’ll download the latest bootstrap, compile itself from C, then recompile itself from ooc.

Running rock -V should print this happy little version line:

January 2013

NeverJam: the game jam jam game

Our January project was ambitious: a 2D puzzle game, a-la lemmings with a twist, with big and numerous levels. And of course, all using our homegrown tools, from the compiler to the level editor to the UI system and game framework.

However, January ended too soon, and, sleepless nights notwithstanding, I had to resolve to publish something completely different. It was a good occasion to get to know Twine.

sam, homebrew-mingw, etc.

I want to write blog posts, but right now I have too much to do.

So instead, here are bullet points:

  • I wrote an ooc tool named sam, which helps you keep your git repos up-to-date, and helps to remind you what to push when switching workstations. It’s pretty neat, and portable.

  • A while ago, I started working on homebrew for Windows, or rather, for MinGW+MSYS. Provided you have msysgit and Ruby in your PATH, it’ll let you brew install most packages. I’ve tested a few dozen, send in your pull requests anytime.

December 2012

Having fun with ooc

Unfortunately, the ooc language could have better documentation. In the meantime, I’d like to blog about about some features that might not be very well-known.

Nested functions

Here’s a program that prints 1, 3, 5, 7, 9:

import structs/ArrayList main: func { list := ArrayList<Int> new() addIfOdd := func (i: Int) { if (i % 2 != 0) list add(i) } for (i in 0..10) { addIfOdd(i) } list map(|i| i toString()) join(", ") println() }

The perils of ooc arguments

The ooc language is known to be friendly to C libraries, and we have a slew of them covered on GitHub, but one common hurdle is how to correctly declare extern functions.

Argument types

For an ooc function prototype, there are many types of arguments. You can go with regular variable declarations, like so:

something: func (a: Int, b: Int, c: String)

But in this case, a and b have the same type, so you can also use multi-declarations to shorten it a bit: