Mouse Sensitivity TGEA 1.8.2
by Walker Twyman · 03/23/2010 (9:32 pm) · 0 comments
In this resource, we will add a slider to adjust mouse sensitivity and the option to invert your mouse in the options window.
I take no credit for the code in this resource. Xavier "eXoDuS" Amado wrote a very good resource for adding mouse sensitivity controls to TGE. As I was working on adding his code, I noticed there was a pref for mouse sensitivity already added, just no option for it. This resource uses that pref instead.
Files Changed
optionsDlg.gui (gamescriptsAndAssetsclientui)
optionsDlg.cs (gamescriptsAndAssetsclientscripts)
default.bind.cs (gamescriptsAndAssetsclientscripts)
Instructions
optionsDlg.gui Changes
Find
Change
To
Find
Change
Underneath it add
Find
Change
To
optionsDlg.cs Changes
Find
Underneath it add
At the end of the file add
default.bind.cs Changes
Find
Change it to
Your default sensitivity is set at 1 in defaults.cs.
I take no credit for the code in this resource. Xavier "eXoDuS" Amado wrote a very good resource for adding mouse sensitivity controls to TGE. As I was working on adding his code, I noticed there was a pref for mouse sensitivity already added, just no option for it. This resource uses that pref instead.
Files Changed
optionsDlg.gui (gamescriptsAndAssetsclientui)
optionsDlg.cs (gamescriptsAndAssetsclientscripts)
default.bind.cs (gamescriptsAndAssetsclientscripts)
Instructions
optionsDlg.gui Changes
Find
new GuiWindowCtrl() {Change
Extent = "377 303";
To
Extent = "377 340";
Find
new GuiControl(OptControlsPane) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "9 55";
Extent = "357 208";
MinExtent = "8 8";
canSave = "1";
Visible = "0";
hovertime = "1000";Change
Extent = "357 208";To
Extent = "357 250";
Underneath it add
new GuiCheckBoxCtrl() {
profile = "GuiCheckBoxProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "7 210";
extent = "140 30";
minExtent = "8 8";
visible = "1";
variable = "$pref::Input::MouseInvert";
helpTag = "0";
text = "Invert Mouse";
groupNum = "-1";
buttonType = "ToggleButton";
};
new GuiSliderCtrl(OptMouseSensitivity) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "179 217";
extent = "170 34";
minExtent = "8 8";
visible = "1";
variable = "value";
altCommand = "OptMouseSetSensitivity(OptMouseSensitivity.value);";
helpTag = "0";
range = "0.100000 2.000000";
ticks = "1000";
value = "0.12375";
};Find
new GuiButtonCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "305 270";
Extent = "60 23";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "Canvas.popDialog(optionsDlg);";
hovertime = "1000";
text = "OK";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};Change
position = "305 270";
To
position = "305 310";
optionsDlg.cs Changes
Find
OptShadowDetailMenu.setSelected($pref::LightManager::DynamicShadowDetailSize);
Underneath it add
OptMouseSensitivity.setValue( $pref::Input::LinkMouseSensitivity);
At the end of the file add
function OptMouseSetSensitivity(%value)
{
$pref::Input::LinkMouseSensitivity = %value;
}default.bind.cs Changes
Find
function pitch(%val)
{
$mvPitch += getMouseAdjustAmount(%val);
}Change it to
function pitch(%val)
{
if($Pref::Input::MouseInvert)
$mvPitch -= getMouseAdjustAmount(%val);
else $mvPitch += getMouseAdjustAmount(%val);
}Your default sensitivity is set at 1 in defaults.cs.
