Thanks to some help from Paul at the Cinder Library forum, I’ve got isometric text working. I like being able to do this, but I’m no longer convinced it’s the right thing for this version of Chimera, it really needs walls. So I think I’m going to go with flat 2D overlay panels over the game space.
I’ve implemented a general purpose isometric text printing class called IsoTextPrinter. Very simple, inelegant, a singleton with public data members, but easy to use and it works. It allows me to print arbitrary text in any colour, using any TrueType font in isometric projection, either down the X axis, or up the Z axis. There is even a default fallback print case that prints without projection. That might be useful too, perhaps for modeless text. This class is going to be very useful for all the floating scores and text I use for cubes.
The implementation is straightforward. IsoTextPrinter is a singleton state machine. The only passed in parameter is the string itself. Everything else, including the isometric coordinates, colours, alpha etc. can be set by updating the public members. The only members I’ve protected are the instance pointer for the singleton and the orientation, set via a function. No, I don’t know why I made that an exception either.
That was my first singleton. Was it good for you?
Funny, back in ’85, the only Singleton I’d ever heard of was Mike Singleton, the man famous for the seminal Lords of Midnight.
I really enjoyed coding this evening.
One hiccup – I pressed backspace a couple of times over an error and Xcode freaked out and deleted my IsoTextPrinter implementation file. It didn’t just remove it from the Sources organiser, it deleted it off the hard disk. Permanently. It wasn’t even in the trash. A panic Spotlight search revealed nothing. Thank God then, for Time Machine, which had a working version of the file from a few minutes earlier.
Tomorrow, some more XML.
You know that motion-tracked text effect you get nowadays in games and films that’s become really fashionable, where the text is actually part of the scene? (See example above from Splinter Cell)
Well I’d like to do that in Chimera. Lots. The only problem is that I can’t seem to be able to turn off perspective projection.
I’ve tried glOrtho, but that doesn’t seem to be doing it.
That, and some room data meddling, is what I’ve pushed myself through the pain barrier for today.
If anyone has tips on how to get openFrameworks to play nicely with glOrtho, it’d really be appreciated. I’m ill, and now I really must sleep.