Problem with on_mouse_click (SOLVED)

Started by fovmester, Thu 27/10/2005 20:58:09

Previous topic - Next topic

fovmester

When I click the mouse on the bottom of the screen mouse.y > 220 no action happens. I looked into it and found that on_mouse_click isn't called when mouse.y > 220. My game runs in 640 x 480 resolution. Could that have something to do with it? Is it a bug? I don't think it's my coding (since I don't know how to prevent the engine from calling on_mouse_click whenever the user clicks).

Rui 'Trovatore' Pires

Quotemouse.x --> Mouse X co-ordinate when the last game loop was run (320-res) 
mouse.y --> Mouse Y co-ordinate when the last game loop was run (320-res) 

By 320 it means 320x200. Internally, the mouse only goes as far as 200. You have to take that into account.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Ashen

Rui:
I don't know that that's the case. I can get a reaction up to y = 239 (e.g. if I put Display ("Mouse Y = %d",  mouse.y); in on_mouse_click, and click the very bottom of the screen it'll display "Mouse Y = 239"). Yes, it uses 320x2*0 screen coords (so 239 instead of 479) but it doesn't stop at 200.

fovmester:
Obvious one, but do you have a GUI at y=220 that might be blocking clicks? I've had that problem with a statusline GUI (mostly transparent, and I forgot it was there), but once I made it non-clickable it was fine.
I know what you're thinking ... Don't think that.

Rui 'Trovatore' Pires

Ah, right. I forgot the 320x240 scenario.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

And Y goes up to 300 in 800x600 mode
12

fovmester

Quote from: Ashen on Thu 27/10/2005 22:20:16

fovmester:
Obvious one, but do you have a GUI at y=220 that might be blocking clicks? I've had that problem with a statusline GUI (mostly transparent, and I forgot it was there), but once I made it non-clickable it was fine.

I thought about that myself, but since I position the status line just below the cursor I didn't think it would be a problem. But now I remembered that I reposition it ABOVE the cursor at y>220 so that the text willremain inside the screen area. What I didn't think of is that the GUI now was covering the cursor and therefore on_mouse_click wasn't called. I changed the GUI to not clickable and now it works!! Thanks Ashen!!

SMF spam blocked by CleanTalk