Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Any have this problem before?

This topic is 6649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Everyone, I just recently tried out Nate Miller''s GLTextFont Library to allow for drawing 2d text over a 3d world and it works great! I''m just having a minor problem though and this may not even be related to that, infact I''m almost sure it isn''t. As you probably guessed I am using OpenGL, and for input I''m using DirectInput. All is well, except this one thing... When I press a key the letter does write to the screen, which is great, but as soon as I let go of the key its gone. My function for checking input is in the message pump, right before SwapBuffers(hDC);. Am I right in assuming that it is dissapearing because of SwapBuffers? I''ve tried putting the AquireDIStatus(hwnd); after SwapBuffers but nothing comes up then, which I pretty much figured anyway. Does anyone have any suggestions or advice? I hope I''m making sense, if not I''ll post a snippet of the code if need be. Thanks! -Miraj

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you are only drawing the charecter in the keydown message loop. What you want is some buffer that stores all the charecters you want to output, and output them every frame. Hope this helps

Mike

Share this post


Link to post
Share on other sites
Okay...

You mean, kind of like my own cin() except something compatible with OpenGL?

This is one of those things I''ve never really done yet so I''ll need to experiment and hopefully find a tutorial out there of some kind. Anyone know of such a tuorial?

-Miraj

Share this post


Link to post
Share on other sites
You''re going to want to do something like this.

Array buffer;

/*get input*/
if(keys[''a''])
buffer.push_back(''a'');
...for all keys you want to process. I''m assuming you draw the charecters here, which means it will only be on the screen while the key is down.

.
.
.
void redraw()
{
write buffer to screen;
and whatever else you need
}

that should do it.
Mike

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!