Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2009, 8:10:07 PM (15 years ago)
Author:
cmueri
Message:

The audio menu and all its functions are now enabled.

Location:
code/branches/presentation2/data/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/data/gui/layouts/AudioMenu.layout

    r6206 r6233  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.325,0},{0.85,0},{0.6,0}}" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.325,0},{0.8,0},{0.6,0}}" />
    1818            <Window Type="TaharezLook/StaticText" Name="orxonox/MasterVolume" >
    19                 <Property Name="Text" Value="Master volume" />
     19                <Property Name="Text" Value="Master volume               " />
    2020                <Property Name="InheritsAlpha" Value="False" />
    2121                <Property Name="HorzFormatting" Value="HorzCentred" />
    2222                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    2323                <Property Name="VertFormatting" Value="TopAligned" />
    24                 <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.2,0},{0.34,0},{0.4,0}}" />
     24                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.2,0},{0.5625,0},{0.4,0}}" />
    2525                <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/MasterScrollbar" >
    2626                    <Property Name="PageSize" Value="0" />
     
    3131                    <Property Name="StepSize" Value="0.1" />
    3232                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    33                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
     33                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
    3434                    <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioMasterScrollbar_started" />
    3535                    <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioMasterScrollbar_ended" />
    3636                    <Event Name="ScrollPosChanged" Function="AudioMenu.AudioMasterScrollbar_changed" />
    3737                </Window>
     38                <Window Type="TaharezLook/Checkbox" Name="orxonox/MasterCheckbox" >
     39                    <Property Name="Text" Value="Mute" />
     40                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     41                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
     42                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMasterCheckbox_clicked"/>
     43                </Window>
    3844            </Window>
    3945            <Window Type="TaharezLook/StaticText" Name="orxonox/MusicVolume" >
    40                 <Property Name="Text" Value="Music volume" />
     46                <Property Name="Text" Value="Music volume               " />
    4147                <Property Name="InheritsAlpha" Value="False" />
    4248                <Property Name="HorzFormatting" Value="HorzCentred" />
    4349                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    4450                <Property Name="VertFormatting" Value="TopAligned" />
    45                 <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.45,0},{0.34,0},{0.65,0}}" />
     51                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.45,0},{0.5625,0},{0.65,0}}" />
    4652                <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/MusicScrollbar" >
    4753                    <Property Name="PageSize" Value="0" />
     
    5258                    <Property Name="StepSize" Value="0.1" />
    5359                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    54                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
     60                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
    5561                    <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioMusicScrollbar_started" />
    5662                    <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioMusicScrollbar_ended" />
    5763                    <Event Name="ScrollPosChanged" Function="AudioMenu.AudioMusicScrollbar_changed" />
    5864                </Window>
     65                <Window Type="TaharezLook/Checkbox" Name="orxonox/MusicCheckbox" >
     66                    <Property Name="Text" Value="Mute" />
     67                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     68                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
     69                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMusicCheckbox_clicked"/>
     70                </Window>
    5971            </Window>
    6072            <Window Type="TaharezLook/StaticText" Name="orxonox/EffectsVolume" >
    61                 <Property Name="Text" Value="Effects volume" />
     73                <Property Name="Text" Value="Effects volume               " />
    6274                <Property Name="InheritsAlpha" Value="False" />
    6375                <Property Name="HorzFormatting" Value="HorzCentred" />
    6476                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    6577                <Property Name="VertFormatting" Value="TopAligned" />
    66                 <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.7,0},{0.34,0},{0.9,0}}" />
     78                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.7,0},{0.5625,0},{0.9,0}}" />
    6779                <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/EffectsScrollbar" >
    6880                    <Property Name="PageSize" Value="0" />
     
    7385                    <Property Name="StepSize" Value="0.1" />
    7486                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    75                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
     87                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
    7688                    <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioEffectsScrollbar_started" />
    7789                    <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioEffectsScrollbar_ended" />
    7890                    <Event Name="ScrollPosChanged" Function="AudioMenu.AudioEffectsScrollbar_changed" />
     91                </Window>
     92                <Window Type="TaharezLook/Checkbox" Name="orxonox/EffectsCheckbox" >
     93                    <Property Name="Text" Value="Mute" />
     94                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     95                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
     96                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteEffectsCheckbox_clicked"/>
    7997                </Window>
    8098            </Window>
     
    85103                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    86104                <Property Name="VertFormatting" Value="TopAligned" />
    87                 <Property Name="UnifiedAreaRect" Value="{{0.66,0},{0.2,0},{0.97,0},{0.9,0}}" />
     105                <Property Name="UnifiedAreaRect" Value="{{0.604166,0},{0.2,0},{0.958333,0},{0.9,0}}" />
    88106                <Window Type="TaharezLook/Combobox" Name="orxonox/AudioThemeCombobox" >
    89107                    <Property Name="AlwaysOnTop" Value="True" />
     
    95113                </Window>
    96114            </Window>
    97             <Window Type="TaharezLook/Checkbox" Name="orxonox/MasterCheckbox" >
    98                 <Property Name="Text" Value="Mute master" />
    99                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    100                 <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.275,0},{0.625,0},{0.375,0}}" />
    101                 <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMasterCheckbox_clicked"/>
    102             </Window>
    103             <Window Type="TaharezLook/Checkbox" Name="orxonox/MusicCheckbox" >
    104                 <Property Name="Text" Value="Mute music" />
    105                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    106                 <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.525,0},{0.625,0},{0.625,0}}" />
    107                 <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMusicCheckbox_clicked"/>
    108             </Window>
    109             <Window Type="TaharezLook/Checkbox" Name="orxonox/EffectsCheckbox" >
    110                 <Property Name="Text" Value="Mute effects" />
    111                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    112                 <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.775,0},{0.625,0},{0.875,0}}" />
    113                 <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteEffectsCheckbox_clicked"/>
    114             </Window>
    115115        </Window>
    116116        <Window Type="TaharezLook/Button" Name="orxonox/AudioBackButton" >
     
    120120            <Event Name="Clicked" Function="AudioMenu.AudioBackButton_clicked"/>
    121121        </Window>
    122         <Window Type="TaharezLook/StaticText" Name="orxonox/AudioAvailable" >
    123             <Property Name="Text" Value="Changes in audio settings are not yet available." />
    124             <Property Name="TextColours" Value="FFFF0000" />
    125             <Property Name="InheritsAlpha" Value="False" />
    126             <Property Name="HorzFormatting" Value="HorzCentred" />
    127             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    128             <Property Name="VertFormatting" Value="TopAligned" />
    129             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.75,0},{0.75,0},{0.8,0}}" />
    130         </Window>
    131122    </Window>
    132123</GUILayout>
  • code/branches/presentation2/data/gui/layouts/SettingsMenu.layout

    r6206 r6233  
    2626            <Window Type="TaharezLook/Button" Name="orxonox/MultiplayerOptionsButton" >
    2727                <Property Name="Text" Value="Multiplayer options" />
     28                <Property Name="Disabled" Value="True" />
    2829                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    2930                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.454545,0},{0.45,0},{0.636363,0}}" />
  • code/branches/presentation2/data/gui/scripts/AudioMenu.lua

    r6206 r6233  
    1414function P:init()
    1515    soundMgr = orxonox.SoundManager:getInstance()
     16    block = false
    1617    masterscrollbar_active = false
    1718    musicscrollbar_active = false
     
    2021    musicvolume = soundMgr:getVolume(orxonox.SoundType.ambient)
    2122    effectsvolume = soundMgr:getVolume(orxonox.SoundType.effects)
    22     window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
    23     window:setScrollPosition(mastervolume)
    24     window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
    25     window:setScrollPosition(musicvolume)
    26     window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
    27     window:setScrollPosition(effectsvolume)
    28     dropdown = winMgr:getWindow("orxonox/AudioThemeCombobox")
     23    mastermute = soundMgr:getMute(orxonox.SoundType.none)
     24    musicmute = soundMgr:getMute(orxonox.SoundType.ambient)
     25    effectsmute = soundMgr:getMute(orxonox.SoundType.effects)
     26    masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
     27    musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
     28    effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
     29    mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox")
     30    musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox")
     31    effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox")
     32    masterscrollbarwindow:setScrollPosition(mastervolume)
     33    musicscrollbarwindow:setScrollPosition(musicvolume)
     34    effectsscrollbarwindow:setScrollPosition(effectsvolume)
     35    mastermutewindow:setSelected(mastermute)
     36    musicmutewindow:setSelected(musicmute)
     37    effectsmutewindow:setSelected(effectsmute)
     38    choice = "Default"
     39    dropdownwindow = winMgr:getWindow("orxonox/AudioThemeCombobox")
    2940    local themeList = {}
    3041    table.insert(themeList, "Default")
     
    3344        item = CEGUI.createListboxTextItem(v)       
    3445        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
    35         CEGUI.toCombobox(dropdown):addItem(item)
     46        CEGUI.toCombobox(dropdownwindow):addItem(item)
    3647    end
     48    dropdownwindow:setItemSelectState(0,true)
    3749end
    3850
    3951function P.AudioMasterScrollbar_changed(e)
     52    if mastermute then
     53        block = true
     54        mastermutewindow:setSelected(false)
     55        block = false
     56        mastermute = false
     57    end
    4058    if masterscrollbar_active == false then
    41         window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
    42         volume = window:getScrollPosition()
    43         orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume)
     59        mastervolume = masterscrollbarwindow:getScrollPosition()
     60        orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume)
    4461    end
    4562end
     
    5067
    5168function P.AudioMasterScrollbar_ended(e)
    52     window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
    53     volume = window:getScrollPosition()
    54     orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume)
     69    mastervolume = masterscrollbarwindow:getScrollPosition()
     70    orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume)
    5571    masterscrollbar_active = false
    5672end
    5773
    5874function P.AudioMusicScrollbar_changed(e)
     75    if musicmute then
     76        block = true
     77        musicmutewindow:setSelected(false)
     78        block = false
     79        musicmute = false
     80    end
    5981    if musicscrollbar_active == false then
    60         window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
    61         volume = window:getScrollPosition()
    62         orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume)
     82        musicvolume = musicscrollbarwindow:getScrollPosition()
     83        orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume)
    6384    end
    6485end
     
    6990
    7091function P.AudioMusicScrollbar_ended(e)
    71     window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
    72     volume = window:getScrollPosition()
    73     orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume)
     92    musicmutewindow:setSelected(false)
     93    musicvolume = musicscrollbarwindow:getScrollPosition()
     94    orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume)
    7495    musicscrollbar_active = false
    7596end
    7697
    7798function P.AudioEffectsScrollbar_changed(e)
     99    if effectsmute then
     100        block = true
     101        effectsmutewindow:setSelected(false)
     102        block = false
     103        effectsmute = false
     104    end
    78105    if effectsscrollbar_active == false then
    79         window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
    80         volume = window:getScrollPosition()
    81         orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume)
     106        effectsvolume = effectsscrollbarwindow:getScrollPosition()
     107        orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume)
    82108    end
    83109end
     
    88114
    89115function P.AudioEffectsScrollbar_ended(e)
    90     window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
    91     volume = window:getScrollPosition()
    92     orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume)
     116    effectsmutewindow:setSelected(false)
     117    effectsvolume = effectsscrollbarwindow:getScrollPosition()
     118    orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume)
    93119    effectsscrollbar_active = false
    94120end
    95121
    96122function P.AudioMuteMasterCheckbox_clicked(e)
    97 --    if
    98 --        mastervolume = soundMgr:getVolume(orxonox.SoundType.none)
    99 --        window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
    100 --        window:setScrollPosition(0)
    101 --    end
    102     soundMgr:toggleMute(orxonox.SoundType.none)
     123    if block == false then
     124        if mastermute then
     125            masterscrollbarwindow:setScrollPosition(mastervolume)
     126            mastermute = false
     127        else
     128            temp = masterscrollbarwindow:getScrollPosition()
     129            masterscrollbarwindow:setScrollPosition(0)
     130            mastervolume = temp
     131            mastermute = true
     132        end
     133        soundMgr:toggleMute(orxonox.SoundType.none)
     134    end
    103135end
    104136
    105137function P.AudioMuteMusicCheckbox_clicked(e)
    106     soundMgr:toggleMute(orxonox.SoundType.ambient)
     138    if block == false then
     139        if musicmute then
     140            musicscrollbarwindow:setScrollPosition(musicvolume)
     141            musicmute = false
     142        else
     143            temp = musicscrollbarwindow:getScrollPosition()
     144            musicscrollbarwindow:setScrollPosition(0)
     145            musicvolume = temp
     146            musicmute = true
     147        end
     148        soundMgr:toggleMute(orxonox.SoundType.ambient)
     149    end
    107150end
    108151
    109152function P.AudioMuteEffectsCheckbox_clicked(e)
    110     soundMgr:toggleMute(orxonox.SoundType.effects)
     153    if block == false then
     154        if effectsmute then
     155            effectsscrollbarwindow:setScrollPosition(effectsvolume)
     156            effectsmute = false
     157        else
     158            temp = effectsscrollbarwindow:getScrollPosition()
     159            effectsscrollbarwindow:setScrollPosition(0)
     160            effectsvolume = temp
     161            effectsmute = true
     162        end
     163        soundMgr:toggleMute(orxonox.SoundType.effects)
     164    end
    111165end
    112166
    113167function P.AudioThemeCombobox_changed(e)
    114 --    local choice = winMgr:getWindow("orxonox/AudioThemeCombobox"):getFirstSelectedItem()
    115 --    if choice == "Default" then
    116 --        orxonox.CommandExecutor:execute("setMood default")
    117 --        debug("default selected")
    118 --    end
    119 --    if choice == "Drum 'n Bass" then
    120 --        orxonox.CommandExecutor:execute("setMood dnb")
    121 --        debug("dnb selected")
    122 --    end
     168    if dropdownwindow:isItemSelected(1) then
     169        orxonox.CommandExecutor:execute("setMood dnb")
     170    else
     171        orxonox.CommandExecutor:execute("setMood default")
     172    end
    123173end
    124174
Note: See TracChangeset for help on using the changeset viewer.