Quickdraw question
im trying to write a game using Quickdraw, i know its the best graphics technology but its simple and i want to work my way up. so here is the question. lets say i have a line moving across the screen, the line leaves a trail. i do not want a trail. im assuming that the screen just isnt being cleared, how do i do this?
xDexx
xDexx
Is this Classic or Carbon? For Classic, you can call EraseRect(&theWindow->portRect) but for Carbon you probably have to call something else that I don't know off the top of my head.
GetPortBounds(yourPort, &someRect);
EraseRect(&someRect);
should do it.
Or you could draw the old line again in the background colour, effectively erasing everything you need to at the moment, and draw the new line in the foreground colour. Just a possibility.
EraseRect(&someRect);
should do it.
Or you could draw the old line again in the background colour, effectively erasing everything you need to at the moment, and draw the new line in the foreground colour. Just a possibility.
ok so in order to do graphics properly i need to use an offscreen graphics port? right now its in classic but i want it to be carbon. is there a quickdraw website around that has totorials? apples site doesnt help too much. thanks
xDexx
xDexx
It might be worth a look to check out the MissleCommand Carbon from the source code section. I recently updated it to carbon and all the graphics are done using QuickDraw routines (ie, DrawLine, DrawOval, etc).
It is in straight C and is very simple.
It is in straight C and is very simple.
this whole offscreen graphics port is just confusing! can someone write or point me toward some code that shows how to make an off screen graphics world, draw something simple on it, copy it to the window? thanks
xDexx
xDexx
Aah the joy of offscreens. Don't feel bad, I used to have problems with the understanding of that but now I get it:
You make an offscreen by making a CGrafPort, here is how:
All you have to do to create the offscreen is do a call to NewGWorld() this will return a CGrafPtr (i think).
Save the current port by calling GetPort. Then, you just SetPort() to the offscreen you just created. Do your drawing and the LockPixels(). SetPort() to the screen (or to another offscreen) and then CopyBits() from the offscreen to the screen (or other offscreen). Don't forget to UnlockPixels and SetPort() to the old port and old Device.
Take a look at the functions I mentioned and you should get a basic understanding of how this works.
You make an offscreen by making a CGrafPort, here is how:
All you have to do to create the offscreen is do a call to NewGWorld() this will return a CGrafPtr (i think).
Save the current port by calling GetPort. Then, you just SetPort() to the offscreen you just created. Do your drawing and the LockPixels(). SetPort() to the screen (or to another offscreen) and then CopyBits() from the offscreen to the screen (or other offscreen). Don't forget to UnlockPixels and SetPort() to the old port and old Device.
Take a look at the functions I mentioned and you should get a basic understanding of how this works.
"When you dream, there are no rules..."
Quote:Originally posted by xDexxI have some very simple code that I made while teaching myself about offscreen ports. If you like, I will email it to you. It is not Carbonized but that should make little difference.
this whole offscreen graphics port is just confusing! can someone write or point me toward some code that shows how to make an off screen graphics world, draw something simple on it, copy it to the window? thanks
xDexx
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| QuickDraw? | Jones | 25 | 6,870 |
Feb 5, 2006 09:42 PM Last Post: Shunter |
|

