Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

I haven't managed to pin point this issue yet but sometimes I have to press keys multiple times before it registers.  My fps average between 40 to 60 and it happens when I use Window::KeyHit().  KeyDown() has no problems. Has anyone else had similar issues to this?  I was wondering if it was something to do with low fps and it didn't detect the key in some frames?

Link to post
Share on other sites
for (int id = 0; id < 256; id++) {
	MainFrame::window->keyhitstate[id] = false;
}

I think this was the cause.  I can't remember why I was doing this though... I need to write more notes on my code...

My only guess as to why this was the problem is that some key-presses are being picked up after a KeyHit() check is being made?

 

Link to post
Share on other sites

This is what I was trying to solve with resetting the hit-state.-

Vec3 mpos = window->GetMousePosition();

if (mpos.x > 500) {
	if (window->KeyHit(Key::R) == true) {
		int test = 0;
	}
}
else {
	//If mouse.x is less than 500 and the key is pressed nothing happens.  however if you then move your mouse to greater than 500, they key is detected as hit.
}

I think FlushKeys() was resetting keydown events too... I'll have to retry that and check...

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...