Results 1 to 9 of 9
  1. #1
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Question [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

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default 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?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Default 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? :)

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default 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!
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Default 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. :)

  6. #6
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Default 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.

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: [Graphical] Making a program work on a variety of Resolutions? How?

    Quote Originally Posted by JeffThomas View Post
    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.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: [Graphical] Making a program work on a variety of Resolutions? How?

    Quote Originally Posted by JeffThomas View Post
    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.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. #9
    JeffThomas is offline Member
    Join Date
    Dec 2011
    Posts
    31
    Rep Power
    0

    Default 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" .
    "Ant Wars: Hunger Strike" or even "Ant Wars: Till Crumbs do us Part"
    Last edited by JeffThomas; 01-26-2012 at 12:28 AM.

Similar Threads

  1. Making a program.
    By Headlessmunky in forum New To Java
    Replies: 11
    Last Post: 08-23-2011, 07:18 PM
  2. Making a map program
    By cchase88 in forum AWT / Swing
    Replies: 1
    Last Post: 12-05-2010, 11:01 PM
  3. Using threads in a graphical program
    By jameskelly in forum New To Java
    Replies: 6
    Last Post: 11-28-2010, 04:52 PM
  4. Need Help splitting up an Int in a variety of ways
    By JoKeR313 in forum New To Java
    Replies: 9
    Last Post: 11-10-2010, 07:22 AM
  5. Class to play variety of video formats
    By Swankee in forum New To Java
    Replies: 0
    Last Post: 10-12-2009, 09:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •