Jump to content

Tracking a pixel on a scrolling window


Recommended Posts

Yes, I'm noobish ... and my last program was for MS-DOS 4.02 platform :whistle: ... so be patient with me here ...

I am trying to write a function that will track a pixel as the active window scrolls. By scrolling, I mean like in a FPS game where you can look around (left, right, up, down). I can locate the pixel position of interest using PixelSearch (with limited coords), but when the window scrolls the coords change. I want to know the new coords without having to run PixelSearch on the whole window after each scroll event.

I would think this would be a real common function. I searched the forums, but did not see this issue addressed. Maybe I missed a post somewhere. Can anyone point me in the right direction?

If not addressed elsewhere, perhaps share some ideas on how to accomplish this. Example code would be cool, but atleast a push in the general direction is needed.

Thanks in advance!

If I learned from all my mistakes, I would be the smartest man alive!Nothing is fool-proof, because fools are so ingenious.Ingorance it not knowing better. Stupidity is knowing better, but doing it anyway. No way can I be stupid.

Link to comment
Share on other sites

Yes, I'm noobish ... and my last program was for MS-DOS 4.02 platform :whistle: ... so be patient with me here ...

I am trying to write a function that will track a pixel as the active window scrolls. By scrolling, I mean like in a FPS game where you can look around (left, right, up, down). I can locate the pixel position of interest using PixelSearch (with limited coords), but when the window scrolls the coords change. I want to know the new coords without having to run PixelSearch on the whole window after each scroll event.

I would think this would be a real common function. I searched the forums, but did not see this issue addressed. Maybe I missed a post somewhere. Can anyone point me in the right direction?

If not addressed elsewhere, perhaps share some ideas on how to accomplish this. Example code would be cool, but atleast a push in the general direction is needed.

Thanks in advance!

Once you determine the coordinates of what you are searching for (I doubt it's a single pixel), loop a pixel search for it on a limited area around it to find its new location. For example, if you find it at 400x200 initialy, then search from 300x100 to 500x300. That gives you a 200x200 search area. The size of the search area will depend on how fast a single search pass completes and how fast the screen is scrolling.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Yes, you are right about not being 1 pixel, it is a center pixel of a 9X9 pixel. The center pixel is consistantly the same color, the surrounding pixels have shadowing effects, so shade variation is present. Which is why I am focusing on this specific center pixel.

I am acquiring the 9X9 block from a mouseclick feeding to PixelSearch (which locates the exact centerpoint).

This block is in a 1024X768 window and there are other pixels of the same color that could be encountered if I were to use PixelSearch during the scroll event. (hmmm ... unless I really focus down tightly, but loose enough to allow for high speed scrolls) ?:whistle: ?

The scroll event is caused by the mouse moving to edge of screen. So I have thought about tracking the mouse location to give feedback, but this seems like it would be some excessive coding. Also, the scroll event can go left, right, up, down or a combination (like up, left).

The image map is only partially displayed in the 1024X768 window, the total map sizes change and are dynamically generated. At this point, I would like to be able to just reference back to the pixel's new position while it is displayed in the window. But eventually, I am hoping to add mouse functions to scroll back to the reference pixel. Not sure how to handle that part either, but that is way down the road for me.

If I learned from all my mistakes, I would be the smartest man alive!Nothing is fool-proof, because fools are so ingenious.Ingorance it not knowing better. Stupidity is knowing better, but doing it anyway. No way can I be stupid.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...