Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/doc/data/gui/scripts/MouseControlsMenu.lua @ 7335

Last change on this file since 7335 was 6746, checked in by rgrieder, 15 years ago

Merged gamestates2 branch back to trunk.
This brings in some heavy changes in the GUI framework.
It should also fix problems with triggered asserts in the InputManager.

Note: PickupInventory does not seem to work —> Segfault when showing because before, the owner in GUIOverlay::setGUIName is already NULL.
I haven't tested it before, so I can't tell whether it's my changes.

  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1-- MouseControlsMenu.lua
2
3local P = createMenuSheet("MouseControlsMenu")
4
5function P.onLoad()
6    block = false
7    mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar")
8    mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar")
9    normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton")
10    derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton")
11    invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox")
12    mousenormalscrollbar_active = false
13    mousederivescrollbar_active = false
14    derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_")
15    invert_active = false
16    mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_")
17    mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_")
18    mousenormalscrollbarwindow:setScrollPosition((math.log(14*mousenormalsensitivity-6))/(6*math.log(2)))
19    mousederivescrollbarwindow:setScrollPosition((math.log(14*mousederivesensitivity-6))/(6*math.log(2)))
20    if derive_active == "true" then
21        normal_active = false
22        derive_active = true
23        derivewindow:setSelected(derive_active)
24    else
25        normal_active = true
26        derive_active = false
27        normalwindow:setSelected(normal_active)
28    end
29    if invert_active == "true" then
30        invert_active = true
31    else
32        invert_active = false
33    end
34end
35
36function P.MouseControlsMouseNormalScrollbar_changed(e)
37    if mousenormalscrollbar_active == false then
38        scrollposition = mousenormalscrollbarwindow:getScrollPosition()
39        mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
40        orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
41    end
42end
43
44function P.MouseControlsMouseNormalScrollbar_started(e)
45    mousenormalscrollbar_active = true
46end
47
48function P.MouseControlsMouseNormalScrollbar_ended(e)
49    scrollposition = mousenormalscrollbarwindow:getScrollPosition()
50    mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
51    orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
52    mousenormalscrollbar_active = false
53end
54
55function P.MouseControlsMouseDeriveScrollbar_changed(e)
56    if mousederivescrollbar_active == false then
57        scrollposition = mousederivescrollbarwindow:getScrollPosition()
58        mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
59        orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
60    end
61end
62
63function P.MouseControlsMouseDeriveScrollbar_started(e)
64    mousederivescrollbar_active = true
65end
66
67function P.MouseControlsMouseDeriveScrollbar_ended(e)
68    scrollposition = mousederivescrollbarwindow:getScrollPosition()
69    mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
70    orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
71    mousederivescrollbar_active = false
72end
73
74function P.MouseNormalButton_clicked(e)
75    if block == false then
76        block = true
77        derivewindow:setSelected(false)
78        block = false
79        orxonox.config("KeyBinder", "bDeriveMouseInput_", 0)
80    end
81end
82
83function P.MouseDeriveButton_clicked(e)
84    if block == false then
85        block = true
86        normalwindow:setSelected(false)
87        block = false
88        orxonox.config("KeyBinder", "bDeriveMouseInput_", 1)
89    end
90end
91
92function P.MouseInvertCheckbox_clicked(e)
93    -- invert mouse
94end
95
96function P.MouseControlsBackButton_clicked(e)
97    hideMenuSheet(P.name)
98end
99
100return P
101
Note: See TracBrowser for help on using the repository browser.