NaaLaa
Mouse - Printable Version

+- NaaLaa (https://www.naalaa.com/forum)
+-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html)
+--- Forum: NaaLaa 7 Questions (https://www.naalaa.com/forum/forum-3.html)
+--- Thread: Mouse (/thread-86.html)



Mouse - johnno56 - 02-21-2024

Quick question...

Are there any commands to 'hide' the mouse and to 'read' the mouse wheel?

Just curious. If not, it might be a good idea to add them... purely selfish reasons... lol

J


RE: Mouse - Tomaaz - 02-21-2024

RTFM! Big Grin  Check set mouse and mousebutton in the /examples/help folder. Wink


RE: Mouse - johnno56 - 02-22-2024

Charming... lol But, you are correct... The manual should have been my first choice. Thank you. Wink


RE: Mouse - Tomaaz - 02-22-2024

I hope it's clear that I was joking.  Wink I hate "RTFM!" and "Have you heard about Google?" answers. I have been banned from a couple of places for sharing my opinion about them (which is - either answer the question or shut the f...k up). Big Grin


RE: Mouse - johnno56 - 02-22-2024

Joke understood... besides, I have been told things far worse, in my day... lol Your advise was indeed helpful... I now know how to "hide" and "position" the mouse... Cool


RE: Mouse - 1micha.elok - 02-22-2024

(02-22-2024, 11:12 AM)johnno56 Wrote: ... I now know how to "hide" and "position" the mouse... Cool

Have you tried to change the mouse pointer into your avatar ?
Try this one  Big Grin

Code:
'========================================
'              WHAT A MOUSE
'
' Reference : Naalaa's examples folder
'
'========================================

'----------------
' INITIALIZATION
'----------------
set window "set mouse", 640, 480
set redraw off

load image 1,"img/avatar.png"
set image grid 1,4,1

cGray       = [50,50,50]
cWhite      = [255,255,255]

'initial value
top         = 50                   
bottom      = height(primary)-100  
timer       = 0                      
textOffset  = 0 
text2       = "Mouse ON"           
avatar      = 0    
i           = 0  'counter image cell

'--------------
' MAIN PROGRAM
'--------------
while not keydown(KEY_ESCAPE, true)

    set color cGray; cls 'clear screen
    set color cWhite
   
    'Boundary lines
    draw line 0,top,width(primary),top             
    draw line 0,bottom,width(primary),bottom   

    'Text near to top boundary line 
    if mousebutton(1)  then     'right mouse
        timer = clock() + 1000
        text  = "Right button"
    elseif mousebutton(0) then  'left mouse
        timer = clock() + 1000
        text = "Left button"
    elseif mousebutton(2) then  'mouse wheel
        timer = clock() + 1000
        text = "Mouse wheel"
    endif
    set caret 20,15;wln "Mouse button : "; if timer > clock() then wln text 'display 1 second
    set caret width(primary)-250,15;wln "Mouse position : "+mousex()+", "+mousey()
    set caret width(primary)-250,30;wln text2

    'Text near to bottom boundary line
    set caret width(primary)/2, (height(primary)-80)
        center "s = show, h = hide, c = center, j = avatar"
        center "Try using the mouse buttons and wheel!"
        center
        center "Press Esc to quit ..."
           
    if keydown(KEY_S, true)  then
        set mouse on
        text2 = "Mouse ON"
        avatar = 0
    elseif keydown(KEY_H,true) then
        set mouse off   
        text2 = "Mouse OFF"
        avatar = 0
    elseif keydown(KEY_J,true) then
        set mouse off
        text2 = "The Avatar"
        avatar = 1
    endif
    if keydown(KEY_C, true)  then
        set mouse width(primary)/2, height(primary)/2
        posX = width(primary)/2
        posY = height(primary)/2
        textOffset = 0
    else
        textOffset = textOffset + 10*mousebutton(2, true)
        posX = width(primary)/2
        posY = height(primary)/2 + textOffset
        if posY < top     then posY = top+10       
        if posY > bottom  then posY = bottom-10                
    endif

    'Text between top and bottom boundary lines  
    set caret posX, posY; center "Mouse Experiment" 

    if avatar = 1 then
        if i%2=0 then i=0
        draw image 1,mousex()-70/2,mousey()-100/2,i
        i=i+1
    endif
           
    redraw
    fwait 10

wend

Edit : You may test your mouse : left click, right click, wheel, position, hide, show, change mouse pointer


RE: Mouse - Marcus - 02-23-2024

(02-22-2024, 07:26 AM)Tomaaz Wrote: I hope it's clear that I was joking.  Wink I hate "RTFM!" and "Have you heard about Google?" answers. I have been banned from a couple of places for sharing my opinion about them (which is - either answer the question or shut the f...k up). Big Grin

I couldn't agree more.