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

  1. /* Copyright 1994-1995 H.Ogasawara(COR.) */
  2.  
  3. #include    <sys_doslib.h>
  4. #include    <corlib.h>
  5.  
  6. #define        GH    512
  7. #define        GV    512
  8.  
  9. #define        DEBUG    0
  10.  
  11. GposSetOffset( x, y, h, v )
  12. {
  13.     int    ax, ay;
  14.     if( WindowGetGraphicMode() != WindowAttrGraphic16 ){
  15.         int    nx, ny;
  16.         WindowGetGraphicOffset( &ax, &ay );
  17. #if DEBUG
  18. {
  19. char b[30];
  20. s_format(b,"GposGetOffset %d,%d\r\n", ax, ay );
  21. PRINT( b );
  22. }
  23. #endif
  24.         if( ax > x ){
  25.             nx= x;
  26.         }else if( ax+GH < x+h ){
  27.             nx= x+h-GH;
  28.         }else
  29.             nx= ax;
  30.         if( ay > y ){
  31.             ny= y;
  32.         }else if( ay+GV < y+v ){
  33.             ny= y+v-GV;
  34.         }else
  35.             ny= ay;
  36.         if( nx < 0 )
  37.             nx= 0;
  38.         if( ny < 0 )
  39.             ny= 0;
  40.         if( nx >= GH )
  41.             nx= GH;
  42.         if( ny >= GV )
  43.             ny= GV;
  44. #if DEBUG
  45. {
  46. char b[30];
  47. s_format(b,"GposSetOf %d,%d\r\n", nx, ny );
  48. PRINT( b );
  49. }
  50. #endif
  51.         if( ax != nx || ay != ny )
  52.             return    WindowSetGraphicOffset( nx, ny,
  53.                             OffsetDefaultLevel );
  54.     }
  55.     return    FALSE;
  56. }
  57.  
  58.