Bleah, sick

I’ve come to learn that being ill is an entirely different affair when you’re un/self-employed.  Far more stressful to be unable to work, when you don’t have paid “sick days” supporting you.

Yesterday I was basically unable to think straight, so ended up spending most of the day resting (and playing through the second half of “the Zombie Island of Dr. Ned”, in Borderlands).  It surprises me that that game has not yet hung a lampshade on how often it hangs lampshades on things.  But I still have two more bits of DLC to go through, so there’s still time. (I’m skipping the “arena deathmatch” DLC for now.  Not really feeling well enough to enjoy that sort of challenge at the moment.)

But today, I’m feeling a lot better.  Still not well enough to actually feel like it’d be wise to go out of the house and run errands, but better.  At the very least, my brain’s now working well enough to do a little coding again.

Here’s what I’ve done:

I’ve set up VectorStorm so that it now has an “Orientation” value which you can set on the vsSystem.  You can change this “Orientation” value at any time.  The legal values are “Orientation_Normal”, “Orientation_Three”, “Orientation_Six”, and “Orientation_Nine”, Three, six, and nine being clock positions representing the top of the screen.  (Orientation_Normal perhaps should have been Orientation_Twelve, to follow that naming convention).  If you don’t set an orientation explicitly, you’ll be using Orientation_Normal by default, with the “top” being at the top of your window.

From a game’s point of view, it isn’t aware of what orientation the game is playing in;  everything is translated to and from the requested “orientation” automatically, inside the engine.  This includes graphics, mouse positions, screen sizes, aspect ratios, etc.  From a game’s point of view, it doesn’t know or care which orientation is being used.

So far so good.  This stuff is in the basic VectorStorm engine, and it works on all platforms.  I can’t think of a reason why you’d ever want to make your PC game play as though the right side of the window was actually the top, but you can do it if you ever want to.

I’ve also added a bit of glue code to the iPhone side of things, which keeps track of which orientation iOS thinks is being used.

So with all of these pieces, it’s now trivial for an individual game (on iPhone) to check iOS’s orientation, and tell VectorStorm to match it (if desired).  For example, if iOS says “LandscapeLeft”, we switch VectorStorm’s orientation mode to Orientation_Three.  If iOS reports an orientation that we don’t want to support (say, if we’re making a game that should only ever be played in Landscape mode), then we simply ignore it, and let VectorStorm continue operating in whatever orientation we prefer.