Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gamestates2/data/gui/scripts/MouseControlsMenu.lua @ 6874

Last change on this file since 6874 was 6722, checked in by rgrieder, 15 years ago

Renamed showGUI and hideGUI to showMenuSheet and hideMenuSheet.

  • Property svn:eol-style set to native
File size: 3.6 KB
RevLine 
[6363]1-- MouseControlsMenu.lua
2
[6718]3local P = createMenuSheet("MouseControlsMenu")
[6363]4
[6720]5function P.onLoad()
[6363]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
[6403]40        orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
[6363]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
[6403]51    orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
[6363]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
[6403]59        orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
[6363]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
[6403]70    orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
[6363]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
[6403]79        orxonox.config("KeyBinder", "bDeriveMouseInput_", 0)
[6363]80    end
81end
82
83function P.MouseDeriveButton_clicked(e)
84    if block == false then
85        block = true
86        normalwindow:setSelected(false)
87        block = false
[6403]88        orxonox.config("KeyBinder", "bDeriveMouseInput_", 1)
[6363]89    end
90end
91
92function P.MouseInvertCheckbox_clicked(e)
93    -- invert mouse
94end
95
96function P.MouseControlsBackButton_clicked(e)
[6722]97    hideMenuSheet(P.name)
[6363]98end
99
100return P
101
Note: See TracBrowser for help on using the repository browser.