home *** CD-ROM | disk | FTP | other *** search
-
- DBuff
- =====
-
- This program is not in the public domain, but it may be freely copied
- and distributed for no charge providing this header is included.
- The code may be modified as required, but any modifications must be
- documented so that the person responsible can be identified. If someone
- else breaks this code, I don't want to be blamed for code that does not
- work! The code may not be sold commercially without prior permission from
- the author, although it may be given away free with commercial products,
- providing it is made clear that this program is free and that the source
- code is provided with the program.
-
- ****************************************************************************
-
- Description:
- ============
- These routines set up, manipulate and tidy up for double buffered
- animation using an Intuition Screen and Window
-
- ****************************************************************************
-
- Usage:
- ======
-
- 5 routines are supplied:
-
- > RastPort = (struct RastPort *)InitDBuff(GfxBase,Screen,depth,Window)
- --------------------------------------------------------------------
- Given the GfxBase, Screen and Window, this routine returns the
- second RastPort
-
-
- > SetView1()
- ----------
- > SetView2()
- ----------
- Sets the required view ready for drawing. SetView1() sets the Intuition
- view, SetView2() sets the alternate view.
-
-
- > SwapView()
- ----------
- Displays the new view (after drawing)
-
-
- > FreeDBuff(screen,depth,RastPort)
- --------------------------------
- Frees up the memory, etc. for the second view.
-
-
-
- ****************************************************************************
-
- How to use:
- ===========
-
- 1. Declare a Screen pointer, Window pointer and RastPort pointer as
- normal.
- 2. Declare a second RastPort pointer.
- 3. Open an Intuition screen as normal with a full size NOBORDER window.
- 4. Set the first RastPort to the Intuition RastPort:
- rport1 = window->RPort
- 5. Set the second RastPort using a call to InitDBuff():
- rport2 = (struct RastPort *)InitDBuff(GfxBase,screen,DEPTH,window);
- 6. Make sure we've got the Intuition view by calling SetView1();
- 7. Draw into the *second* RastPort, rport2.
- 8. Call SwapView() to get this RastPort displayed.
- 9. Make sure we've got the second view by calling SetView2();
- 10. Draw into the *first* RastPort, rport1.
- 11. Call SwapView() to get this RastPort displayed.
- 12. If not finished, go to 6.
- 13. Free the second ViewPort, etc. by calling:
- FreeDBuff(screen,DEPTH,rport2);
-
-
- ****************************************************************************
-
- Notes:
- ======
-
- 1. Assumes both graphics and intuition libraries are open
- 2. The window should be NOBORDER and have a null title
- 3. For maximum speed in swapping views, the SwapView() call could
- be replaced by the following code.
- Put this up the top somewhere:
- #include <graphics/gfxbase.h>
- struct View *DB_view;
- DB_view = GfxBase->ActiView;
- Replace exch SwapView() call with:
- MrgCpr(DB_view);
- 4. #define DEMO to see the demonstration.
-
-
-