home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / Sideways / Main.c next >
Encoding:
C/C++ Source or Header  |  1994-01-22  |  2.0 KB  |  116 lines  |  [TEXT/KAHL]

  1. #include <Types.h>
  2. #include <Memory.h>
  3. #include <Quickdraw.h>
  4. #include <Fonts.h>
  5. #include <Events.h>
  6. #include <Menus.h>
  7. #include <Windows.h>
  8. #include <TextEdit.h>
  9. #include <Dialogs.h>
  10. #include <OSUtils.h>
  11. #include <ToolUtils.h>
  12. #include <SegLoad.h>
  13. #include <OSEvents.h>
  14. #include <Desk.h>
  15.  
  16. #include "MSBitMapLib.h"
  17.  
  18.  
  19. EventRecord            gMainEvent;
  20. Rect                gWindowRect;
  21. WindowPtr            gWindowPtr;
  22. Boolean                gUserDone;
  23.  
  24. void Demo_Init(void);
  25. void Draw(void);
  26.  
  27. #pragma segment Main
  28.  
  29.  
  30. void Demo_Init()
  31. {
  32.     InitGraf( &qd.thePort);
  33.     InitFonts();                   
  34.     InitWindows();
  35.     TEInit();
  36.     InitDialogs( NULL );
  37.  
  38.     gUserDone = false;
  39.  
  40.     FlushEvents( everyEvent, nullEvent );
  41.  
  42.     InitCursor();
  43. }
  44.  
  45.  
  46. void Draw(void)
  47. {
  48.     TextSize(24);
  49.     TextFont(bold);
  50.     
  51. /*************************************************************************
  52. This is what you're looking for. This is how to use the routine that 
  53. rotates text. The parameters are: 
  54.     xPixel, 
  55.     yPixel, 
  56.     the string to be rotated.
  57. **************************************************************************/
  58.     MSDrawRotatedText (100,300, (MSStr255)"\pThe Sideways Text");
  59. }   
  60.  
  61.  
  62. void main()
  63. {
  64.     MoreMasters();
  65.     MoreMasters();
  66.     MoreMasters();
  67.     MoreMasters();
  68.  
  69.     Demo_Init();
  70.     gWindowRect = qd.screenBits.bounds;
  71.     InsetRect( &gWindowRect, 30, 30 );
  72.  
  73.     if ( MSColorQDExists())    
  74.     {
  75.         gWindowPtr = NewCWindow(NULL, &gWindowRect, "\p", true, dBoxProc, (WindowPtr)(-1), true, 0L );
  76.         if (gWindowPtr != NULL)
  77.             SetPort( gWindowPtr );
  78.     } 
  79.     else
  80.     {
  81.         gWindowPtr = NewWindow(NULL, &gWindowRect, "\p", true, dBoxProc, (WindowPtr)(-1), false, (long)(WindowPtr)NULL );
  82.         if (gWindowPtr != NULL)
  83.             SetPort( gWindowPtr );
  84.     }
  85.  
  86.     Draw();    
  87.     
  88.     MoveTo( 10, 20 );
  89.     TextSize(12);
  90.     TextFace(0);
  91.     DrawString( "\pPress mouse button or any key to quit." );
  92.  
  93.     do
  94.     {
  95.         SystemTask();
  96.  
  97.         if (GetNextEvent( everyEvent, &gMainEvent )) 
  98.         {
  99.             switch (gMainEvent.what) 
  100.             {
  101.                 case mouseDown:
  102.                     gUserDone = true;
  103.                     break;
  104.  
  105.                 case keyDown:
  106.                 case autoKey:
  107.                     gUserDone = true;
  108.                     break;
  109.  
  110.                 default:
  111.                     break;
  112.             }
  113.         }
  114.     } while (!gUserDone);
  115. }
  116.