- Timestamp:
- Apr 23, 2010, 11:41:30 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestates3/data/gui/scripts/MouseControlsMenu.lua
r6746 r6773 4 4 5 5 function 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))) 6 P.block = false 7 P.mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar") 8 P.mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar") 9 P.normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton") 10 P.derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton") 11 --P.invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox") 12 P.mousenormalscrollbar_active = false 13 P.mousederivescrollbar_active = false 14 local derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_") 15 local invert_active = false 16 local normal_active 17 P.mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_") 18 P.mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_") 19 P.mousenormalscrollbarwindow:setScrollPosition((math.log(14*P.mousenormalsensitivity-6))/(6*math.log(2))) 20 P.mousederivescrollbarwindow:setScrollPosition((math.log(14*P.mousederivesensitivity-6))/(6*math.log(2))) 20 21 if derive_active == "true" then 21 22 normal_active = false 22 23 derive_active = true 23 derivewindow:setSelected(derive_active)24 P.derivewindow:setSelected(derive_active) 24 25 else 25 26 normal_active = true 26 27 derive_active = false 27 normalwindow:setSelected(normal_active)28 P.normalwindow:setSelected(normal_active) 28 29 end 29 30 if invert_active == "true" then … … 35 36 36 37 function P.MouseControlsMouseNormalScrollbar_changed(e) 37 if mousenormalscrollbar_active == false then38 scrollposition =mousenormalscrollbarwindow:getScrollPosition()39 mousenormalsensitivity = (math.pow(64,scrollposition)+6)/1440 orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)38 if P.mousenormalscrollbar_active == false then 39 local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition() 40 P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14 41 orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity) 41 42 end 42 43 end 43 44 44 45 function P.MouseControlsMouseNormalScrollbar_started(e) 45 mousenormalscrollbar_active = true46 P.mousenormalscrollbar_active = true 46 47 end 47 48 48 49 function P.MouseControlsMouseNormalScrollbar_ended(e) 49 scrollposition =mousenormalscrollbarwindow:getScrollPosition()50 mousenormalsensitivity = (math.pow(64,scrollposition)+6)/1451 orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)52 mousenormalscrollbar_active = false50 local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition() 51 P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14 52 orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity) 53 P.mousenormalscrollbar_active = false 53 54 end 54 55 55 56 function P.MouseControlsMouseDeriveScrollbar_changed(e) 56 if mousederivescrollbar_active == false then57 scrollposition =mousederivescrollbarwindow:getScrollPosition()58 mousederivesensitivity = (math.pow(64,scrollposition)+6)/1459 orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)57 if P.mousederivescrollbar_active == false then 58 local scrollposition = P.mousederivescrollbarwindow:getScrollPosition() 59 P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14 60 orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity) 60 61 end 61 62 end 62 63 63 64 function P.MouseControlsMouseDeriveScrollbar_started(e) 64 mousederivescrollbar_active = true65 P.mousederivescrollbar_active = true 65 66 end 66 67 67 68 function P.MouseControlsMouseDeriveScrollbar_ended(e) 68 scrollposition =mousederivescrollbarwindow:getScrollPosition()69 mousederivesensitivity = (math.pow(64,scrollposition)+6)/1470 orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)71 mousederivescrollbar_active = false69 local scrollposition = P.mousederivescrollbarwindow:getScrollPosition() 70 P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14 71 orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity) 72 P.mousederivescrollbar_active = false 72 73 end 73 74 74 75 function P.MouseNormalButton_clicked(e) 75 if block == false then76 block = true77 derivewindow:setSelected(false)78 block = false76 if P.block == false then 77 P.block = true 78 P.derivewindow:setSelected(false) 79 P.block = false 79 80 orxonox.config("KeyBinder", "bDeriveMouseInput_", 0) 80 81 end … … 82 83 83 84 function P.MouseDeriveButton_clicked(e) 84 if block == false then85 block = true86 normalwindow:setSelected(false)87 block = false85 if P.block == false then 86 P.block = true 87 P.normalwindow:setSelected(false) 88 P.block = false 88 89 orxonox.config("KeyBinder", "bDeriveMouseInput_", 1) 89 90 end
Note: See TracChangeset
for help on using the changeset viewer.