I''m getting all zero''s for my mouse data.
this is my init code.
GIB_API int ginit(float r, float g, float b){
//dsound
if(DirectSoundCreate(NULL,&lpds,NULL)!=DS_OK)
return (1);
if(FAILED(lpds->SetCooperativeLevel(hwnd,DSSCL_NORMAL)))
return (1);
if (DirectInputCreate(hin,DIRECTINPUT_VERSION,&lpdi,NULL)!=DI_OK)
return (1);
//keyboard
if (lpdi->CreateDevice(GUID_SysKeyboard, &lpdikey, NULL)!=DI_OK)
return (1);
if (lpdikey->SetCooperativeLevel(hwnd,
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)!=DI_OK)
return (1);
if (lpdikey->SetDataFormat(&c_dfDIKeyboard)!=DI_OK)
return (1);
if (lpdikey->Acquire()!=DI_OK)
return (1);
///
///
//mouse
///
///
if (lpdi->CreateDevice(GUID_SysMouse, &lpdimouse, NULL)!=DI_OK)
return (1);
if (lpdimouse->SetCooperativeLevel(hwnd,
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)!=DI_OK)
return (1);
if (lpdimouse->SetDataFormat(&c_dfDIMouse)!=DI_OK)
return (1);
if (lpdimouse->Acquire()!=DI_OK)
return (1);
///
///
//end mouse
///
///
glShadeModel(GL_SMOOTH);
glClearColor(r, g, b, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
return(0);
}
this is the update code.
GIB_API void startinput(){
if(lpdikey->GetDeviceState(sizeof(char)*256,keystate)==DIERR_INPUTLOST){
lpdikey->Acquire();
lpdikey->GetDeviceState(sizeof(char)*256,keystate);
}
if(lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE),(LPVOID)&mousestate)==DIERR_INPUTLOST){
lpdimouse->Acquire();
lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE),(LPVOID)&mousestate);
}
ShowCursor(FALSE);
}
the structure i get back has only 0''s for the xyz.
I''ve never done this before so it''s probably somthing stupid, please help, Klaus.