Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Game Programming in Cocoa

Game Programming in Cocoa
Thread Tools
Junior Member
Join Date: Sep 2000
Location: Calgary, Alberta, Canada
Status: Offline
Reply With Quote
Jan 17, 2001, 07:59 PM
 
Any resources??

Help would be greatly appreciated.
"The pool on the roof must have a leak"
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: San Jose, CA USA
Status: Offline
Reply With Quote
Jan 18, 2001, 12:14 AM
 
Well, you can check out the BlastApp demo that should be on the developer CD; it's a simple '80s-style arcade game with a helicopter.
I guess it really depends what kind of game you want to write. If you want to do a 3D game, the really important API for you is OpenGL. You'll need to use Cocoa or Carbon to host the application and manage menus/windows/files, but that's not the majority of your code.
     
exrae  (op)
Junior Member
Join Date: Sep 2000
Location: Calgary, Alberta, Canada
Status: Offline
Reply With Quote
Jan 18, 2001, 06:11 PM
 
Well the game I had in mind is 2D,
But I haven't any idea where to begin
with Mac OS X.
"The pool on the roof must have a leak"
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Jan 18, 2001, 06:20 PM
 
Well, if the game that you wish to do is something like a card game, ie you just click on something, no complex controls or anything, then you could do that with a subclass of NSView. Take a look at one of apple's included App Kit samples, I think it's called compositor or something like that, it was included with the PB Developer CD. It shows how you can break up an NSView subclass into smaller regions and draw in those and do some effects. I know that you can put an NSImage into an NSView, but I have never tried. In the NSView documentation it goes over how to recieve and track events, like mouseclicks and stuff. If all you want to do is something like chess all that should be sufficient. If you want to do something more complex, like Pacman or something, then I don't really know what you can do.
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Jan 29, 2001, 12:15 PM
 
This is also of some interest to me as well. I need to know how to write to an NSView subclass with NSImage (I am trying to write a 2D game). I will keep looking for the documentation I need and will post a reply here if I can answer my question before anyone else. I was also wondering if NSImage can draw a bitmap with some degree of transarency. If anyone has any idea how to receive mouse click events in the view, that would also be very greatly appreciated.

Thanks,
Jeff.

PS: exrae, ICQ (or, Fire, more accurately) me some time (#7027184). It sounds like we may be able to halp each other.
Spectral Class
"Shedding Light on Innovation"
     
Junior Member
Join Date: Jan 2001
Location: Seattle, WA
Status: Offline
Reply With Quote
Jan 29, 2001, 11:06 PM
 
Why not just use OpenGL? It already supports translucency, it makes rotation, scaling and smoothing of sprites completely painless, and it is accelerated in hardware. You wouldn't need a z-buffer either, which would increase the number of sprites that could be stored in VRAM.
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Jan 31, 2001, 09:51 AM
 
I would be all for OpenGL because I think that in a few years 2D games will almost cease to exist but I don't know how to program OpenGL and all of the examples that came with the develooper tools are more complicated. If anyone knows of any straight-forward OS X cocoa OpenGL examples or tutorials, E-Mail me because I really do want to learn that. Or if someone can write a simple example and post a link to it here. Just something simple like a cube on a black background with the code documented to the point where we know how it does what it does. I just need the very basics like this outlined and then I will be able to figure out the more complicated stuff from the examples that Apple distributed.

Can anyone help with this?
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jan 31, 2001, 10:29 AM
 
Yeah, I wrote a simple NSOpenGLView example that is here (if my computer is in OS X)
http://gilgalad.dyndns.org/

You should be able to get it from there, the file is OpenGL.tar

or for right now, 24.48.124.9 is my IP.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jan 31, 2001, 10:31 AM
 
It doesn't have any comments now, but I'll add a README file and source comments some time this week.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:16 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2