mouse coordinates doesn't work well when window is bigger than 'real screen'??

Previous topic - Next topic

pinete

Hi all,
I'm trying to develop a small game for Iphone 4 and I'm working on a 17" laptop with a max screen resolution of 1440x900, which is very common as far as I know.
When I create the screen (setscreen 640,960,false) in order to get Iphone resolution, the window that appears after press F5 it's vertically bigger than screen.. until here, no problems.. just a little part on top and bottom of window is 'beaten", but as I say, appareantly that's not a problem...
But when I try to detect if the mouse coordinates are inside a box (a simple function), it results in errors, just returning a simple check!.. I was turning crazy until I decided to change the screen res at 1024x768, when it started to return the correct values..
So.. in seems that mouse coordinates returned by "mousestate" are dependant of the portion of window visible at screen!!!
It seems crazy!! I'm wrong??? How can I fix it? what I'm doing wrong?
Someone else has experienced the same problem???

thanks a lot ;)

MrTAToad

I presume you are saying that the height of the window exceeds the height of your desktop height - if so, then try increasing the desktop resolution.  If not, then you would need to write a C routine to allow the window to be moved or somehow rescaled.

If a window exceeds the desktop width or height, there isn't much you can do about it - its why people sometimes have multiple monitors :)

As to your mouse coordinate, the X and Y values are relative to the top-left corner of the canvas area (and not the title bar), regardless of its position or height.  Therefore, I suspect your collision code is at fault.

pinete

Thanks so much MrTAToad,
Do you know if there exist some way to know how many pixels of a window larger than screen verticaly are out of the canvas?
My code is really simple, basically is a checking function of two coordinates inside a box.. so really there is not many places where the code can be wrong ;)
Maybe you're right when say the code is not solid regarding the function lacks of some kind of check about the size of the window of the game having into account those pixel up and down that are not taken into consideration.. :P
Thanks a lot again MrTAToad!

MrTAToad

i only know how to do it on Windows unfortunately - and you need to use a bit of INLINE C code.

Essentially, you need to get the desktop size using GETDESKTOPSIZE and GetWindowRect to get the size of the window.  You can then find out whether the programs window will fit within the desktop.

ampos

Or you can turn PHISICALLY your monitor 90º, and tell windows to also turn 90º, so you will have a desktop of 900x1440.

It may look like a silly idea, and god, it is, but... it will work  :nana:

MrTAToad

That would be easy if you had a rotatable display :)

Would the GLBasic program be notified of the rotation, I wonder ? :)

ampos

Quote from: MrTAToad on 2011-Feb-12
That would be easy if you had a rotatable display :)

Nothing that a few rubber bands or a pile of books can not fix  :good: