Difference between revisions of "CreateGridMenu"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Created page with "<onlyinclude> Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created [[CG...")
(No difference)

Revision as of 15:02, 17 August 2012

Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created CGridMenu.

You'll normally want to get use the current position of the mouse as the position, so something like 'getControls().getMouseScreenPos()' will often do for position argument. The ownerBlob is the blob that the grid relates to and that commands are sent back to. Usually this will be the same blob you're writing the grid for, so you'll just use a 'this' reference.

CGridMenu@ CreateGridMenu( position2di pos2d, CBlob@ ownerBlob, dimension2di slots, const string &caption


Example from Entities/Workshops/Scripts/WorkshopEmpty.as:

CControls@ controls = caller.getControls();
CGridMenu@ menu = CreateGridMenu( controls.getMouseScreenPos(), this, dimension2di(4,3), "Convert to..." );