Quickdraw question

xDexx
Unregistered
 
Post: #1
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
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
w_reade
Unregistered
 
Post: #3
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.
Quote this message in a reply
xDexx
Unregistered
 
Post: #4
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
Quote this message in a reply
cloke
Unregistered
 
Post: #5
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.
Quote this message in a reply
xDexx
Unregistered
 
Post: #6
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
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #7
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.

"When you dream, there are no rules..."
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #8
Quote:Originally posted by xDexx
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
I 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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  QuickDraw? Jones 25 7,344 Feb 5, 2006 09:42 PM
Last Post: Shunter