Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/spaceNavigation/data/gui/scripts/MouseControlsMenu.lua @ 10108

Last change on this file since 10108 was 8079, checked in by landauf, 14 years ago

merged usability branch back to trunk

incomplete summary of the changes in this branch:

  • enhanced keyboard navigation in GUIs
  • implemented new graphics menu and changeable window size at runtime
  • added developer mode
  • HUD shows if game is paused, game pauses if ingame menu is opened
  • removed a few obsolete commands and hid some that are more for internal use
  • numpad works in console and gui
  • faster loading of level info
  • enhanced usage of compositors (Shader class)
  • improved camera handling, configurable FOV and aspect ratio
  • Property svn:eol-style set to native
File size: 3.8 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
34
35    P:setButton(1, 1, {
36            ["button"] = winMgr:getWindow("orxonox/MouseControlsBackButton"),
37            ["callback"]  = P.MouseControlsBackButton_clicked
38    })
39end
40
41function P.MouseControlsMouseNormalScrollbar_changed(e)
42    if mousenormalscrollbar_active == false then
43        scrollposition = mousenormalscrollbarwindow:getScrollPosition()
44        mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
45        orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
46    end
47end
48
49function P.MouseControlsMouseNormalScrollbar_started(e)
50    mousenormalscrollbar_active = true
51end
52
53function P.MouseControlsMouseNormalScrollbar_ended(e)
54    scrollposition = mousenormalscrollbarwindow:getScrollPosition()
55    mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
56    orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
57    mousenormalscrollbar_active = false
58end
59
60function P.MouseControlsMouseDeriveScrollbar_changed(e)
61    if mousederivescrollbar_active == false then
62        scrollposition = mousederivescrollbarwindow:getScrollPosition()
63        mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
64        orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
65    end
66end
67
68function P.MouseControlsMouseDeriveScrollbar_started(e)
69    mousederivescrollbar_active = true
70end
71
72function P.MouseControlsMouseDeriveScrollbar_ended(e)
73    scrollposition = mousederivescrollbarwindow:getScrollPosition()
74    mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
75    orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
76    mousederivescrollbar_active = false
77end
78
79function P.MouseNormalButton_clicked(e)
80    if block == false then
81        block = true
82        derivewindow:setSelected(false)
83        block = false
84        orxonox.config("KeyBinder", "bDeriveMouseInput_", 0)
85    end
86end
87
88function P.MouseDeriveButton_clicked(e)
89    if block == false then
90        block = true
91        normalwindow:setSelected(false)
92        block = false
93        orxonox.config("KeyBinder", "bDeriveMouseInput_", 1)
94    end
95end
96
97function P.MouseInvertCheckbox_clicked(e)
98    -- invert mouse
99end
100
101function P.MouseControlsBackButton_clicked(e)
102    hideMenuSheet(P.name)
103end
104
105return P
106
Note: See TracBrowser for help on using the repository browser.