I need help starting - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: I need help starting (/thread-7602.html)
I need help starting - eekaydee - Aug 20, 2002 12:30 AM
I'm trying to make a game from scratch- first get a working app, then add a window, resize it, etc, until I get a working game. I am having trouble getting a file menu (I used Carbon events to start the event loop.) Anyone know of a really simple step by step code example/tutorial that I can see or any advice? By the way, I have Mark Szymczyk's Mac Game Programming book but the code is too complicated for me to follow. Am I going in the wrong direction? Thanks.
I need help starting - kainsin - Aug 20, 2002 06:02 AM
First off, are you using CodeWarrior or Project Builder? If you've installed either, then you should be able to find the examples that came with them. Also, if you're using CodeWarrior then you probably downloaded the Carbon SDK which came with some examples as well.
You can try downloading some of the sources from here ( iDevGames.com ) and at Apple's developer website ( http://developer.apple.com ).
I need help starting - Pazolli - Aug 20, 2002 07:58 AM
There are lots of different ways to learn how to program. Sometimes they involve books other times they don't. Often if you are going to program without a book (and this is the way I learnt a fair chunk of my programming) then you probably shouldn't start trying to build a new program from scratch. Instead you should try playing around with other people's programs, building the example programs which come with your development tools and perhaps hunting around for a simple tutorial.
If you are completely new to real programming you might find Cocoa a bit easier to work with, though I'll admit its far from the ideal framework to design games. Nevertheless you can still do some really neat stuff with it although it is Mac OS X only. Probably the place to start for Cocoa development is either with this two line tutorial from CocoaDevCentral or with the "CurrencyConverterTutorial.pdf" (don't worry about understanding it just try to make the program it covers). Neither are games so might I then suggest you play around with this simple version of Missile Command (my own work). When I say play around with it I mean think of something really simple to do and then try doing it. For example, in Missile Command searching the "MissileView.m" for "blackColor" and replacing it with "redColor" has predictable results. In the case of Missile Command it was especially designed for the novice programmer and is public domain so you can essentially do what you like with the program including removing my name, making some improvements and releasing it on VersionTracker yourself.
Don't expect that you can program Quake (Mac OS X source code here) after 5 days of work. So just enjoy playing around with things until you feel like going ahead and making your own program from scratch.
If you really feel a compulsion to program using Carbon (perhaps 'cause you like Mac OS 9 or don't have ProjectBuilder) then the similiar sorts of things apply as above except obviously you'd want to hunt down Carbon code.
Either way make sure to check out our sample code as well as Apple's.
Cheers and best of luck to you.
I need help starting - Ian Kerr - Aug 20, 2002 03:37 PM
I need help starting - eekaydee - Aug 21, 2002 02:51 PM
Thank you for being so helpful! I really appreciate it.
I am using MPW, and my computer needs double the memory to handle OSX, so that's why I can't try Cocoa. I looked at some sample code that came with MPW, but I can't make sense of it. For example, what is OSErr? Do I need to study C++ again or do I need to do some reading on Carbon?
I need help starting - Josh - Aug 21, 2002 06:52 PM
Quote:Originally posted by eekaydeeOSErr is a variable that Toolbox functions can use to return if they have an error. Example:
I need help starting - Chris Burkhardt - Aug 21, 2002 07:51 PM
> I looked at some sample code that came with MPW, but I can't
> make sense of it. For example, what is OSErr? Do I need to study
> C++ again or do I need to do some reading on Carbon?
Yes, you need to study Carbon and/or the classic Macintosh Toolbox (check for Apple's "Inside Macintosh" books at your public library). Apple also has very much documentation online.
I need help starting - aleph0 - Aug 22, 2002 10:41 AM
BTW, OSStatus is, I believe, the new name for OSErr, they are both still in heavy use in all of Apple's and 3rd party headers.
I don't know if MPW supports finding in multiple files, but if it does, you can use that to look up typedefs or similar statements of OS types by letting it search your Universal Headers directory.
Alternatively, you could also let sherlock index that folder (or perhaps the entire MPW folder) and use that to quickly search for types you don't know about.
Also, it is a Wise Thing to sign up with apple (http://connect.apple.com it's free) and download the latest headers from them. Learning/using outdated APIs will only make things harder for you.
Also, if you progress a bit, download my Bouncing Around example app with full commented source. (http://www.xfinitegames.com/~arthur/files/Bouncing.sit)
The app shows some simple animation techniques and might be useful for you.
I need help starting - eekaydee - Aug 22, 2002 12:56 PM
You've all been a great help. Thanks!
I need help starting - OneSadCookie - Aug 22, 2002 02:53 PM
IIRC, OSStatus is a 32-bit integer where OSErr is only 16-bit. It's almost always OK to use OSStatus to deal with OSErrs, but it's not always OK to use OSErr to deal with OSStatuses.