 |
 |
Newbie Cocoa Question:
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
lets say i have a function that increments the size of a circle from 1 to 100...
so i have my function:
- (void)startGame  id)sender {
for(x = 10 ; x < 100 ; x++) {
//x is the size of the circle
[self setNeedsDisplay:YES];
}
}
How do I tell is to pause for like 0.1 seconds so it can redraw, because right now, it jumps from 1 to 100 instantaneously. Is there a sleep function like in Java?
Thanks for your help
ALSO: Is it possible to draw a semitransparent object like a circle?
[This message has been edited by 00101001 (edited 05-01-2001).]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status:
Offline
|
|
The proper way would be to start an NSTimer to fire that method every .1 seconds.
------------------
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
Thanks for the tip, ill try that now.
How about drawing semitransparent stuff though?
I looked through the manuals, and couldn't really figure it out (im rather new at this stuff)
Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
If you wanted to set the color (with an alpha), use NSColor's colorWithCalibratedRGB(red, green, blue, alpha) and set() functions, then draw the oval.
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
Sorry, im new...
this is how I think I know how to do it:
[[NSColor colorWithCalibratedRGB:0.5:0.5:0.5:0.5] set];
but when I compile it gives me:
cannot find class (factory) method.
return type for 'colorWithCalibratedRGB::::' defaults to id
what am I doing wrong?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status:
Offline
|
|
Originally posted by 00101001:
Sorry, im new...
this is how I think I know how to do it:
[[NSColor colorWithCalibratedRGB:0.5:0.5:0.5:0.5] set];
It should be like this:
[[NSColor colorWithCalibratedRed:0.5 green:0.5 blue:0.5 alpha:0.5] set];
------------------
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
Oh, heh. I just saw "Java" in your post and assumed you were using Java. Maybe I should read more carefully next time :-)
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
SWEET!!!!
thanks for your help.
Next step: porting my 3D engine to Cocoa, stay tuned!
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|