Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8021 for code/branches


Ignore:
Timestamp:
Mar 5, 2011, 7:10:31 PM (14 years ago)
Author:
landauf
Message:

if the resolution is changed in the graphics menu, a decision popup prompts for confirmation and resets the settings if not accepted (or automatically after 10 seconds)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/scripts/GraphicsMenu.lua

    r8019 r8021  
    323323    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
    324324
     325    -- start revert timer
     326    P.oldWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
     327    P.oldHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
     328    P.oldFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
     329
     330    P.revertTimerHandle = orxonox.CommandExecutor:query("delay 10 \"hideGUI DecisionPopup; GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen) .. "\"")
     331
     332    -- change settings
    325333    orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. widthEditbox:getText() .. " " .. heightEditbox:getText() .. " " .. checkedFullscreen)
    326334
    327335    P.updateApplyButton()
     336
     337    -- prompt for confirmation
     338    openDecisionPopup("Do you want to keep these settings? (Settings will be reverted in 10 seconds if not accepted)", GraphicsMenu.callback_ApplyDecisionPopup)
     339end
     340
     341function P.callback_ApplyDecisionPopup(pressedOK)
     342    orxonox.CommandExecutor:execute("killdelay " .. P.revertTimerHandle)
     343
     344    if not pressedOK then
     345        orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen))
     346        P:onShow()
     347    end
    328348end
    329349
Note: See TracChangeset for help on using the changeset viewer.