MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / OnMenuDisplayItem

Method OnMenuDisplayItem

extensions/topmenus/TopMenu.cpp:653–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651}
652
653unsigned int TopMenu::OnMenuDisplayItem(IBaseMenu *menu,
654 int client,
655 IMenuPanel *panel,
656 unsigned int item,
657 const ItemDrawInfo &dr)
658{
659 const char *item_name = menu->GetItemInfo(item, NULL);
660 if (!item_name)
661 {
662 return 0;
663 }
664
665 topmenu_object_t *obj;
666 if (!m_ObjLookup.retrieve(item_name, &obj))
667 return 0;
668
669 /* Ask the object to render the text for this client */
670 char renderbuf[TOPMENU_DISPLAY_BUFFER_SIZE];
671 obj->callbacks->OnTopMenuDisplayOption(this, client, obj->object_id, renderbuf, sizeof(renderbuf));
672
673 /* Build the new draw info */
674 ItemDrawInfo new_dr = dr;
675 new_dr.display = renderbuf;
676
677 /* Man I love the menu API. Ask the panel to draw the item and give the position
678 * back to Core's renderer. This way we don't have to worry about keeping the
679 * render buffer static!
680 */
681 return panel->DrawItem(new_dr);
682}
683
684void TopMenu::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason)
685{

Callers

nothing calls this directly

Calls 4

GetItemInfoMethod · 0.80
retrieveMethod · 0.45
DrawItemMethod · 0.45

Tested by

no test coverage detected