How I can change mouse sensitivity?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

How I can change mouse sensitivity?

Postby Vetal_28 » Fri Jan 26, 2007 12:53

Hello, I need to change mouse sensitivity, how I can do this?

Thanks for help in advanced :wink:

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Jan 26, 2007 13:14

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.

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

Postby Vetal_28 » Fri Jan 26, 2007 13:40

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();
}

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Jan 26, 2007 16:40

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.

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Sun Jan 28, 2007 18:26

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

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 29, 2007 11:30

Goes to show I do not know everything :cry:

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

Postby Vetal_28 » Mon Jan 29, 2007 12:35

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!!!

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Mon Jan 29, 2007 14:24

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

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

Postby Vetal_28 » Mon Jan 29, 2007 15:04

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.
Last edited by Vetal_28 on Thu Apr 19, 2007 15:57, edited 1 time in total.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 29, 2007 17:15

You need to post some more code...

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

Postby Vetal_28 » Mon Jan 29, 2007 18:10

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!

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 29, 2007 21:03

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;

Vetal_28
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Wed Nov 22, 2006 14:17
Contact:

Postby Vetal_28 » Tue Jan 30, 2007 16:05

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.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 3 guests