Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Strange bug with moving window

Author
Message
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Feb 2013 07:29
Run this program windowed. The click around to drop a few tiles onto the map. Then grab the window title and move it around. You'll see the order of the tiles mysteriously reverses vertically. I haven't a clue how moving the window is affecting content in game.



"You're all wrong. You're all idiots." ~Fluffy Rabbit
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th Feb 2013 12:22 Edited at: 25th Feb 2013 12:27
Almost got the solution for you.Basicly you need to add a state for every gem if it's still or not.I'll post the code when i'm done.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th Feb 2013 12:38 Edited at: 25th Feb 2013 17:21
Here is the solution:


There is still state for every gem and no more verical shuffle, it was the overlap statement that messed up everything, gems never fully stop from fall and there was the problem, they just seemed like they are not falling but y position keep changing.Plus there is neighboor gem, if there isn't the program can't tell if the gem must fall if you put fast another gem under and it got stuck in mid fall.Now it checks the gem under and if it's 0 at some point when the second gem is away,it continues the fall.Instead of checking for i=0 and j=0 now it checks from i=1 and j=1 because gem 0 is a special and mess up everything it's also positioned out of the grid.You need to think of some workaround if you want to use right mouse click to destroy gem.I tried to make it work with overlap but failed.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Feb 2013 19:17
Any idea why moving the window would trigger this kind of issue though?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th Feb 2013 19:59
It's a bug i guess there is only so few people that could know that for sure.I believe it's something related to refreshing when you move the window.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 25th Feb 2013 21:58
The program will register clicks outside of the client area, its mouse event and keyboard events seem to be 'global'.

What is strange about the mouse queries amongst other things is what happens to the mouse coordinates when the window is dragged:



I am wondering if that is the clue to your puzzle.

Your issue has raised my concern about something else I've not thought about before. My mouse can adjust its resolution; this appears to mess up DBP's mouse coordinates; i put the mouse at pixel 768, and it shows 2000. Will need to use alternative mouse functions.

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Feb 2013 22:57
Quote: "gems never fully stop from fall and there was the problem, they just seemed like they are not falling but y position keep changing"


And I can't figure out why the Y-position keeps changing.

1. Update acceleration
2. Update Y-position
3. Check for collision (overlap or bottom of map)
4. If collision occurs, reset acceleration and replace Y

By the time the loop finishes, the only Y-values that should be different are those that didn't hit anything yet. When my frames are locked at 60fps, acceleration updates by at least 3 per cycle, enough that it should register as overlapping every time and thus reset.

"You're all wrong. You're all idiots." ~Fluffy Rabbit

Login to post a reply

Server time is: 2026-07-07 18:21:54
Your offset time is: 2026-07-07 18:21:54