move delay code into separate function.
[AROS.git] / rom / hyperlayers / scrolllayer.c
blob25e695a240a7b305ea003f2ee692c561c7962a26
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/libcall.h>
9 #include <graphics/clip.h>
10 #include <exec/types.h>
11 #include <proto/exec.h>
12 #include <graphics/layers.h>
13 #include <proto/layers.h>
14 #include <proto/graphics.h>
15 #include "layers_intern.h"
17 /*****************************************************************************
19 NAME */
21 AROS_LH4(void, ScrollLayer,
23 /* SYNOPSIS */
24 AROS_LHA(LONG , dummy, A0),
25 AROS_LHA(struct Layer *, l , A1),
26 AROS_LHA(LONG , dx , D0),
27 AROS_LHA(LONG , dy , D1),
29 /* LOCATION */
30 struct LayersBase *, LayersBase, 12, Layers)
32 /* FUNCTION
33 For superbitmapped layers this function work like this:.
34 It updates the contents of the superbitmap with what is
35 visible on the display, repositions the superbitmap
36 and redraws the display.
37 For non-superbitmapped layers, all subsequent (x,y) pairs
38 are adjusted by the scroll(x,y) value in the layer. If
39 ScrollLayer(-10,-3) was called and (0,0) is drawn it will
40 finally end up at coordinates (10, 3) in the superbitmap.
42 INPUTS
43 l - pointer to layer
44 dx - delta x to add to current x scroll value
45 dy - delta y to add to current y scroll value
47 RESULT
50 NOTES
52 EXAMPLE
54 BUGS
55 not tested
57 SEE ALSO
59 INTERNALS
61 HISTORY
62 27-11-96 digulla automatically created from
63 layers_lib.fd and clib/layers_protos.h
65 *****************************************************************************/
67 AROS_LIBFUNC_INIT
69 if (0 == dx && 0 == dy)
70 return;
72 LockLayer(0, l);
74 /* if it's a superbitmapped layer */
75 if ((l->Flags & LAYERSUPER) != 0)
77 /* store the visible "stuff" to the superbitmap */
78 SyncSBitMap(l);
80 l->Scroll_X -= dx;
81 l->Scroll_Y -= dy;
83 /* show what's in the superbitmap */
84 CopySBitMap(l);
86 else
88 l->Scroll_X -= dx;
89 l->Scroll_Y -= dy;
92 UnlockLayer(l);
94 return;
96 AROS_LIBFUNC_EXIT
97 } /* ScrollLayer */