Page 1 of 1

How I can change mouse sensitivity?

Posted: Fri Jan 26, 2007 12:53
by Vetal_28
Hello, I need to change mouse sensitivity, how I can do this?

Thanks for help in advanced :wink:

Posted: Fri Jan 26, 2007 13:14
by Rackle
When you inject mouse movement you can multiply by a value. Me I like to multiply by 1.75:

injectMouseMove(arg.state.X.rel * 1.75, arg.state.Y.rel * 1.75)

A better approach would be to use a variable, with a user interface component to allow users to specify their own multiplicator.

Posted: Fri Jan 26, 2007 13:40
by Vetal_28
Rackle wrote:When you inject mouse movement you can multiply by a value. Me I like to multiply by 1.75:

injectMouseMove(arg.state.X.rel * 1.75, arg.state.Y.rel * 1.75)

A better approach would be to use a variable, with a user interface component to allow users to specify their own multiplicator.


It doesn't work. Is there something wrong in my next actions?

void CABDemoApp::UpdateCEGUISize(int nWidth, int nHeight)
{
CEGUI::Size sz((float)nWidth, (float)nHeight);
static_cast<CEGUI::DirectX81Renderer*>(m_pGuiRenderer)->setDisplaySize(sz);

CEGUI::Rect rect(0.0f, 0.0f, sz.d_width, sz.d_height);
CEGUI::MouseCursor::getSingleton().setConstraintArea(&rect);

CEGUI::System::getSingleton().injectMouseMove(sz.d_width * 0.5, sz.d_height * 0.5);

CEGUI::System::getSingleton().signalRedraw();
}

Posted: Fri Jan 26, 2007 16:40
by Rackle
Is your UpdateCEGUISize() function called every frame or only when the display window is resized? My guess is that you are not injecting the mouse movement every time the mouse is moved. Also, multiplying by 0.5 would reduce the speed at which the mouse moves by half, and multiplying by 1.5 would double its speed.

Posted: Sun Jan 28, 2007 18:26
by Das Gurke
What about CEGUI::System::setMouseMoveScaling ? Wouldn't that be the far easiest method?

Posted: Mon Jan 29, 2007 11:30
by Rackle
Goes to show I do not know everything :cry:

Posted: Mon Jan 29, 2007 12:35
by Vetal_28
Rackle wrote:Is your UpdateCEGUISize() function called every frame or only when the display window is resized? My guess is that you are not injecting the mouse movement every time the mouse is moved. Also, multiplying by 0.5 would reduce the speed at which the mouse moves by half, and multiplying by 1.5 would double its speed.


Oh yeah, I'm miss it. Now I put this line into every frame, in main cycle, but it doesn't work!!! Maybe I do somesing wrong?

Das Gurke wrote:What about CEGUI::System::setMouseMoveScaling ? Wouldn't that be the far easiest method?


Yeah, this is more correct variant which specially destination for this. But this don't work. May you now why?

P.S. Help, please, but I relly need it!!!

Posted: Mon Jan 29, 2007 14:24
by Das Gurke
1) Stupid Question, but: Does your mouse move at all? (Just to make sure)
2) Have you tried some "crazy" values like 200 or 0.00001f?

I never had problems with that method Oo

Posted: Mon Jan 29, 2007 15:04
by Vetal_28
Das Gurke wrote:1) Stupid Question, but: Does your mouse move at all? (Just to make sure)


Yes, mouse moving, but it speed don't changed.

Das Gurke wrote:2) Have you tried some "crazy" values like 200 or 0.00001f?


I tried anything values, begining at 0.01f to 1000000, speed don't changed.

Posted: Mon Jan 29, 2007 17:15
by Rackle
You need to post some more code...

Posted: Mon Jan 29, 2007 18:10
by Vetal_28
Rackle wrote:You need to post some more code...


I tried for 2 ways:
1-st at initialization CEGUI:
void CABDemoApp::InitCEGUI()
{
InitCEGUIRender();
CreateInterface();
InitDialogs();

CEGUI::System::getSingleton().setMouseMoveScaling(100);

SetMusicVolumeInScript();
SetSoundVolumeInScript();
SetDetailedGrapic();
}

2-st directly at event MouseMove
case N_INPUT_MOUSE_MOVE:
CEGUI::System::getSingleton().injectMousePosition(
static_cast<float>(pEvent->GetAbsXPos()),
static_cast<float>(pEvent->GetAbsYPos()));
CEGUI::System::getSingleton().injectMouseMove(pEvent->GetAbsXPos() * 0.1f, pEvent->GetAbsYPos() * 0.1f);
break;

If this code wiil not help, and if you have a time, I can send any files from code, maybe this way can resolve my problem. If you be able help me, I will be very grateful to you!

Posted: Mon Jan 29, 2007 21:03
by Rackle
You need to supply absolute mouse position or relative mouse movement, but not both. Unfortunately the code for the relative mouse position, the call to the injectMouseMove() function, is incorrect since you are passing absolute positions.

case N_INPUT_MOUSE_MOVE:
CEGUI::System::getSingleton().injectMousePosition(static_cast<float>(pEvent->GetAbsXPos()), static_cast<float>(pEvent->GetAbsYPos()));
CEGUI::System::getSingleton().injectMouseMove(pEvent->GetAbsXPos() * 0.1f, pEvent->GetAbsYPos() * 0.1f);
break;

Posted: Tue Jan 30, 2007 16:05
by Vetal_28
Rackle wrote:You need to supply absolute mouse position or relative mouse movement, but not both. Unfortunately the code for the relative mouse position, the call to the injectMouseMove() function, is incorrect since you are passing absolute positions.

case N_INPUT_MOUSE_MOVE:
CEGUI::System::getSingleton().injectMousePosition(static_cast<float>(pEvent->GetAbsXPos()), static_cast<float>(pEvent->GetAbsYPos()));
CEGUI::System::getSingleton().injectMouseMove(pEvent->GetAbsXPos() * 0.1f, pEvent->GetAbsYPos() * 0.1f);
break;


I tryied all variants, if I leave:

case N_INPUT_MOUSE_MOVE:
CEGUI::System::getSingleton().injectMouseMove(pEvent->GetAbsXPos() * 0.5f, pEvent->GetAbsXPos() * 0.5f);
break;

then mouse doesn't show, and accordingly doesn't move. You writing that injectMouseMove() function is incorrect, I think the same to:). And how wiil be the correct variant? What parametrs will have injectMouseMove() function? and where I can take their?

\param delta_x
amount the mouse moved on the x axis.

\param delta_y
amount the mouse moved on the y axis.

I don't see it.