2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <intuition/intuition.h>
8 #include <intuition/intuitionbase.h>
9 #include <intuition/classes.h>
10 #include <intuition/classusr.h>
11 #include <intuition/pointerclass.h>
12 #include <graphics/sprite.h>
14 #include <proto/exec.h>
15 #include <proto/intuition.h>
16 #include <proto/graphics.h>
17 #include <proto/utility.h>
19 #include "intuition_intern.h"
23 #include <aros/debug.h>
25 #include <aros/asmcall.h>
29 struct SharedPointer
*shared_pointer
;
32 /***********************************************************************************/
35 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
37 /***********************************************************************************/
39 #define P(o) ((struct PointerData *)INST_DATA(cl,o))
41 /***********************************************************************************/
48 AROS_UFH3S(IPTR
, dispatch_pointerclass
,
49 AROS_UFHA(Class
*, cl
, A0
),
50 AROS_UFHA(Object
*, o
, A2
),
51 AROS_UFHA(Msg
, msg
, A1
)
58 D(kprintf("PointerClass: cl 0x%lx o 0x%lx msg 0x%lx\n",cl
,o
,msg
));
60 switch (msg
->MethodID
)
63 D(kprintf("PointerClass: OM_NEW\n"));
67 struct TagItem
*tags
= ((struct opSet
*)msg
)->ops_AttrList
;
68 struct BitMap
*bitmap
= (struct BitMap
*)GetTagData(POINTERA_BitMap
, NULL
, tags
);
70 //ULONG xResolution = GetTagData(POINTERA_XResolution, POINTERXRESN_DEFAULT, tags);
71 //ULONG yResolution = GetTagData(POINTERA_YResolution, POINTERYRESN_DEFAULT, tags);
75 struct TagItem
*tagscan
=tags
;
77 while(tagscan
->ti_Tag
!= 0)
79 kprintf(" 0x%08lx, %08lx\n",tagscan
->ti_Tag
,tagscan
->ti_Data
);
87 struct TagItem spritetags
[] =
94 struct ExtSprite
*sprite
;
95 struct BitMap
*spritedata
=(struct BitMap
*)bitmap
;
97 if(spritedata
!= NULL
)
99 spritetags
[0].ti_Data
= GetTagData(POINTERA_WordWidth
,
100 ((GetBitMapAttr(bitmap
, BMA_WIDTH
) + 15) & ~15)>>4, tags
) * 16;
101 spritetags
[1].ti_Tag
= TAG_SKIP
;
102 spritetags
[2].ti_Tag
= TAG_SKIP
;
106 D(kprintf("PointerClass: OM_NEW called without bitmap, using dummy sprite !\n"));
108 spritetags
[0].ti_Data
= 16;
109 spritetags
[1].ti_Tag
= SPRITEA_OutputHeight
;
110 spritetags
[1].ti_Data
= 1;
111 spritetags
[2].ti_Tag
= SPRITEA_OldDataFormat
;
112 spritetags
[2].ti_Data
= TRUE
;
113 bitmap
= (struct BitMap
*)posctldata
;
117 sprite
= AllocSpriteDataA(bitmap
, spritetags
);
119 D(kprintf("PointerClass: extSprite 0x%lx\n",sprite
));
120 D(kprintf("MoveSprite data 0x%lx, height %ld, x %ld, y %ld, num %ld, wordwidth, 0x%lx, flags 0x%lx\n",
121 sprite
->es_SimpleSprite
.posctldata
,
122 sprite
->es_SimpleSprite
.height
,
123 sprite
->es_SimpleSprite
.x
,
124 sprite
->es_SimpleSprite
.y
,
125 sprite
->es_SimpleSprite
.num
,
126 sprite
->es_wordwidth
,
131 struct SharedPointer
*shared
= CreateSharedPointer(sprite
,
132 GetTagData(POINTERA_XOffset
, 0, tags
),
133 GetTagData(POINTERA_YOffset
, 0, tags
),
138 retval
= (IPTR
)DoSuperMethodA(cl
, o
, msg
);
142 o
= (Object
*)retval
;
143 P(o
)->shared_pointer
= shared
;
144 //P(o)->xRes = xResolution;
145 //P(o)->yRes = yResolution;
146 D(kprintf("PointerClass: set extSprite 0x%lx and XOffset %ld YOffset %ld\n",shared
->sprite
,shared
->xoffset
,shared
->yoffset
));
150 D(kprintf("PointerClass: free sprite\n"));
151 ReleaseSharedPointer(shared
, IntuitionBase
);
156 D(kprintf("PointerClass: free sprite\n"));
157 FreeSpriteData(sprite
);
163 D(kprintf("PointerClass: OM_NEW called without bitmap !\n"));
170 struct opGet
*gmsg
= (struct opGet
*)msg
;
172 D(kprintf("PointerClass: OM_GET\n"));
174 switch (gmsg
->opg_AttrID
)
176 case POINTERA_SharedPointer
:
177 *gmsg
->opg_Storage
= (IPTR
)P(o
)->shared_pointer
;
180 case POINTERA_XOffset
:
181 *gmsg
->opg_Storage
= P(o
)->shared_pointer
->xoffset
;
184 case POINTERA_YOffset
:
185 *gmsg
->opg_Storage
= P(o
)->shared_pointer
->yoffset
;
189 retval
= DoSuperMethodA(cl
, o
, msg
);
192 D(kprintf("PointerClass: current extSprite 0x%lx and XOffset %ld YOffset %ld\n",P(o
)->shared_pointer
->sprite
,P(o
)->shared_pointer
->xoffset
,P(o
)->shared_pointer
->yoffset
));
197 D(kprintf("PointerClass: OM_DISPOSE\n"));
198 D(kprintf("PointerClass: extSprite 0x%lx\n",P(o
)->shared_pointer
->sprite
));
199 ReleaseSharedPointer(P(o
)->shared_pointer
, IntuitionBase
);
202 D(kprintf("PointerClass: DoSuperMethod MethodID 0x%lx\n",msg
->MethodID
));
203 retval
= DoSuperMethodA(cl
, o
, msg
);
209 D(kprintf("PointerClass: retval 0x%lx\n",retval
));
213 } /* dispatch_pointerclass */
215 /***********************************************************************************/
219 /***********************************************************************************/
221 struct IClass
*InitPointerClass (struct IntuitionBase
* IntuitionBase
)
223 struct IClass
*cl
= NULL
;
225 /* This is the code to make the image class...
227 if ((cl
= MakeClass(POINTERCLASS
, ROOTCLASS
, NULL
, sizeof(struct PointerData
), 0)))
229 cl
->cl_Dispatcher
.h_Entry
= (APTR
)AROS_ASMSYMNAME(dispatch_pointerclass
);
230 cl
->cl_Dispatcher
.h_SubEntry
= NULL
;
231 cl
->cl_UserData
= (IPTR
)IntuitionBase
;
239 /***********************************************************************************/