Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: fovmester on Thu 27/10/2005 20:58:09

Title: Problem with on_mouse_click (SOLVED)
Post by: fovmester on Thu 27/10/2005 20:58:09
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).
Title: Re: Problem with on_mouse_click
Post by: Rui 'Trovatore' Pires on Thu 27/10/2005 22:04:20
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.
Title: Re: Problem with on_mouse_click
Post by: Ashen on Thu 27/10/2005 22:20:16
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.
Title: Re: Problem with on_mouse_click
Post by: Rui 'Trovatore' Pires on Thu 27/10/2005 22:38:41
Ah, right. I forgot the 320x240 scenario.
Title: Re: Problem with on_mouse_click
Post by: SSH on Fri 28/10/2005 15:58:36
And Y goes up to 300 in 800x600 mode
Title: Re: Problem with on_mouse_click
Post by: fovmester on Sat 29/10/2005 08:01:33
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!!