Added missing properties.
[AROS.git] / rom / graphics / changeextspritea.c
blob771044ae38a4ff1db28618b6e0907d059340bde8
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ChangeExtSpriteA()
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <graphics/gfxbase.h>
11 #include <graphics/clip.h>
12 #include <graphics/view.h>
13 #include <graphics/sprite.h>
14 #include <utility/tagitem.h>
15 #include <proto/utility.h>
17 #include "gfxfuncsupport.h"
18 #include "graphics_intern.h"
20 /*****************************************************************************
22 NAME */
23 #include <proto/graphics.h>
25 AROS_LH4(LONG, ChangeExtSpriteA,
27 /* SYNOPSIS */
28 AROS_LHA(struct ViewPort *, vp, A0),
29 AROS_LHA(struct ExtSprite *, oldsprite, A1),
30 AROS_LHA(struct ExtSprite *, newsprite, A2),
31 AROS_LHA(struct TagItem *, tags, A3),
33 /* LOCATION */
34 struct GfxBase *, GfxBase, 171, Graphics)
36 /* FUNCTION
38 INPUTS
39 vp - pointer to ViewPort structure that this sprite is
40 relative to, or NULL if relative only top of View
41 oldsprite - pointer to the old ExtSprite structure
42 newsprite - pointer to the new ExtSprite structure
43 tags - pointer to taglist
45 RESULT
46 success - 0 if there was an error
48 NOTES
50 EXAMPLE
52 BUGS
54 SEE ALSO
56 INTERNALS
57 This is a minimal implementation which supports only single sprite #0
58 for mouse pointer.
60 With vp set to NULL the function always fails at the moment.
62 HISTORY
65 ******************************************************************************/
67 AROS_LIBFUNC_INIT
69 OOP_Object *bitmap;
70 struct monitor_driverdata *mdd;
71 LONG res;
73 D(bug("ChangeExtSpriteA(0x%p, 0x%p, 0x%p)\n", vp, oldsprite, newsprite));
75 /* We have only sprite #0 for the mouse pointer */
76 if (newsprite->es_SimpleSprite.num)
77 return 0;
79 /* Pick up position from old sprite */
80 newsprite->es_SimpleSprite.x = oldsprite->es_SimpleSprite.x;
81 newsprite->es_SimpleSprite.y = oldsprite->es_SimpleSprite.y;
82 D(bug("Sprite position: (%d, %d)\n", newsprite->es_SimpleSprite.x, newsprite->es_SimpleSprite.y));
84 bitmap = OBTAIN_HIDD_BM(newsprite->es_BitMap);
85 D(bug("HIDD bitmap object: 0x%p\n", bitmap));
87 if (vp) {
88 /* Pick up display driver from ViewPort's bitmap */
89 mdd = GET_BM_DRIVERDATA(vp->RasInfo->BitMap);
90 res = HIDD_Gfx_SetCursorShape(mdd->gfxhidd, bitmap, 0, 0);
91 if (res)
92 HIDD_Gfx_SetCursorVisible(mdd->gfxhidd, TRUE);
93 } else
94 /* TODO: NULL ViewPort means Amiga(tm) chipset display */
95 res = FALSE;
97 RELEASE_HIDD_BM(bitmap, newsprite->es_BitMap);
98 return res;
100 AROS_LIBFUNC_EXIT
101 } /* ChangeExtSpriteA */