home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / QWGDEMO / QWGDEMO.CP_ / QWGDEMO.CP
Encoding:
Text File  |  1993-02-08  |  2.7 KB  |  91 lines

  1. //    QWGDEMO.CPP opens multiple Graphics Child Windows using:
  2. //
  3. //      _wgopen  _wgclose  _wggetactive  _wgsetactive
  4. //
  5. //      and demonstrates pausing in a Graphics Child Window using:
  6. //      _inchar
  7. //
  8. //
  9. //    This program creates 3 windows, pausing after each to allow you to
  10. //    examine the window before continuing. Try using the scroll
  11. //    bars and arrow keys, switching the GCWs to Full Screen or Size To
  12. //    Fit mode, and resizing the windows.
  13. //
  14.  
  15. #include <iostream.h>
  16. #include <graph.h>
  17.  
  18. void main()
  19. {
  20.  
  21.       int    status, handle, color;
  22.       char   ch;
  23.       long   bgd, prvbgd;
  24.       char   name[] = "SMILEY";
  25.       char   name2[] = "HELLO";
  26.  
  27. //  Send a message to the text window (stdin/stderr/stdout)
  28.      cout <<  "QuickWin Graphics Demo Program.\n" ;
  29.  
  30. //  Pause before continuing
  31.       cout << "\nThis is a text window. Press Enter to continue.\n" ;
  32.       cin.get(ch);               
  33.       
  34.      
  35.  
  36. //  Close the default "Graphic1" GCW (we'll name our own)
  37.       status = _setvideomode( _MAXRESMODE ); 
  38.       handle = _wggetactive( );              
  39.       status = _wgclose( handle );           
  40.  
  41. //  Open a GCW named "SMILEY" in which to draw a smiley face
  42.       handle = _wgopen( name );              
  43.       status = _wgsetactive( handle );       
  44.       status = _setvideomode( _MAXRESMODE ); 
  45.  
  46. //  Draw Smiley's head
  47.       color = 13;
  48.       status = _setcolor( color );
  49.       status = _ellipse( _GFILLINTERIOR, 40, 20, 240, 140 );
  50.  
  51. //  Draw Smiley's eyes, nose, and mouth
  52.       status = _setcolor( color + 1 );
  53.       status = _ellipse( _GFILLINTERIOR, 80, 40, 100, 60 );
  54.       status = _ellipse( _GFILLINTERIOR, 180, 40, 200, 60 );
  55.       status = _ellipse( _GBORDER, 130, 70, 150, 90 );
  56.       status = _arc( 90, 80, 190, 120, 115, 100, 165, 100 );
  57.  
  58.  
  59. //  Pause before continuing
  60.       _settextposition( 1, 6 );
  61.       _outtext("Press any key to continue.");
  62.       status = _inchar( );
  63.  
  64. //  Open a new GCW called "HELLO" and set it for text output
  65.       handle = _wgopen( name2 );
  66.       status = _wgsetactive( handle );
  67.       status = _setvideomode( _TEXTC80 );
  68.  
  69. //  Set background and text colors for the message
  70.       bgd = 1;
  71.       prvbgd = _setbkcolor( bgd );
  72.       status = _settextcolor( color );
  73.  
  74. //  Display a text message in a GCW
  75.       _settextposition( 6, 25 );
  76.       _outtext( "HELLO, WORLD!" );
  77.  
  78. //  Return to default text color & background color
  79.       bgd = _setbkcolor( prvbgd );
  80.       status = _settextcolor( 15 );
  81.  
  82. //  Pause before continuing
  83.       _settextposition( 1, 6 );
  84.       _outtext("Press any key to continue.");
  85.       status = _inchar( );
  86.  
  87. //  Leave the cursor at the start of the line below the message
  88.       _settextposition( 7, 1 );
  89.  
  90. }
  91.