home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / screen34to37.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  3.1 KB  |  79 lines

  1. ;/* screen34to37.c - Execute me to compile me with SAS 5.10
  2. LC -b1 -cfistq -v -y -j73 screen34to37.c
  3. blink FROM LIB:c.o screen34to37.o TO screen34to37 LIB LIB:lc.lib LIB:amiga.lib
  4. quit
  5. */
  6.  
  7. #define INTUI_V36_NAMES_ONLY         /* We'll use the newer Intuition names. */
  8.  
  9. #include <exec/types.h>              /* Amiga data types.              */
  10. #include <intuition/intuition.h>     /* Lots of important Intuition    */
  11. #include <intuition/screens.h>       /* structures we will be using.   */
  12.  
  13. #include <clib/exec_protos.h>        /* Function prototypes            */
  14. #include <clib/dos_protos.h>
  15. #include <clib/intuition_protos.h>
  16.  
  17. #ifdef LATTICE
  18. int CXBRK(void)    { return(0); }    /* Disable Lattice CTRL/C handling */
  19. int chkabort(void) { return(0); }    /* really */
  20. #endif
  21.  
  22. struct Library *IntuitionBase;       /* Intuition library base          */
  23.  
  24. /* Simple example to show how to open a custom screen that gives the new look
  25.  * under V37, yet still works with older version of the operating system.
  26.  * Attach the tag SA_Pens and a minimal pen specification to ExtNewScreen,
  27.  * and call the old OpenScreen() function.  The tags will be ignored by
  28.  * V34 and earlier versions of the OS.  In V36 and later the tags are
  29.  * accepted by Intuition.
  30. */
  31.  
  32. VOID main(int argc, char **argv)
  33. {
  34. UWORD pens[] = { ~0 };               /* This is the minimal pen specification*/
  35. struct Screen      *my_screen;       /* Pointer to our new, custom screen    */
  36. struct ExtNewScreen myscreen_setup;  /* Same as NewScreen with tags attached */
  37. struct TagItem      myscreen_tags[2];/* A small tag array                    */
  38.  
  39. /* Open the library before you call any functions */
  40. IntuitionBase = OpenLibrary("intuition.library",0);
  41. if (NULL != IntuitionBase)
  42.    {
  43.       /* Fill in the tag list with the minimal pen specification */
  44.       myscreen_tags[0].ti_Tag=SA_Pens;
  45.       myscreen_tags[0].ti_Data=(ULONG) pens;
  46.       myscreen_tags[1].ti_Tag=TAG_DONE;
  47.  
  48.       /* The screen is opened two bitplanes deep so that the
  49.       ** new look will show-up better.
  50.       **/
  51.       myscreen_setup.LeftEdge=0;
  52.       myscreen_setup.TopEdge=0;
  53.       myscreen_setup.Width=640;              /* Smaller values here reduce   */
  54.       myscreen_setup.Height=STDSCREENHEIGHT; /* drawing area and save memory.*/
  55.       myscreen_setup.Depth=2;                /* Two planes means 4 colors.   */
  56.       myscreen_setup.DetailPen=0;            /* Normal V34 pen colors.       */
  57.       myscreen_setup.BlockPen=1;
  58.       myscreen_setup.ViewModes=HIRES;
  59.       myscreen_setup.Type=CUSTOMSCREEN | NS_EXTENDED; /* Extended NewScreen flag */
  60.       myscreen_setup.Font=NULL;
  61.       myscreen_setup.DefaultTitle="My Screen";
  62.       myscreen_setup.Gadgets=NULL;
  63.       myscreen_setup.CustomBitMap=NULL;
  64.       /* Attach the pen specification tags to the ExtNewScreen structure */
  65.       myscreen_setup.Extension=myscreen_tags;
  66.  
  67.       if (NULL != (my_screen =
  68.         OpenScreen((struct NewScreen *)&myscreen_setup)));
  69.           {
  70.           /* screen successfully opened */
  71.  
  72.           Delay(200L);  /* normally the program would be here */
  73.  
  74.           CloseScreen(my_screen);
  75.           }
  76.       CloseLibrary(IntuitionBase);
  77.    }
  78. }
  79.