home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d599 / dbuff.lha / DBuff / DBuff.doc < prev    next >
Text File  |  1992-02-01  |  3KB  |  96 lines

  1.  
  2.    DBuff
  3.    =====
  4.  
  5.    This program is not in the public domain, but it may be freely copied
  6.    and distributed for no charge providing this header is included.
  7.    The code may be modified as required, but any modifications must be
  8.    documented so that the person responsible can be identified. If someone
  9.    else breaks this code, I don't want to be blamed for code that does not
  10.    work! The code may not be sold commercially without prior permission from
  11.    the author, although it may be given away free with commercial products,
  12.    providing it is made clear that this program is free and that the source
  13.    code is provided with the program.
  14.  
  15. ****************************************************************************
  16.  
  17.    Description:
  18.    ============
  19.    These routines set up, manipulate and tidy up for double buffered
  20.    animation using an Intuition Screen and Window
  21.  
  22. ****************************************************************************
  23.  
  24.    Usage:
  25.    ======
  26.  
  27.    5 routines are supplied:
  28.  
  29. >  RastPort = (struct RastPort *)InitDBuff(GfxBase,Screen,depth,Window)
  30.    --------------------------------------------------------------------
  31.    Given the GfxBase, Screen and Window, this routine returns the
  32.    second RastPort
  33.  
  34.  
  35. >  SetView1()
  36.    ----------
  37. >  SetView2()
  38.    ----------
  39.    Sets the required view ready for drawing. SetView1() sets the Intuition
  40.    view, SetView2() sets the alternate view.
  41.    
  42.  
  43. >  SwapView()
  44.    ----------
  45.    Displays the new view (after drawing)
  46.    
  47.  
  48. >  FreeDBuff(screen,depth,RastPort)
  49.    --------------------------------
  50.    Frees up the memory, etc. for the second view.
  51.  
  52.  
  53.  
  54. ****************************************************************************
  55.  
  56.    How to use:
  57.    ===========
  58.  
  59.    1. Declare a Screen pointer, Window pointer and RastPort pointer as
  60.       normal.
  61.    2. Declare a second RastPort pointer.
  62.    3. Open an Intuition screen as normal with a full size NOBORDER window.
  63.    4. Set the first RastPort to the Intuition RastPort:
  64.       rport1 = window->RPort
  65.    5. Set the second RastPort using a call to InitDBuff():
  66.       rport2 = (struct RastPort *)InitDBuff(GfxBase,screen,DEPTH,window);
  67.    6. Make sure we've got the Intuition view by calling SetView1();
  68.    7. Draw into the *second* RastPort, rport2.
  69.    8. Call SwapView() to get this RastPort displayed.
  70.    9. Make sure we've got the second view by calling SetView2();
  71.   10. Draw into the *first* RastPort, rport1.
  72.   11. Call SwapView() to get this RastPort displayed.
  73.   12. If not finished, go to 6.
  74.   13. Free the second ViewPort, etc. by calling:
  75.       FreeDBuff(screen,DEPTH,rport2);
  76.  
  77.  
  78. ****************************************************************************
  79.  
  80.    Notes:
  81.    ======
  82.  
  83.    1. Assumes both graphics and intuition libraries are open
  84.    2. The window should be NOBORDER and have a null title
  85.    3. For maximum speed in swapping views, the SwapView() call could
  86.       be replaced by the following code.
  87.       Put this up the top somewhere:
  88.          #include <graphics/gfxbase.h>
  89.          struct View *DB_view;
  90.          DB_view = GfxBase->ActiView;
  91.       Replace exch SwapView() call with:
  92.          MrgCpr(DB_view);
  93.    4. #define DEMO to see the demonstration.
  94.  
  95.  
  96.