Hey all,
I'm new to Cocoa (and Obj-C) but I'm very proficient in both Java and C.... so for my first real project (aside from hello world and such) I've decided to do an OSX version of tetrinet...
www.tetrinet.org
I'm getting the protocol info from gtetrinet... so it's a derivative work (and will therefore be free), but the rest is being entirely re-done from scratch by me in Obj-C.
I have enough of the backend stuff done now (field coordinates, placing/rotating/moving of blocks in space and collision detection) that I'm ready to start working on an interface.
My question is this. I want to create a view (in Cocoa) that displays the following:
1) a background image
2) a "block" bitmap for each location where a part of block should appear. these need to be scaled from a larger image (say 128x128) to support multiple resolutions.
This view needs to sit inside a regular application window. Ideally, I want it to only update when I send the view class an update message containing data on the filed I want it to draw. This way 1 view class would work for every tetris field, regardless of size/shape.
My quesiton is, what would be the best way to do this? At first I thought a custom NSView would be the way to go, but I'm not sure it allows nearly the amount of draw control I need. Is there any way to create a custom direct quartz view? I also thought about using a (flat) OpenGL view and just texturing the front "face" of my blocks, but this seems like entirely too much work.
I coded a tetris game in Java for a course final at GA Tech long ago, and I remember just creating a sub-window w/ swing and drawing a filled rectangle for each little "block" in the tetris field, updating as necessary... I'd like to be able to do something this simple, but I'm willing to explore the OpenGL option if necessary.
Also, at a later time (once I get the basics done) I plan to add effects; for example a block bomb might overlay an explosion video on a section of the field as the blocks scatter. So whatever option I choose needs to have some future flexibility as far as drawing is concerned.
Sorry this was so long. Basically I want to know what classes/interfaces I should be looking at to do my actual rendering on screen.
Thanks!