Archived

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

NightZero

DirectInput8

Recommended Posts

Hi, I''m planning to add a HI-Score list to my game. The game is using DirectInput to control my hero. But is there an easy way for making text I/O in a windowed DirectDraw app? Like, for example ''cin''? I thing it will require much work if i should use my direct input function: void ReadImmediateData() { unsigned char diks[256]; if(NULL == g_pKeyboard) return; if(FAILED(g_pKeyboard->GetDeviceState(sizeof(unsigned char[256]), (LPVOID)diks))) { /* error code */ } //''S''-key if(KeyDown(diks, DIK_S) && gameState == GAME_INTRO) { gameState = GAME_ACTIVE; } ... } /Mattias

Share this post


Link to post
Share on other sites
I''ve tried making my own text input reader with DirectInput, but I just couldn''t get it to match Windows'' system and gave up. I found it much easier to use the WM_CHAR message for input, because it handles timing, Caps Lock, etc. for you.

WindowProc (int msg, LPARAM, WPARAM wParam)
{
if (msg == WM_CHAR)
LetterTyped ((char)wParam);
}

Something like that.

Share this post


Link to post
Share on other sites