I'm working on a miniature sidescrolling project. I want the application window to be drag-moveable while it scrolls, but I'm getting funny behavior out of this.
My current implementation for scrolling is just like the 'ghost shooter' tutorial: I have a 88x31 game window with a 300x31 layout, and it constantly keeps a horizontally-moving object in the center.
My current implementation for dragging is that clicking the window sets a value to 1 and records the current mouse location, and as long as the value is set to 1, the window will be moved to its current location plus the difference between the current mouse location and the initial mouse location. When the button is released, the value is set to 0.
The scrolling works on its own, and the dragging works on its own. But when I have the mouse held down while the game window scrolls, the window inexplicably moves to the right along with the character, while the background of the layout stays almost stationary.
I'm surely doing something wrong, but I can't figure it out. Can anyone help with this problem?
Screenshot of events:
<img src="http://i.imgur.com/nxse3.png">
Source:
Tiny_Crawl_World.cap (41 KB)