Strange limit to mouse.getX-getY
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Strange limit to mouse.getX-getY
In a game I am developing I was using a 800x600 resolution. Today I started testing different resolutions, but I noticed a strange thing. The love.mouse.getX function returns 799 if the position of the mouse is greater than 799. The same with love.mouse.getY with a limit of 599. It's so obvious that it has something to do with the original 800x600 resolution that the first thing I've done is to check for some line of code with the numbers 800 or 600, but there are none. Is this a bug or I am doing something wrong?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Strange limit to mouse.getX-getY
Please post code, I've never heard of this happening before.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Strange limit to mouse.getX-getY
Mouse coords go from 0 to the screen width or height minus 1. Any higher and the mouse will be off the window, and you should probably pause the game at that point.
@Technocat: to see an example, use the level editor in Kurosuke, I render a glowing mouse symbol just off of the mouse coords, which makes this behavior easy to see.
@Technocat: to see an example, use the level editor in Kurosuke, I render a glowing mouse symbol just off of the mouse coords, which makes this behavior easy to see.
Kurosuke needs beta testers
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Strange limit to mouse.getX-getY
It shows the cursor at the mouse, but I'm not sure this represents the problem he is stating.tentus wrote:@Technocat: to see an example, use the level editor in Kurosuke, I render a glowing mouse symbol just off of the mouse coords, which makes this behavior easy to see.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Strange limit to mouse.getX-getY
799 is the maximum width because there are 800 pixels, starting from 0, so 799 is the 800th pixel.
Now about why it doesn't go any further, because it then is outside of the window.
Now about why it doesn't go any further, because it then is outside of the window.
Re: Strange limit to mouse.getX-getY
I upload the code. I erased all of the code irrelevant to the problem and i just left out a line that goes from the origin (0,0) to the position of the mouse. I upload an image of what happens, as you can see, if the cursor X position is greater than 799, the line gets stuck at 799. I want the line to end at the cursor not only in the 800x600 domain, but in the whole window.
Hope this help understand better my problem.
Thanks
Hope this help understand better my problem.
Thanks
- Attachments
-
- main.love
- (279 Bytes) Downloaded 151 times
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Strange limit to mouse.getX-getY
It appears I am able to travel to every pixel with your code.
Re: Strange limit to mouse.getX-getY
That is weird. So, what can I do?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Strange limit to mouse.getX-getY
How did you resize the window?
Re: Strange limit to mouse.getX-getY
before i had this line :
love.graphics.setMode(800, 600, false, true, 0)
now i have:
love.graphics.setMode(1280, 720, false, true, 0)
As it seems to be a problem with my installation of love, I will try to reinstall it to see if that eliminates the problem.
love.graphics.setMode(800, 600, false, true, 0)
now i have:
love.graphics.setMode(1280, 720, false, true, 0)
As it seems to be a problem with my installation of love, I will try to reinstall it to see if that eliminates the problem.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests