mpatric.com

Posted Tue 22 Nov 2011 by Michael Patricios , 0 comments

Continuing with my extensions to Apple's Texture2D class, this post is about extending the sprite sheet functionality in part 2 to render sprites of arbitrary size indexed by an atlas. This is more flexible than having all sprites of the same dimension, laid out uniformly in a large texture image. You can even have overlapping sprites and do other funky things as you're in full control over exactly which part of the texture to render.

For example, the following texture atlas is an extension of the sprite sheet used in part 2 and contains sprites of different sizes laid out in no particular way in the image:

Texture atlas

Posted Tue 01 Nov 2011 by Michael Patricios , 0 comments

Continuing with my extensions to Apple's Texture2D class, this post is about extending it to render a sprite from a sprite sheet, which is basically just rendering only part of the texture. Sprite sheets are useful for storing all of the frames for an animated sprite, or simply for storing multiple images in a single texture. It's not only convenient, but can have a positive effect on performance as the texture does not need to be changed from one sprite to the next (although I haven't made this optimisation in the example code, which selects the texture each time).

This simple implementation requires all the sprites to be the same size, laid out from left-to-right and top-to-bottom in the texture. For example, the following sprite sheet was created using some sprites from Prince of Persia:

A sprite sheet

Posted Fri 21 Oct 2011 by Michael Patricios , 1 comment

The Texture2D class was included with Apple's CrashLanding iOS sample application. Many developers pulled it out of this sample app to use in their own apps as a quick and easy way of rendering 2D images of any size and a variety of colour formats in OpenGL. I find it useful, particularly when prototyping ideas, however the class is limited in its functionality. I developed a small set of extensions for Texture2D for my own purposes and thought others might find them useful. This post describes how to extend Texture2D to allow you to rotate it about its center by an arbitrary angle. The Objective-C code is available on github.

Texture2D rotation screenshot

Updated Sun 10 Jul 2011 by Michael Patricios , 6 comments

I recently received notification from Apple that Reversi is a trademark of Ravensburger AG and that I needed to change the name of the application, or take it down. I know that Othello is a trademark (of Anjar Co), but thought that Reversi was a generic name and not a trademark. After some investigation, it transpires that Ravensburger AG have a European trademark for the name. Mattel also held a US trademark for the name, but this lapsed in 1989.

Posted Fri 17 Jun 2011 by Michael Patricios , 0 comments

The code that powers this blog is now available on github. Features include:

  • Admin interface, with support for (unpublished) draft posts and draft versions
  • Anti-spam protection on comments via Akismet
  • Assets stored on Amazon S3
  • Avatars on comments pulled from Gravatar
  • Apps built with this engine can easily be hosted on Heroku
  • Atom feeds for posts and comments
  • Highly customisable

Building a blog using the badass rails engine is straight-forward and quick. A guide is provided with the code.