[Graphical] Making a program work on a variety of Resolutions? How?
I'm creating a graphical analyzer program that needs to be able to detect what resolution a person has their monitor set to and be able to account for it.
I know how to easily find out what resolution they are using on their monitor, however accounting for all kinds of different resolutions they could be running at can be annoying.
Right now, I was looking at the changes in resolution pertaining to the pixel locations on the screen.
On 1280x1024 resolution, the midpoint of the windows start icon is located at x = 26, y = 1005.
However, on 1920x1080 the midpoint of the start icon is located at x= 26, y = 1060.
The y changed by a difference of 55, but it isn't always the case when testing other areas on the screen.
What is the commonality or algorithm I can use to make my program work on a variety of resolutions?
In my example, how could I make it so the midpoint of the start button could be found on any resolution?
I don't want a trillion if statements and have to modify all kinds of variables each time the resolution changes. o_O
Re: [Graphical] Making a program work on a variety of Resolutions? How?
I take it your program does automated control? You're going to have to make certain assumptions- for example, you're already assuming that the user is on windows, has a visible taskbar, and that that taskbar is located on the bottom of the screen. It's not a far cry from there to assuming resolution. Or you could detect a section of pixels- say, an image of the start button, then find that image on the screen to find its locations. Does that make sense?
Re: [Graphical] Making a program work on a variety of Resolutions? How?
It does make sense. Also, I've already taken into account all the relevant assumptions necessary for this particular task - excluding the change in resolution of course. Having a program detect and recognize certain images over others would be task for a neural network. I could draw a rectangle around an area and capture(grab) all of those pixels - then proceed to analyze the colors of them O_o. In the end, looking for the simple changes in resolution would be best. Or would it? :)
Re: [Graphical] Making a program work on a variety of Resolutions? How?
Recognizing the meaning behind images is non-trivial, sure. But comparing two images to see if they match exactly? That's trivial. From there, determining whether an image is a sub-image of another image is trivial, and therefore locating where that subimage is is also pretty trivial.
I don't like to self-advertise too much, but I recently wrote a small program that does exactly that. You can take a look at its source if you feel like it: I'm Still Listening!
Re: [Graphical] Making a program work on a variety of Resolutions? How?
I could argue the semantics of the word 'trivial' or what it trivial/what is not to the common man but I'd rather look at this funny ant simulation you made. :)
Re: [Graphical] Making a program work on a variety of Resolutions? How?
LOL. You should have a made a rival ant colony that tries to steal all the food squares from the other one.
Re: [Graphical] Making a program work on a variety of Resolutions? How?
Quote:
Originally Posted by
JeffThomas
I could argue the semantics of the word 'trivial' or what it trivial/what is not to the common man but I'd rather look at this funny ant simulation you made. :)
Well, the reason I'm calling it trivial is because at its core it's just a single for loop going through the sub-image inside a single for loop going through the main image. It gets a little more complicated with things like multiple monitors (but so does simply using hard-coded values), but my code will actually accomplish your goal- all you have to do is change the image it's looking for.
Re: [Graphical] Making a program work on a variety of Resolutions? How?
Quote:
Originally Posted by
JeffThomas
LOL. You should have a made a rival ant colony that tries to steal all the food squares from the other one.
Haha actually that wouldn't be too hard to implement. I had to keep it a little serious because it was for school, but if I did a version 2.0, that would probably be one of the things I added.
Re: [Graphical] Making a program work on a variety of Resolutions? How?
I'm going to be taking a similar AI programming class soon. Might have to make, "Ant Wars: The Fight for Food" . :(grin):
"Ant Wars: Hunger Strike" or even "Ant Wars: Till Crumbs do us Part"