CEGUI question

RawrRawr Posts: 508 Seed
edited November 2015 in Mods
Hey everyone,

So I'm in the middle of making my own gui with cegui but I'm unsure which function does the thing I want.
Will be scrolling through the doc's but hoping someone can point my searches in the right direction.

Within the TUGLook.looknfeel there is a defined ImageButton widgetLook. I'd like to create more of these widgets via code and the exact number of them will vary. I do have an upper bound for the number of these widgets that I'd want to have but I'd prefer to not have that hard coded.

Is there a function for creating widgets from the Falagard definition? or is there a make base widget function which could then have an apply widgetLook function?

EDIT: OR I should create a new window and add to hierarchy each time ...
local subMenu = EternusEngine.UI.Layers.MainMenu:getChild("SubMenu")
EternusEngine.UI.Windows:createWindow("TUGLook/ImageButton","NewWidget" )
subMenu:addChild("NewWidget")
I'm not so sure about that. Is constantly generating windows expensive? I'd prefer something like:
subMenu:addWidget("TUGLook/ImageButton")
Programmer, designer, artist.

Comments

  • RawrRawr Posts: 508 Seed
    edited November 2015
    Ok realized I had answered my own question.
    Looked closer at MainMenu code and found these lines:
    local endGameButton = winMan:createWindow("TUGLook/Button", "EndGameButton")
    mainMenuNavButtons:addChild(endGameButton)
    which means that my code will look something like:
    local newButton = winMan:createWindow("TUGLook/ImageButton", "NewButton")
    subMenu:addChild(NewButton)
    Had a look into the docs for the createWindow() function and this is what it says:
    Create a new Window object of whatever type this WindowFactory produces.
    returns: Pointer to the new Window object.
    A WindowFactory is used to create and destroy windows of a specific type.
    For every type of Window object wihin the system (widgets, dialogs, movable
    windows etc) there must be an associated WindowFactory registered with the
    WindowFactoryManager so that the system knows how to create and destroy
    those types of Window base object.
    So every widget, dialog, movable window etc is simply a type of Window object. Great! create all the windows!
    Programmer, designer, artist.
  • RawrRawr Posts: 508 Seed
    Actually here's a good question, when the MainMenu.lua script is executed - is it just the Eternus globals that can be called?
    Programmer, designer, artist.
Sign In or Register to comment.