Keyboard of BuddhaInput

BuddhaInput makes it possible to get the current keyboard state as well by the same grammar as XNA. But, BuddhaInput needs the special initialize for DirectInput8 Initializing. The game class does it automatically.

KeyboardState state = Keyboard::GetState();
if (state.IsKeyDown(Keys::Left))

This code is the same as XNA’s, but it needs the overload for copying 256 bytes. And so, you may use the following pattern.

KeyboardState state;
Keyboard::GetState(state);

IsKeyDown method & IsKeyUp method returns a bool value. For the parameter, you may Keys::xxx or DIK_XXX.

Advertisements
This entry was posted in Game Engine and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s