Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2010, 2:47:10 PM (15 years ago)
Author:
rgrieder
Message:

Merged remaining revisions from gamestate to gamestates2.

Location:
code/branches/gamestates2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestates2

  • code/branches/gamestates2/data/gui/scripts/BasicGUI.lua

    r5781 r6595  
    88end
    99
     10-- useless, even wrong? P is the class, not the object..
    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, _gui, _visible)
     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
     
    1823end
    1924
     25-- Override this function if you need to
    2026function P:init()
    21 -- this function is empty and intended for inheriting GUIs to use
     27end
     28
     29-- Override this function if you need to
     30-- But don't forget to stick to the naming convention ("GUI_" .. self.filename)
     31function P:createInputState()
     32    self.inputState = guiMgr:createInputState("GUI_" .. self.filename)
    2233end
    2334
    2435-- hide function for the GUI
    25 function P:hide ()
     36function P:hide()
    2637    self.window:hide()
    2738    self.visible = false
     
    2940
    3041-- show function for the GUI
    31 function P:show ()
     42function P:show()
    3243    self.window:show()
    3344    self.visible = true
    3445end
    3546
    36 function P:load ()
    37     self.window = winMgr:loadWindowLayout(self.layoutString)
     47function P:load()
     48    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
     49    self:createInputState()
    3850    self:init()
    3951    return self
Note: See TracChangeset for help on using the changeset viewer.