Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6266 for code


Ignore:
Timestamp:
Dec 7, 2009, 9:45:39 PM (15 years ago)
Author:
dafrick
Message:

KeyBindMenu is working now. (Apart from some minor faults)
Found some commandExecutor("show/hideGUI …") in DecisionPopup, and another possible bug.
Added an InfoPopup

Location:
code/branches/presentation2
Files:
2 added
7 edited

Legend:

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

    r6224 r6266  
    22
    33<GUILayout >
    4     <Window Type="DefaultWindow" Name="orxonox/KeyBindBackground" >
     4    <Window Type="DefaultWindow" Name="orxonox/KeyBindMenu/Background" >
    55        <Property Name="InheritsAlpha" Value="False" />
    66        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     
    1414            <Property Name="VertFormatting" Value="TopAligned" />
    1515            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.325,0},{0.75,0},{0.6,0}}" />
    16             <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane/" >
     16            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" >
    1717                <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
    1818                <Property Name="HorzStepSize" Value="0.1" />
     
    2424                <Property Name="HorzScrollPosition" Value="0" />
    2525                <Property Name="VertScrollPosition" Value="0" />
    26                 <AutoWindow NameSuffix="__auto_container__" >
    27                     <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
    28                     <Property Name="ChildExtentsArea" Value="l:0 t:0 r:0 b:0" />
    29                 </AutoWindow>
    3026            </Window>
    3127        </Window>
     
    3430            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    3531            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.625,0},{0.6,0},{0.675,0}}" />
     32            <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/>
    3633        </Window>
    3734    </Window>
  • code/branches/presentation2/data/gui/scripts/DecisionPopup.lua

    r6150 r6266  
    2828        P.functionPtr(true)
    2929    end
    30     orxonox.CommandExecutor:execute("hideGUI DecisionPopup")
     30    hideGUI("DecisionPopup")
    3131end
    3232
     
    3535        P.functionPtr(false)
    3636    end
    37     orxonox.CommandExecutor:execute("hideGUI DecisionPopup")
     37    hideGUI("DecisionPopup")
    3838end
    3939
  • code/branches/presentation2/data/gui/scripts/GUITools.lua

    r6150 r6266  
    11function openDecisionPopup( text, callbackPtr )
    2     orxonox.CommandExecutor:execute("showGUI DecisionPopup false true")
    3 --     showGUI("DecisionPopup", false, true)
    4     DecisionPopup.setCallback(InGameMenu.callback)
     2    showGUI("DecisionPopup", false, true)
     3    DecisionPopup.setCallback(callbackPtr)
    54    DecisionPopup.setText(text)
    65end
     6
     7function openInfoPopup( text, functionPtr )
     8    showGUI("InfoPopup", false, true)
     9    InfoPopup.setDo(functionPtr)
     10    InfoPopup.setText(text)
     11end
  • code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua

    r6215 r6266  
    222222    return nil
    223223end
     224
     225function test(e)
     226    debug(0, "Blubb")
     227end
  • code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua

    r6224 r6266  
    1 -- NewMouseControlsMenu.lua
     1-- KeyBindMenu.lua
    22
    33BasicGUI = require("BasicGUI")
    44local P = BasicGUI:new() --inherit everything from the gui package
    55if _REQUIREDNAME == nil then
    6     NewMouseControlsMenu = P
     6    KeyBindMenu = P
    77else
    88    _G[_REQUIREDNAME] = P
    99end
    1010
    11 P.filename = "NewMouseControlsMenu"
    12 P.layoutString = "NewMouseControlsMenu.layout"
     11P.filename = "KeyBindMenu"
     12P.layoutString = "KeyBindMenu.layout"
     13
     14function P:init()
     15    commandList = {}
     16    table.insert(commandList, "fire 0")
     17    table.insert(commandList, "fire 1")
     18    table.insert(commandList, "fire 2")
     19
     20    local lineHeight = 30
     21   
     22    local window = winMgr:getWindow("orxonox/KeyBindPane")
     23
     24    for k,v in pairs(commandList) do
     25        local button = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Button")
     26        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
     27        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
     28       
     29        line:setSize(CEGUI.UVector2(CEGUI.UDim(1,-13),CEGUI.UDim(0, lineHeight)))
     30        button:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(1, 0)))
     31        command:setSize(CEGUI.UVector2(CEGUI.UDim(0.6, 0), CEGUI.UDim(1, 0)))
     32       
     33        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.6, 0),CEGUI.UDim(0, 0)))
     34        command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, 0)))
     35        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))
     36       
     37        button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
     38        command:setText(v)
     39       
     40        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
     41        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
     42       
     43        line:addChildWindow(command)
     44        line:addChildWindow(button)
     45        window:addChildWindow(line)
     46    end
     47end
     48
     49function P.KeyBindButton_clicked(e)
     50    local we = CEGUI.toWindowEventArgs(e)
     51    local name = we.window:getName()
     52    commandNr = tonumber(string.match(name, "%d+"))
     53   
     54    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind)
     55
     56end
     57
     58function P.keybind()
     59    orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
     60end
    1361
    1462function P.KeyBindBackButton_clicked(e)
    15     hideGUI("NewMouseControlsMenu")
     63    hideGUI("KeyBindMenu")
    1664    debug("event: back")
    1765end
  • code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc

    r6182 r6266  
    3737#include "InputManager.h"
    3838#include "KeyDetector.h"
     39
     40#include <CEGUIWindow.h>
    3941
    4042namespace orxonox
     
    9092        else
    9193            this->bDefaultFileLoaded_ = false;
     94    }
     95   
     96    void KeyBinderManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function)
     97    {
     98        window->subscribeScriptedEvent(event, function);
    9299    }
    93100
  • code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h

    r6214 r6266  
    3636#include "util/Singleton.h"
    3737#include "core/OrxonoxClass.h"
     38
     39#include <CEGUIForwardRefs.h>
    3840
    3941namespace orxonox //tolua_export
     
    7981        void setToDefault()
    8082            { this->setCurrent(this->defaultFilename_); }
     83           
     84        void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
    8185
    8286        //! Returns a pointer to a KeyBinder (creates it if not yet loaded)
     
    9195
    9296        //! Bind 'command' to any key pressed after this call (use with care!)
    93         inline void keybind(const std::string& command)
    94             { this->keybindInternal(command, false); }
     97        inline void keybind(const std::string& command) { this->keybindInternal(command, false); } //tolua_export
    9598        //! Bind 'command' to any key pressed after this call (use with care!), but temporarily (no file save)
    9699        inline void tkeybind(const std::string& command)
Note: See TracChangeset for help on using the changeset viewer.