home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / e / amigae / rkrmsrc / intuition / screens / screen34to37.e < prev   
Text File  |  1995-03-26  |  2KB  |  58 lines

  1. -> screen34to37.e
  2. ->
  3. -> Simple example to show how to open a custom screen that gives the new look
  4. -> under V37, yet still works with older version of the operating system.
  5. -> Attach the tag SA_PENS and a minimal pen specification to ExtNewScreen, and
  6. -> call the old OpenScreen() function.  The tags will be ignored by V34 and
  7. -> earlier versions of the OS.  In V36 and later the tags are accepted by
  8. -> Intuition.
  9.  
  10. -> E-Note: you need to be more specific about modules than C does about includes
  11. MODULE 'intuition/screens', -> Screen data structures and tags
  12.        'graphics/view'      -> Screen resolutions
  13.  
  14. -> Exception values
  15. -> E-Note: exceptions are a much better way of handling errors
  16. ENUM ERR_NONE, ERR_SCRN
  17.  
  18. -> Automatically raise exceptions
  19. -> E-Note: these take care of a lot of error cases
  20. RAISE ERR_SCRN IF OpenS()=NIL
  21.  
  22. PROC main() HANDLE
  23.   -> Pointer to our new, custom screen
  24.   DEF my_screen=NIL:PTR TO screen
  25.  
  26.   -> E-Note: E automatically opens the Intuition library
  27.  
  28.   -> The screen is opened two bitplanes deep so that the new look will show
  29.   -> up better.
  30.   -> E-Note: automatically error-checked (automatic exception)
  31.   -> E-Note: simplified using OpenS
  32.   my_screen:=OpenS(640,             -> Smaller values here reduce the
  33.                    STDSCREENHEIGHT, -> drawing area and save memory.
  34.                    2,               -> Two planes means 4 colours.
  35.                    V_HIRES,
  36.                    'My Screen',
  37.                    -> Attach the pen specification tags
  38.                    -> E-Note: the tag list can be supplied directly
  39.                    -> E-Note: pens is just an INT-typed list
  40.                   [SA_PENS, [-1]:INT,
  41.                    -> E-Note: these tags replace the missing OpenS parameters
  42.                    SA_DETAILPEN, 0,
  43.                    SA_BLOCKPEN,  1,
  44.                    NIL])
  45.  
  46.   -> Screen successfully opened
  47.  
  48.   Delay(200)  -> Normally the program would be here
  49.  
  50.   -> E-Note: exit and clean up via handler
  51. EXCEPT DO
  52.   IF my_screen THEN CloseS(my_screen)
  53.   -> E-Note: we can print a minimal error message
  54.   SELECT exception
  55.   CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n')
  56.   ENDSELECT
  57. ENDPROC
  58.