home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / corlib / GposSetClear.c < prev    next >
C/C++ Source or Header  |  1995-02-25  |  930b  |  40 lines

  1. /* Copyright 1994-1995 H.Ogasawara(COR.) */
  2.  
  3. #include    <sys_doslib.h>
  4. #include    <corlib.h>
  5. #include    <HS_wlib.h>
  6.  
  7. #define        GH    512
  8. #define        GV    512
  9.  
  10. GposSetClear( wp, dp, c1, c2 )
  11. WindowID    wp;
  12. DrawBuf        *dp;
  13. {
  14.     if( WindowGetGraphicMode() != WindowAttrGraphic16 ){
  15.         int    ax, ay, rx, ry, rx2, ry2;
  16.         WindowGetScreenPosition( wp, &rx, &ry );
  17.         WindowGetGraphicOffset( &ax, &ay );
  18.         rx2= rx+HS_WindowGetViewSizeX(wp);
  19.         ry2= ry+HS_WindowGetViewSizeY(wp);
  20.         if( !(ax <= rx && ax+GH >= rx2 && ay <= ry && ay+GV >= ry2) ){
  21.             int    x, y, x2, y2;
  22.             x= ax > rx ? ax-rx : 0;
  23.             y= ay > ry ? ay-ry : 0;
  24.             x2= ax+GH > rx2 ? rx2-rx : ax+GH-rx;
  25.             y2= ay+GH > ry2 ? ry2-ry : ay+GH-ry;
  26.             if( x < x2 && y < y2 ){
  27.                 DrawSetClear( dp, c2 );
  28.                 DrawSetLine( dp+1, x, y, x2-1, y2-1, c1,
  29.                             OptionFill );
  30.                 return    2;
  31.             }
  32.             DrawSetClear( dp, c2 );
  33.             return    1;
  34.         }
  35.     }
  36.     DrawSetClear( dp, c1 );
  37.     return    1;
  38. }
  39.  
  40.