windows - c++ GetKeyState() some Key codes not working -


hi creating game in c++ on windows7 , have came on strange problem:

i use getkeystate retrieving key states , has worked fine till now.

i have mapped few keys: (inputkey integer)

   const static inputkey key_w = 87;    const static inputkey key_s = 83;    const static inputkey key_a = 65;    const static inputkey key_d = 68;    const static inputkey key_i = 73; // 1 not working    const static inputkey key_v = 86; 

and cant key "i" working returns not pressed 0x0000

here function:

    inline static bool iskeypressed(int keycode){         return (getkeystate(keycode) & 0x8000);     } 

does know cause. have nothing related key in window messages loop...

here window loop:

void window::run() {     msg msg;     displaystate = 1;     while(peekmessage(&msg, 0, 0, 0, pm_remove)) {         translatemessage(&msg);         dispatchmessage(&msg);     }  }  lresult callback window::wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam) {      window* window = ((window*) getwindowlongptr(hwnd, gwlp_userdata));       switch(message) {            case wm_paint:            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_close:           window->iscloserequestedbool = true;           break;      case wm_lbuttondown:           window->getmousepressstate()->leftmouse = true;           defwindowproc(hwnd, message, wparam, lparam);           break;      case wm_lbuttonup:            window->getmousepressstate()->leftmouse = false;            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_rbuttondown:            window->getmousepressstate()->rightmouse = true;            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_rbuttonup:            window->getmousepressstate()->rightmouse = false;            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_mbuttondown:            window->getmousepressstate()->middlemouse = true;            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_mbuttonup:            window->getmousepressstate()->middlemouse = false;            defwindowproc(hwnd, message, wparam, lparam);            break;      case wm_destroy:           window->destroy();           postquitmessage(0);           window->displaystate = 0;           return 0;       default:           return defwindowproc(hwnd, message, wparam, lparam); } return 0; 

}


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -