Page 1 of 1

How to use 32bit mouse pointers?

Posted: Thu Jan 24, 2013 10:27 pm
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()...

Re: How to use 32bit mouse pointers?

Posted: Fri Jan 25, 2013 10:08 am
by salass00

Re: How to use 32bit mouse pointers?

Posted: Fri Jan 25, 2013 10:36 pm
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