I need help starting

eekaydee
Unregistered
 
Post: #1
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?Sad Thanks.
Quote this message in a reply
kainsin
Unregistered
 
Post: #2
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 ).
Quote this message in a reply
Pazolli
Unregistered
 
Post: #3
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.
Quote this message in a reply
Member
Posts: 49
Joined: 2002.05
Post: #4
Quote this message in a reply
eekaydee
Unregistered
 
Post: #5
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?
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #6
Quote:Originally posted by eekaydee
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?
OSErr is a variable that Toolbox functions can use to return if they have an error. Example:
Code:
OSErr err;
err = SomeToolboxThing();
if(err != noErr)
{
    ReportProblem();
}
Quote this message in a reply
Member
Posts: 75
Joined: 2002.04
Post: #7
> 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.

Chris Burkhardt
Quote this message in a reply
aleph0
Unregistered
 
Post: #8
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.
Quote this message in a reply
eekaydee
Unregistered
 
Post: #9
You've all been a great help. Thanks!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
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.
Quote this message in a reply
Post Reply