home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------
-
- CPluginDrawing.cpp
-
- Draws stuff in the window.
-
- ---------------------------------------------------------------*/
-
-
- #include "CPluginDrawing2.h"
- #include "UDrawingState.h"
- #include <stdio.h>
-
- short CPluginDrawing::sCount = 0;
-
-
- CPluginDrawing::CPluginDrawing()
- {
- sCount++;
- }
-
- void CPluginDrawing::Initialize()
- {
-
- mFirstTime = true;
-
- ::GetDateTime( &mNextTime );
- mNextTime =+ 10;
- }
-
- void CPluginDrawing::SetDrawingRect( Rect inRect )
- {
- mFrameRect = inRect;
- mWidth = inRect.right - inRect.left;
- mHeight = inRect.bottom - inRect.top;
-
- }
- void CPluginDrawing::DrawFrame()
- {
- StColorState theState;
- StTextState theText;
-
- ::RGBForeColor(&Color_White);
- ::RGBBackColor(&Color_Black);
-
- if ( mFirstTime ) {
- ::EraseRect( &mFrameRect );
- mFirstTime = false;
- }
-
- ::TextSize( 15 );
-
- unsigned long now;
- ::GetDateTime( &now );
-
- if ( now > mNextTime ) {
- mNextTime = now;// + 1;
- long newTop, newLeft;
- newTop = Random(); newLeft = Random();
- newTop = ((newTop+32767) * mFrameRect.bottom)/65536;
- newLeft = ((newLeft+32767) * mFrameRect.right)/65536;
-
-
- ::MoveTo( newLeft, newTop );
- Str255 string;
-
- sprintf( (char*)string, "Wow! #%d", sCount );
- c2pstr( (char*) string );
- ::DrawString( string );
-
- }
- }
-
- void CPluginDrawing::Terminate()
- {
-
- }
-
-