home *** CD-ROM | disk | FTP | other *** search
-
- // Handles putting temporary text in the game field. The text may or may
- // not blink; you decide. The defaults are to go with non-blinking text
- // and put it up for 48 renderings (displayed game frames); blinking text
- // defaults to changing on/off status every 4 rendered frames. Helvetica
- // is the default font... note that this object will not dirty up the buffer
- // unless the text explicity needs to be turned on/off (put it up for
- // the first time, remove it at the end of it's life, or a blink) so this
- // means that blinking text will slow things down more than steady text...
-
- #import <gamekit/gamekit.h>
-
- // defaults used by -init and - initAtPoint:pointSize:
- #define GK_DEFAULTPOINTSIZE 12.0
- #define GK_DEFAULTTEXT "Get Ready!"
-
- @interface GKTextActor:GKActor
- {
- BOOL doDraw, doErase, blinking, visible;
- int timeLeftOnScreen, blinkPeriod;
- id text; // a DAYString with the text to render.
- id fontName; // a DAYString with the font's name.
- float pointSize;
- }
-
- + initialize; // initialize the PSWraps for the text drawing
- - init; // initialize to display "Get ready!"
- - initAtPoint:(const NXPoint *)aPoint pointSize:(float)points;
- - initWithInt:(int)aNumber atPoint:(const NXPoint *)aPoint
- pointSize:(float)points; // set up to display the number
- // aNumber at point aPoint with point size points
- - initWithString:(const char *)aString atPoint:(const NXPoint *)aPoint
- pointSize:(float)points; // set up to display an arbitrary
- // string at point aPoint with point size points
-
- // configuration options
- - setTimeLeftOnScreen:(int)anInt; // set how long it is seen on the screen
- - (int)timeLeftOnScreen;
- - setBlinkPeriod:(int)anInt; // will turn blinking on automatically.
- // (turns it off if anInt == 0.)
- - (int)blinkPeriod;
- - setBlinking:(BOOL)anInt;
- - (BOOL)blinking;
- - setFontName:(const char *)name;
- - (const char *)fontName;
-
- // drawing the actor and advancing the internal state machine
- - getBoundingBox:(NXRect *)box; // obtain the true bounding box
- - eraseInDirtPile:dirtPile;
- - markInDirtPile:dirtPile; // same as above but called at different times
- - moveOneFrame;
- - drawActorWithOffset:(NXPoint *)offset; // draw the actor
-
- @end
-