home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-21 | 3.9 KB | 159 lines | [TEXT/CWIE] |
- //===================================================================
- //======================= Headers =============================
-
- #include "FloatWindow.h"
- #include "GameUtilities.h"
- #include "Screen.h"
-
- //===================================================================
- //======================= Globals =============================
-
-
- //===================================================================
- //======================= #define =============================
-
-
- //===================================================================
- //======================= Function Prototypes =====================
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: Constructor
-
- \----------------------------------------------------------------------------*/
- FloatWindow :: FloatWindow( void )
- {
-
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: Init
-
- \----------------------------------------------------------------------------*/
- Boolean FloatWindow :: SetUp( short pic , short w , short h , short xLoc , short yLoc )
- {
- width = w;
- height = h;
-
- screenLoc.left = xLoc;
- screenLoc.top = yLoc;
- screenLoc.right = screenLoc.left + width;
- screenLoc.bottom = screenLoc.top + height;
-
- return window.LoadPicBuff( pic );
-
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: HandleMouseClick
-
- \----------------------------------------------------------------------------*/
- void FloatWindow :: HandleMouseClick( Boolean down , point where )
- {
- if( down )
- {
- draging = true;
- start = where;
- }
- else
- {
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
-
- screen.AddRectToUpdate( screenLoc );
-
- draging = false;
- }
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: HandleMouseMove
-
- \----------------------------------------------------------------------------*/
- void FloatWindow :: HandleMouseMove( point where )
- {
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
- start = where;
-
- screen.AddRectToUpdate( screenLoc );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: PointInWindow
-
- - just saids if the point it inside the window area or not
- \----------------------------------------------------------------------------*/
- Boolean FloatWindow :: PointInWindow( point where )
- {
- return SectPtRect( where , screenLoc );
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: Active
-
- \----------------------------------------------------------------------------*/
- Boolean FloatWindow :: Front( void )
- {
- return( front );
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: SetFront
-
- \----------------------------------------------------------------------------*/
- void FloatWindow :: SetFront( Boolean f )
- {
- front = f;
- }
-
- /*----------------------------------------------------------------------------\
-
- FloatWindow :: DrawToScreen
-
- \----------------------------------------------------------------------------*/
- void FloatWindow :: DrawToScreen( rect *where , Boolean backGround )
- {
- if( !backGround )
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , 0 , 0 , 0 );
- }
- else
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , 0 , 0 , 0 );
- }
- }
- else
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , kDrawTint , 16 , 0xffff );
- }
- else
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , kDrawTint , 16 , 0xffff );
- }
- }
-
- }
-