QuickDraw? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: QuickDraw? (/thread-4565.html)
Pages: 1 2
QuickDraw? - Jones - Feb 2, 2006 04:22 PM
I recently got my hands on a copy of "Mac Game Programming" by Mark Szymczyk for only 10$ at a local book sale.
The book looked pretty good at first, but I then realized that it uses Sprockets and QuickDraw, and C++.
What's wrong with that?
I've heard it mentioned here, and other places several times that C is better than C++, although I myself don't know why yet. I've also heard that Apple will most likely totally kill the sprocket system very soon. (Do the x86 machines support sprockets?) The book was written in the times of Project Builder and OS 10.2.
Should I not bother with the reading? I've also got "Programming Linux Games" by Loki Software, Inc & John R. Hall and it looks pretty good. It uses SDL and OpenAL, and they both work on mac so I think I'll be able to work my way around the whole "I don't use linux!" issue. And quite frankly, if QuickDraw's dead, I'd rather learn something that won't be obsolete for while.
QuickDraw? - Taxxodium - Feb 2, 2006 04:27 PM
I have that book aswell (Mac Game Programming) and while it is outdated (which book isn't), it covers some very good techniques for game development.
QuickDraw has been replaced by Quartz and OpenGL, whereas the sprockes have been replaced by the HID Manager (which is covered in the book).
Most of the code in the book can be ported to the new fameworks, but that's not what the book is about in my eyes. It's about mastering the techniques to become a good game developer.
As far as C/C++ goes. C++ is object oriented and has some very odd thingies. C is cleaner but it can be used to reflect OOP.
QuickDraw? - akb825 - Feb 2, 2006 04:40 PM
For C vs. C++, C++ is better if you have lots of inheritence with virtual functions, use a lot of operator overloading, function overloading, or generics. C if you want to have a little speed boost. For general OOP stuff, I find C just as easy as C++. Even simple inheritance is fairly easy. (if you have a struct, then several other structs where the first items are the same as the first struct's items, you can type cast a pointer to one struct to the first struct and access the common items, for example; you could even have your own function table for virtual functions if youw anted to) You ca basically do anything with C that you can with C++, but once you get beyond the basic OOP, it's just more work in C than C++.
QuickDraw? - AnotherJake - Feb 2, 2006 05:41 PM
Ugh, the C/C++ confusion/debate will never, ever, end... Many of us don't like C++ for various reasons, and many of us don't like C for counter reasons, but it's not because either isn't capable or powerful. Indeed the argument can easily be made either way as to which is better. The bottom line is that you'll have to decide for yourself as you learn to program. No matter what, if you want to learn C++ or even Objective-C (which is used primarily with the Cocoa API), you have to learn C anyway, so you might as well start there. You can move on to C++ after that, and even though I prefer C, I do fully recommend learning C++. C++ is indeed more complicated, but with that complication comes more power. Some of us feel that extra complication to get the extra power isn't worth it. Others do... That's just the way it is.
On the books, you will end up reading more than one for sure. Starting with "Mac Game Programming" might throw you off into older technologies, but like Taxxodium said, it won't hurt on the general techniques you should learn. Sadly, there aren't any other books specifically for Mac game programming (that I know of), so you'll probably have to learn to read PC or Linux based ones anyway. I haven't seen "Programming Linux Games" so I wouldn't know for sure, but it couldn't hurt to read that one concurrently. SDL and OpenAL are modern and up to date for the task of game programming on the Mac. Learning how to program games can be very hard, and on the Mac it can be even harder since most documentation is PC oriented. You'll have to put in extra effort to make it over the first hump. Good luck!
QuickDraw? - Jones - Feb 2, 2006 07:12 PM
I actually prefer C for reasons that I don't exactly know, probably because I'm learning OpenGL in it, and also because it doesn't have the little annoying ">>" and "<<" things when your using the in/out commands. (printf & scanf vs. cout & cin)
And now, while I'm not trying to start an argumet, I must ask:
Which do you choose/think is better, and why. SDL or OpenGL?
And then, another question, how powerful is quartz? How easy to use is it? I've never really remarked any programs saying "Made with quartz!" or anything like that... or maybe I'm just ignorant to them.
QuickDraw? - AnotherJake - Feb 2, 2006 07:27 PM
Hmph, I actually like the << and >> of C++, but it's one of the few features that I do. You can do OpenGL with C++ just the same, BTW. Preferring C, just because you like working with it isn't silly though, and I wouldn't complain. Most beginner code and other code samples are done in C because that's the most universally known of the power languages (that doesn't mean that you can't stick with it for the rest of your programming career though, you may never need to touch C++ if you are so inclined). Like I mentioned, you have to know it to do C++ anyway.
You use OpenGL and SDL together. OpenGL is a graphics library and does not handle things like input, sound, windowing, etc. SDL does. GLUT does some system level handling too, so it is not to be totally disregarded either, but SDL is pretty popular around here and does more.
Quartz is totally freakin' awesome, but it isn't well suited to the needs of high-performance interactive graphics like games - unless it's like a simple puzzle game or something that doesn require the highest of performance. I recommend anyone who is doing Cocoa give Quartz a little more than a glance, but realize that it won't solve all problems. OpenGL for graphics is the preferred path for games.
QuickDraw? - Jones - Feb 2, 2006 07:49 PM
Yes, I'm experimenting with GLUT and OpenGL. Or I would be, if my iBooks logic board wasn't having issues. I'm currently on an old titanium powerbook, and I really don't want to start working on stuff and then having to transfer it, etc. Call me lazy if you like.
The problem I have with learning to combine things like SDL and OpenGL is probably a stupid one.
So far, all the "real" game programming I've done is with basics, and I'm only just finally understanding GLUT, etc.
The thing is, basics are insanely easy to load data with. For example, this is how you would load a texture and paste it onto a matrix with Dark Basic:
Quote:REM clear the screen, hide the mouse and start the sync(ing?)
Insanely easy looking right? Well that's simple code, complicated stuff gets impossible with Dark Basic just because the language has crap for model/map support and terrible built in collision.
But anyway, note the "image slot" feature. I've been looking at the image loading tutorials over at NeHe, and I don't understand how C and GLUT can work together with these strange new "image streams" and stuff. How do they know it's an image? What is a "stream"? Is it like a "slot"?
I've been using programming languages that are way too easy all my life, and now I'm confused by simple things like loading images!
QuickDraw? - akb825 - Feb 2, 2006 07:53 PM
The << and >> is basically making use of operator overloading, which you can do with any object you create, as well. Basically, you can overload just about any operator for any object. For example, you can overload the +, -, *, /, and ^ operators to do arithmetic with a complex number object. (one is actually included with the standard library) You can also overload castings. You can do something like override the (char *) cast, and cast an object to char * to get a string description.
QuickDraw? - PowerMacX - Feb 2, 2006 08:00 PM
Jones Wrote:I actually prefer C for reasons that I don't exactly know, probably because I'm learning OpenGL in it, and also because it doesn't have the little annoying ">>" and "<<" things when your using the in/out commands. (printf & scanf vs. cout & cin)
You don't have to use cin & cout. I use C++ all the time, but still hold on to my old friend/foe printf.
Jones Wrote:And now, while I'm not trying to start an argumet, I must ask:
Actually, SDL + OpenGL. OpenGL doesn't have any windowing system, nor does it handle events (keyboard, mouse, etc). SDL provides a basic windowing system (one window or fullscreen) and handles events. So, if you want to use OpenGL, you need a way to create a window and to handle events, be it SDL or something else. You can also use native Cocoa if you are willing to learn Objective C (btw, the Mac version of SDL is actually written in Cocoa).
SDL can also stand on its own, since it provides basic graphic functions, but on the Mac at least, it isn't fast enough for games, so it is almost required to use OpenGL with it if you want decent performance.
Jones Wrote:And then, another question, how powerful is quartz? How easy to use is it? I've never really remarked any programs saying "Made with quartz!" or anything like that... or maybe I'm just ignorant to them.
For your first game, or for a simple game that doesn't involve lots of moving/animated items, it can work just fine. There are a few games that use Quartz, some made by iDevGames members and that took part in previous iDG contests, including uDG.
QuickDraw? - AnotherJake - Feb 2, 2006 08:30 PM
PowerMacX Wrote:Actually, SDL + OpenGL...Is my account set to ignore mode?
QuickDraw? - PowerMacX - Feb 2, 2006 08:51 PM
AnotherJake Wrote: Is my account set to ignore mode?
Actually, I typed the whole post before you posted yours (...and Jones posted his response... and akb825 posted his comment about << >>), but switched to another tab and forgot to hit "Submit Reply".
QuickDraw? - AnotherJake - Feb 2, 2006 08:55 PM
Ha! I thought that was kinda weird...
QuickDraw? - sealfin - Feb 3, 2006 04:55 AM
AnotherJake Wrote:Sadly, there aren't any other books specifically for Mac game programming (that I know of)[...snip...]
Pangea Software's Ultimate Game Programming Guide for Mac OS X? I've never read it, but from a reading of the info page, it seems to be more up to date...
QuickDraw? - AnotherJake - Feb 3, 2006 09:53 AM
Wow, I totally forgot about that one. It's actually a really nice book, and a definite must-have on any aspiring Mac game programmer's shelf. I have a few small gripes about some of his approaches (for instance, I don't think using GetKeys is a good idea at all nowadays), but overall it is jam-packed with useful information. It is not for the complete novice, however. It doesn't do much to walk beginners through the process in a thorough manner, but there are lots of good tips and hints about the process which I think even beginners will find useful in conjunction with other texts to refer to. But, it's from Brian Greenstone himself, and he's achieved quite remarkable success with his game titles over the years, and he is Mac-only all the way. Who can beat that?
QuickDraw? - szymczyk - Feb 3, 2006 11:35 AM
I have written some articles that update the Mac Game Programming book material. You can read them using the URL in my signature.