Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6459


Ignore:
Timestamp:
Jan 24, 2010, 5:03:27 PM (15 years ago)
Author:
rgrieder
Message:

Simplified BasicGUI construction. Just give the name of the GUI as argument. The rest will be deduced.

Location:
code/branches/gamestate/data/gui/scripts
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/data/gui/scripts/AudioMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("AudioMenu")
    55if _REQUIREDNAME == nil then
    66    AudioMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "AudioMenu"
    12 P.layoutString = "AudioMenu.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/BasicGUI.lua

    r5781 r6459  
    88end
    99
     10-- useless?
    1011P.overlay = nil
    1112
    1213-- constructor of the GUI
    13 function P:new (gui, fname)
    14     local newElement = { window = gui, filename = fname, visible = false } or {}
     14function P:new(_filename, _visible, _gui)
     15    local newElement = {
     16        filename = _filename,
     17        gui = _gui,
     18        visible = _visible or false
     19    } or {}
    1520    setmetatable(newElement, self) -- connects new element with class
    1621    self.__index = self
     
    2328
    2429-- hide function for the GUI
    25 function P:hide ()
     30function P:hide()
    2631    self.window:hide()
    2732    self.visible = false
     
    2934
    3035-- show function for the GUI
    31 function P:show ()
     36function P:show()
    3237    self.window:show()
    3338    self.visible = true
    3439end
    3540
    36 function P:load ()
    37     self.window = winMgr:loadWindowLayout(self.layoutString)
     41function P:load()
     42    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
    3843    self:init()
    3944    return self
  • code/branches/gamestate/data/gui/scripts/ControlsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("ControlsMenu")
    55if _REQUIREDNAME == nil then
    66    ControlsMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "ControlsMenu"
    12 P.layoutString = "ControlsMenu.layout"
    1310
    1411function P.ControlsMouseControlsButton_clicked(e)
  • code/branches/gamestate/data/gui/scripts/CreditsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("CreditsMenu")
    55if _REQUIREDNAME == nil then
    66    CreditsMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "CreditsMenu"
    12 P.layoutString = "CreditsMenu.layout"
    1310
    1411function P.CreditsBackButton_clicked(e)
  • code/branches/gamestate/data/gui/scripts/DecisionPopup.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("DecisionPopup")
    55if _REQUIREDNAME == nil then
    66    DecisionPopup = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "DecisionPopup"
    12 P.layoutString = "DecisionPopup.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/GameplayMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("GameplayMenu")
    55if _REQUIREDNAME == nil then
    66    GameplayMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "GameplayMenu"
    12 P.layoutString = "GameplayMenu.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/GraphicsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("GraphicsMenu")
    55if _REQUIREDNAME == nil then
    66    GraphicsMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "GraphicsMenu"
    12 P.layoutString = "GraphicsMenu.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/InGameMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("InGameMenu")
    55if _REQUIREDNAME == nil then
    66    InGameMenu = P
     
    99end
    1010
    11 P.filename = "InGameMenu"
    12 P.layoutString = "InGameMenu.layout"
    1311
    1412function P:init()
  • code/branches/gamestate/data/gui/scripts/InfoPopup.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("InfoPopup")
    55
    66if _REQUIREDNAME == nil then
     
    99    _G[_REQUIREDNAME] = P
    1010end
    11 
    12 P.filename = "InfoPopup"
    13 P.layoutString = "InfoPopup.layout"
    1411
    1512function P:init()
  • code/branches/gamestate/data/gui/scripts/KeyBindMenu.lua

    r6427 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("KeyBindMenu")
    55
    66if _REQUIREDNAME == nil then
     
    99    _G[_REQUIREDNAME] = P
    1010end
    11 
    12 P.filename = "KeyBindMenu"
    13 P.layoutString = "KeyBindMenu.layout"
    1411
    1512function P:init()
  • code/branches/gamestate/data/gui/scripts/MainMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("MainMenu")
    55if _REQUIREDNAME == nil then
    66    MainMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "MainMenu"
    12 P.layoutString = "MainMenu.layout"
    1310
    1411-- events for MainMenu
  • code/branches/gamestate/data/gui/scripts/MouseControlsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("MouseControlsMenu")
    55if _REQUIREDNAME == nil then
    66    MouseControlsMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "MouseControlsMenu"
    12 P.layoutString = "MouseControlsMenu.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/MultiplayerMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("MultiplayerMenu")
    55if _REQUIREDNAME == nil then
    66    MultiplayerMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "MultiplayerMenu"
    12 P.layoutString = "MultiplayerMenu.layout"
    1310
    1411function P:init()
  • code/branches/gamestate/data/gui/scripts/MultiplayerOptionsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("MultiplayerOptionsMenu")
    55if _REQUIREDNAME == nil then
    66    MultiplayerOptionsMenu = P
     
    99end
    1010
    11 P.filename = "MultiplayerOptionsMenu"
    12 P.layoutString = "MultiplayerOptionsMenu.layout"
    13 
    1411function P.MultiplayerOptionsBackButton_clicked(e)
    1512    hideGUI(P.filename)
  • code/branches/gamestate/data/gui/scripts/PickupInventory.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("PickupInventory")
    55if _REQUIREDNAME == nil then
    66    PickupInventory = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "PickupInventory"
    12 P.layoutString = "PickupInventory.layout"
    1310
    1411P.lastEquipmentCount_ = 0
  • code/branches/gamestate/data/gui/scripts/QuestGUI.lua

    r6417 r6459  
    11gui = require("BasicGUI")
    2 local P = BasicGUI:new() --inherit everything from the gui package
     2local P = BasicGUI:new("QuestGUI")
    33if _REQUIREDNAME == nil then
    44    QuestGUI = P
     
    66    _G[_REQUIREDNAME] = P
    77end
    8 
    9 P.filename = "QuestGUI"
    10 P.layoutString = "QuestGUI.layout"
    118
    129function P:show()
  • code/branches/gamestate/data/gui/scripts/SettingsMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("SettingsMenu")
    55if _REQUIREDNAME == nil then
    66    SettingsMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "SettingsMenu"
    12 P.layoutString = "SettingsMenu.layout"
    1310
    1411function P.SettingsGameplayButton_clicked(e)
  • code/branches/gamestate/data/gui/scripts/SingleplayerMenu.lua

    r6417 r6459  
    22
    33BasicGUI = require("BasicGUI")
    4 local P = BasicGUI:new() --inherit everything from the gui package
     4local P = BasicGUI:new("SingleplayerMenu")
    55if _REQUIREDNAME == nil then
    66    SingleplayerMenu = P
     
    88    _G[_REQUIREDNAME] = P
    99end
    10 
    11 P.filename = "SingleplayerMenu"
    12 P.layoutString = "SingleplayerMenu.layout"
    1310
    1411function P:init()
Note: See TracChangeset for help on using the changeset viewer.