Breaks, speeding into the up direction.

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Breaks, speeding into the up direction.

Post by PutPixel255 » February 7th, 2014, 5:21 pm

Hi I'm just wondering why the code breaks when I push the space button while traveling in the up direction. Only happens when space is pushed.
Attachments
Chili DirectX Framework - Copy.zip
(22.71 KiB) Downloaded 117 times

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Breaks, speeding into the up direction.

Post by LuisR14 » February 7th, 2014, 5:44 pm

this seems to be key ghosting issue? (tho i find it weird that it would happen on 2 keys when it normally happens with 3 or more)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Re: Breaks, speeding into the up direction.

Post by PutPixel255 » February 7th, 2014, 6:22 pm

I guess I'll rewrite the clamping code or use the up dated framework anyway moving on. If its not a problem with the logic.

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: Breaks, speeding into the up direction.

Post by MrGodin » February 7th, 2014, 8:45 pm

I ran this on my machine and all was well except for the same issue i had, was when i press left - up - space, the space key gets nulled and doesn't respond but only with that 3 key combo. I since used the "S" key to replace the space in my code and all 3 key combos work now. I did a little digging and it seems to be the keyboard mappings on the keyboard its self.
Curiosity killed the cat, satisfaction brought him back

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Breaks, speeding into the up direction.

Post by LuX » February 7th, 2014, 9:22 pm

MrGodin wrote:I did a little digging and it seems to be the keyboard mappings on the keyboard its self.
LuisR14 wrote:this seems to be key ghosting issue?
http://www.microsoft.com/appliedscience ... ained.mspx
I wonder if that test app could be embedded on the FAQ page or something.
ʕ •ᴥ•ʔ

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: Breaks, speeding into the up direction.

Post by MrGodin » February 7th, 2014, 9:45 pm

http://www.microsoft.com/appliedscience ... ained.mspx
I wonder if that test app could be embedded on the FAQ page or something.
Yes that's a good page actually. I'mma gonna bookmark that one :D..
Cheers
Curiosity killed the cat, satisfaction brought him back

PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Re: Breaks, speeding into the up direction.

Post by PutPixel255 » February 7th, 2014, 11:22 pm

((D3DCOLOR*)rect.pBits)[ x + (rect.Pitch >> 2) * y ] = D3DCOLOR_XRGB( r,g,b );

Not sure why this is pushing the reticle north of the border into the forbidden zone. :P


is this >> dividing by 4. i'm just guessing.

PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Re: Breaks, speeding into the up direction.

Post by PutPixel255 » February 8th, 2014, 12:47 am

well this seems to wrap upwards correctly when I stuck a 12 in there.
The debugger showed a neg 2 for y so perhaps that explains 12 working, but what about the other 5 positions plus the height of the reticle.



// 12 is the magic number
if(y<12) :idea:
{
y=594;
}
if(x>794)
{
x=5;
}
if(y>594)
{
y=12; :idea:
}

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Breaks, speeding into the up direction.

Post by LuX » February 8th, 2014, 10:11 am

I checked your code. It's all about logical ordering: You want to first move, then clamp, and not the other way round. Plus it's not really "clamping" if you teleport to the other side. The original code should work perfect if you'd just switch to move first, then clamp.
ʕ •ᴥ•ʔ

PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Re: Breaks, speeding into the up direction.

Post by PutPixel255 » February 9th, 2014, 12:14 am

:mrgreen: Thanks Lux your the man. And now I am free to teleport across the cosmos which is 800x600. Yea, I wrote that from memory so I got it backwards and thought about why it didn't and did work. and now I am tired cause thinking is hard. Winky face.

Post Reply