Sign in to follow this  

Input: Buffered/Unbuffered or Both?

This topic is 3870 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

I've read that unbuffered input is best for controlling the gameplay parts of a game and buffered is best for things like text entry and GUI systems - because input may not be retrieved until several frames later. However what if I run an input loop during each iteration of the game loop where I handle all of the buffered input before continuing with the game loop e.g.
while(game_running)
{
    while(input_available)
        process_input();

    //...
}

Surely this would work just as good as unbuffered/immediate input? Or would I be better off switching to unbuffered input during gameplay sections and using buffered input only in menu screens and such?

Share this post


Link to post
Share on other sites
It's no longer recommended to use DInput for text entry for a variety of reasons. Use unbuffered to get the current state of keys for gameplay, and use windows messages (WM_CHAR, and things like that) for text input.

Many languages have accent characters, and it's often entered as a special first key-press to select an accent, followed by a second press to choose the letter, like these. In DInput you'd have to handle all this yourself, hope you got everything, for every language, etc. Instead you can just have Windows handle it like it does for every application, and tell you the fully qualified character at the end.

It will also take into account different keyboard layouts, such as French or German, which may use different scan codes (what DInput uses) for fairly standard keys. It will also allow you to use a completely different keyboard layout such as dvorak.

In short, DInput is not for text if you care about your users.

Share this post


Link to post
Share on other sites

This topic is 3870 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this