Welcome to my Programming Blog...

I am currently working on a couple of projects: An original game called "Implosion" which I am porting from Flash to the iPad, and a remake of Q*bert in Python (pygame), as part of the class I am teaching. Please feel free to use the "Labels" (at right) to follow a specific project or theme. If you are one of my Python students, I recommend that you check out the Python thread.

Thursday, April 22, 2010

Graphics on the iPad (simulator)

Hooray! I've got a screenshot here of the various shapes showing up on the iPad Simulator:
Yeah, they're a little dim right now, but they should do the job nicely. I'm going to clone them and fill a grid with these guys!

The next thing I need to do is to really get my mind around how to use these objects as object-oriented graphics. All of these graphics live in a common "_SIO2resource" variable - sort of a set of 3D objects to draw. That's where the shapes live. They have "transformations" associated with each one - they determine the location, size and orientation of the object, but that information lives with the graphics in the _SIO2resource. But I want to be able to have individual objects - instances of custom classes - that have variables and methods beyond those involving their graphical layout. How to reconcile these two schema?

I think that what I will do when I create a new piece is to first duplicate the graphic from the master graphic, which both installs the graphic in _SIO2resource and gives me a variable that I can use to directly refer to the graphic. I'll initialize an instance of a corresponding class and pass the graphic along in the constructor (or a modifier method). That way, both the _SIO2resource and the graphic can both access the transformations for the graphic - the instance object can modify them, and on the next graphical update, the _SIOresource will read the transformations and use them to position, resize and orient the graphics. It'll be great. (If it works.)

No comments:

Post a Comment