How to use 32bit mouse pointers?

This forum is for general developer support questions.
Post Reply
blmara
Posts: 76
Joined: Thu Jun 23, 2011 10:03 am
Location: Vantaa, Finland

How to use 32bit mouse pointers?

Post by blmara »

Hi! In my application I've tried to use the 32bit mouse pointers included in ENVARC:Sys/, for example def_copypointer.info. But I haven't figured out how to get the image data passed to pointerclass. Here's a snippet from my code (with some debug code that gives valid pointers but the SetWindowPointer() causes quite different pointer to emerge, actually it seems to show the mouse pointer of my editor I use to edit my code (CodeBench). What I have missed?

Marko

Code: Select all

Object *MakePiecePtr(void)
{
	struct BitMap *ptrbmap;
	UBYTE *ptrimagedata;
	ULONG ptrwidth,ptrheight,imgformat;
	Object *pieceptr = NULL;

	if (ptricon = IIcon->GetIconTags(NULL,ICONGETA_GetDefaultName,"copypointer",TAG_DONE))
	{
	    IIcon->IconControl(ptricon,
	      ICONCTRLA_GetBitMap1,&ptrbmap,
	      ICONCTRLA_GetImageData1,&ptrimagedata,
	      ICONCTRLA_GetWidth,&ptrwidth,
	      ICONCTRLA_GetHeight,&ptrheight,
	      ICONCTRLA_GetImageDataFormat,&imgformat,
	      TAG_DONE);
	    D(bug("Pointer bmap %lx, imagedata %lx,width %ld,height %ld\n",ptrbmap,ptrimagedata,ptrwidth,ptrheight));
	    if (imgformat == IDFMT_DIRECTMAPPED)
	      D(bug("Oikea formaatti!\n"));
	    else
	      D(bug("Väärä formaatti!\n"));
	   
	    if (ptrimagedata && imgformat == IDFMT_DIRECTMAPPED)
	    {
	      pieceptr = IIntuition->NewObject(NULL,POINTERCLASS,
                     POINTERA_ImageData,ptrimagedata,
                     POINTERA_Width,ptrwidth,
                     POINTERA_Height,ptrheight,
                     POINTERA_XOffset,-4,
                     POINTERA_YOffset,-4,
                     POINTERA_WordWidth,(ptrwidth + 15) / 16,
                     POINTERA_BitMap,ptrbmap,
                     POINTERA_XResolution,POINTERXRESN_SCREENRES,
                     POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
                     TAG_DONE);
        }
	}
	  

	return(pieceptr);
}
...
   IIntuition->SetWindowPointer(win,pieceptr);
...
   IIcon->FreeDiskObject()...
Marko
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: How to use 32bit mouse pointers?

Post by salass00 »

blmara
Posts: 76
Joined: Thu Jun 23, 2011 10:03 am
Location: Vantaa, Finland

Re: How to use 32bit mouse pointers?

Post by blmara »

Thanks salass00! Modified my code and the problem seems to be actually the POINTERA_BitMap bitmap. When I changed to guideline's 'inbuilt' type bitmap, my code started to work. Actually the LayoutIcon() seems to have no effect, at least on a truecolor screen. The autodoc tells that LayoutIcon() is needed for palette-mapped icons only, but this should be a truecolor icon, shouldn't it?

Marko
Marko
Post Reply