English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 01 January 2023, 15:32   #1
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
clear mouse pointer of current window/screen

I have a game where mouse pointer subsists from workbench


How can I get the active window so I can call ClearPointer on that?


asm, C, doesn't matter.
jotd is offline  
Old 01 January 2023, 17:21   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,000
IntuitionBase->ActiveWindow

But that's not the right way. You should open your own window on your own screen, make that active and set its pointer.

BTW, ClearPointer returns the pointer to normal, so if you currently see the Workbench pointer, ClearPointer won't change that.

To hide the mouse pointer you have to allocate IIRC 4 bytes of Chip memory and give that to SetPointer. Thinking about it, it can also be 12 bytes. Two words for x/y coordinates, two words for a 1x1 pixel pointer with two bitplanes and another two words to end the sprite chain.
thomas is offline  
Old 01 January 2023, 18:15   #3
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
Quote:
Originally Posted by thomas View Post
IntuitionBase->ActiveWindow

But that's not the right way. You should open your own window on your own screen, make that active and set its pointer.

I know but I'm patching a game that doesn't do that.


With your advice I coded that asm piece and it works, so thanks. Dropping it here for people who're interested.


Code:
    INCLUDE    exec/exec.i
    INCLUDE    intuition/intuitionbase.i
    INCLUDE    lvo/exec.i
    INCLUDE    lvo/intuition.i


zap_pointer:
    movem.l    d0-d3/a0-a2/a6,-(a7)
    move.l    4.W,a6
    move.l    #MEMF_CHIP|MEMF_CLEAR,d1
    move.l    #12,d0
    jsr    (_LVOAllocMem,a6)
    move.l    d0,a2        ; save for later
    
    lea    (_intname,pc),a1
    jsr    (_LVOOldOpenLibrary,a6)
    move.l    d0,a6
    move.l    ib_ActiveWindow(a6),a0
    move.l    a2,a1
    moveq    #1,d0
    moveq    #1,d1
    moveq    #0,d2
    moveq    #0,d3
    jsr    _LVOSetPointer(a6)
    
    movem.l    (a7)+,d0-d3/a0-a2/a6
    rts
_intname
    dc.b    "intuition.library",0
jotd is offline  
Old 08 February 2023, 10:36   #4
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,604
Can SetPointer be used for a Screen somehow? ClearPointer works with ActiveWindow=0, but not SetPointer.

Edit: Doesn't seem so.

If only I could nudge the pointer down when I create my screen! I've tried to displace the screen instead, but the pointer is glued to screen's 0,0 on creation (and no way to create a screen with a custom pointer).

I realize of course that mouse movement is central to the OS, deep within an interrupt on the mouse port.

It's just that sometimes you want to show a screen for presentation, and then the pointer distracts (and you may have use of those colors).

Last edited by Photon; 08 February 2023 at 19:01.
Photon is offline  
Old 09 February 2023, 14:01   #5
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,000
You could call GetPrefs, make a copy of it, clear the pointer data and call SetPrefs.

On exit call SetPrefs with the original prefs to restore the pointer.

This the 1.3 way of setting preferences. I am not sure if it plays well with settings set by IPrefs.

Also if the user uses Amiga-M keys to return to the Workbench screen while your game is still running, he would not see a pointer there, too.

The best way is always to open Screen + Window together. A screen alone is of no use.
thomas is offline  
Old 09 February 2023, 15:52   #6
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,231
Quote:
Originally Posted by Photon View Post
Can SetPointer be used for a Screen somehow?
Not as such, but you rarely have a bare screen since a screen does not receive any data from intuition. It is just a canvas on which you can put windows. You should place a backdrop borderless window on the screen - the result looks the same, but with this window you can interact through intuition.
Thomas Richter is offline  
Old 09 February 2023, 15:53   #7
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,231
Quote:
Originally Posted by thomas View Post
You could call GetPrefs, make a copy of it, clear the pointer data and call SetPrefs.
Actually, I would not recommend that. It means that the mouse pointer goes away for every window that does not define its own pointer, and this is quite intrusive (not to say utterly confusing).
Thomas Richter is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get current CLI window width sg00 Coders. C/C++ 5 18 June 2019 09:09
Screen tear/glitch following mouse pointer. lordofchaos support.WinUAE 5 24 May 2019 20:03
Mouse becomes uncaptured when window partly off-screen mark_k support.WinUAE 25 07 May 2017 13:22
Window sizing mouse pointer issue when RTG enabled mark_k support.WinUAE 1 05 February 2013 15:30
Mouse pointer jumps to centre of screen ral-clan support.WinUAE 0 30 January 2011 02:41

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09999 seconds with 13 queries