about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-07-03 00:36:07 +0200
committeroy <Tom_Adams@web.de>2011-07-03 00:36:07 +0200
commit7648ba30246ca8a692c27328145225535b8f300e (patch)
tree041882dd4a3605f5031b27dee22b08d7463bbb8c
parent6b4080aee8b19fe6d3aba5b716d6287d51e369fd (diff)
downloadzcatch-7648ba30246ca8a692c27328145225535b8f300e.tar.gz
zcatch-7648ba30246ca8a692c27328145225535b8f300e.zip
added a different mouse sens for menus/editor
-rw-r--r--src/game/client/components/emoticon.cpp1
-rw-r--r--src/game/client/components/menus.cpp1
-rw-r--r--src/game/client/components/spectator.cpp1
-rw-r--r--src/game/client/ui.cpp7
-rw-r--r--src/game/client/ui.h1
-rw-r--r--src/game/editor/editor.cpp1
-rw-r--r--src/game/variables.h1
7 files changed, 13 insertions, 0 deletions
diff --git a/src/game/client/components/emoticon.cpp b/src/game/client/components/emoticon.cpp
index 741a604f..bedfaafb 100644
--- a/src/game/client/components/emoticon.cpp
+++ b/src/game/client/components/emoticon.cpp
@@ -54,6 +54,7 @@ bool CEmoticon::OnMouseMove(float x, float y)
 	if(!m_Active)
 		return false;
 
+	UI()->ConvertMouseMove(&x, &y);
 	m_SelectorMouse += vec2(x,y);
 	return true;
 }
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 9826d863..4f3d2da7 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -1348,6 +1348,7 @@ bool CMenus::OnMouseMove(float x, float y)
 	if(!m_MenuActive)
 		return false;
 
+	UI()->ConvertMouseMove(&x, &y);
 	m_MousePos.x += x;
 	m_MousePos.y += y;
 	if(m_MousePos.x < 0) m_MousePos.x = 0;
diff --git a/src/game/client/components/spectator.cpp b/src/game/client/components/spectator.cpp
index e98df118..c69a7669 100644
--- a/src/game/client/components/spectator.cpp
+++ b/src/game/client/components/spectator.cpp
@@ -139,6 +139,7 @@ bool CSpectator::OnMouseMove(float x, float y)
 	if(!m_Active)
 		return false;
 
+	UI()->ConvertMouseMove(&x, &y);
 	m_SelectorMouse += vec2(x,y);
 	return true;
 }
diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp
index 2161bc77..00a30c15 100644
--- a/src/game/client/ui.cpp
+++ b/src/game/client/ui.cpp
@@ -53,6 +53,13 @@ int CUI::MouseInside(const CUIRect *r)
 	return 0;
 }
 
+void CUI::ConvertMouseMove(float *x, float *y)
+{
+	float Fac = (float)(g_Config.m_UiMousesens)/g_Config.m_InpMousesens;
+	*x = *x*Fac;
+	*y = *y*Fac;
+}
+
 CUIRect *CUI::Screen()
 {
 	float Aspect = Graphics()->ScreenAspect();
diff --git a/src/game/client/ui.h b/src/game/client/ui.h
index 017abf7c..7cd78d6f 100644
--- a/src/game/client/ui.h
+++ b/src/game/client/ui.h
@@ -79,6 +79,7 @@ public:
 	const void *LastActiveItem() const { return m_pLastActiveItem; }
 
 	int MouseInside(const CUIRect *pRect);
+	void ConvertMouseMove(float *x, float *y);
 
 	CUIRect *Screen();
 	void ClipEnable(const CUIRect *pRect);
diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp
index 8c186085..bc00c4a2 100644
--- a/src/game/editor/editor.cpp
+++ b/src/game/editor/editor.cpp
@@ -3337,6 +3337,7 @@ void CEditor::UpdateAndRender()
 	float rx, ry;
 	{
 		Input()->MouseRelative(&rx, &ry);
+		UI()->ConvertMouseMove(&rx, &ry);
 		m_MouseDeltaX = rx;
 		m_MouseDeltaY = ry;
 
diff --git a/src/game/variables.h b/src/game/variables.h
index 3af299cf..d6cf5ac5 100644
--- a/src/game/variables.h
+++ b/src/game/variables.h
@@ -45,6 +45,7 @@ MACRO_CONFIG_INT(UiPage, ui_page, 5, 0, 10, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interf
 MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page")
 MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")
 MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale")
+MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor")
 
 MACRO_CONFIG_INT(UiColorHue, ui_color_hue, 160, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color hue")
 MACRO_CONFIG_INT(UiColorSat, ui_color_sat, 70, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color saturation")