pointerclass example available??

8 posts / 0 new
Last post
LyleHaze
LyleHaze's picture
Offline
Last seen: 1 year 4 months ago
Joined: 2011-05-26 03:58
pointerclass example available??

Might be Intuition, might be Graphics, might be that grey area in between.
I have been fighting with creating pointers using pointerclass, and so far
I'm not having much luck. I'm NOT loading .iff files, nor using icon files in
prefs:system.. I'm trying to create bitmaps with the desired pointer graphics dynamically. Through all my failed attempts, it now looks something like:

Open a window and draw the desired pointer graphics there.
IGraphics->AllocBitMap a bitmap,
BltBitMap from my window to the new bitmap
NewObject("bitmap.image"), copying from the above bitmap (I'll try anything)
NewObject("pointerclass") from either of the above bitmaps
Finally, IIntuition->SetWindowAttr(WA_Pointer) with the pointerclass-created object

At this point, I don't care if the pointers I create are full-color,4 color, or monochrome. Color is nice, but not necessary.

If anyone has source examples that might help, I'd be most appreciative.

Thanks,
Lyle

trixie
trixie's picture
Offline
Last seen: 5 months 5 hours ago
Joined: 2011-02-03 13:58
Why are you creating a

Why are you creating a bitmap.image at all? As far as I can see, the pointer class does not take a BOOPSI image object as input: the bitmap is referenced directly.

I've never used the pointer class before but I guess you should do something like:

  1. Object *myPointer;
  2. struct BitMap *myBitMap;
  3. struct Window *myWindow;
  4. uint16 wordWidth; /* Width of the image in number of words. */
  5.  
  6. ...
  7.  
  8. AllocBitMap(), BltBitMap() etc.
  9.  
  10. ...
  11.  
  12. myPointer = IIntuition->NewObject(NULL, "pointerclass",
  13. POINTERA_BitMap, myBitMap,
  14. POINTERA_WordWidth, wordWidth,
  15. POINTERA_XResolution, POINTERXRESN_SCREENRES,
  16. POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT,
  17. TAG_DONE);
  18.  
  19. IIntuition->SetWindowAttrs(myWindow, WA_Pointer, myPointer, TAG_DONE);

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
Guideline - Mousepointers on

Guideline - Mousepointers on OpenAmiga.org (shows how to do a truecolour pointer with 4-colour fallback graphics):
http://openamiga.org/?function=viewpage&pageid=23

Code for creating a 4-colour pointer from an IFF-ILBM file (taken from MissCmd game):
http://dl.dropbox.com/u/26599983/pointer.c
http://dl.dropbox.com/u/26599983/pointer.h

LyleHaze
LyleHaze's picture
Offline
Last seen: 1 year 4 months ago
Joined: 2011-05-26 03:58
Thank you both! I don't mind

Thank you both!

I don't mind grinding through unfamiliar places, but that was getting a bit extreme.
I'm back on track and proceeding well.

Lyle

LyleHaze

ChrisH
ChrisH's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2010-12-07 20:22
@salass00 It looks like your

@salass00
It looks like your pointer.c shows much of what I need to use SetWindowPointer() to blank the mouse pointer... but at the moment my attempt isn't working. I am just using AllocBitMap() to allocate a blank bitmap, but I think that should work. Hmmm...


Author of the PortablE programming language.

I love using Amiga OS4.1 on my X1000 & Sam440 :-D

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
In my experience (don't

In my experience (don't remember if I tried it on AmigaOS 4.x or only classic AmigaOS) if you want a blank pointer you simply have to create a "pointerclass" object with NewObject() without passing any tags.

If you use AllocBitMap() you should note that it's not cleared by default unless you use the BMF_CLEAR flag.

tboeckel
tboeckel's picture
Offline
Last seen: 3 years 9 months ago
Joined: 2011-09-13 12:32
You might want to take a look

You might want to take a look at the Pointer.c source of BetterString.mcc. It handles all necessary cases, except loading aribtrary image data from disk.

hypex
hypex's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-09-09 16:20
@ChrisH It looks like your

@ChrisH

It looks like your pointer.c shows much of what I need to use SetWindowPointer() to blank the mouse pointr

I once tried [the confusingly titled] ClearPointer() but then found it actually didn't. ;-)

Log in or register to post comments