No worries.
That's just it though. Prevention from important things being overridden I suppose. That part I don't know fully.
Moderator: GZDoom Developers
AFADoomer wrote:Ah.
Damnit, you're right. Sorry.
So what is the difference between me adding a new Class there and replacing the old class for PlayerMenu with a class that inherits from PlayerMenu? Besides "the engine won't let you"? Shouldn't the inherited class have all of the same underlying code as the parent class? Is this actually something that should not be done, or a holdover from the old system where everything was in compiled code?
AFADoomer wrote:I edited after you posted... Maybe Graf can weigh in, then? I may do a feature request...
screen.DrawTexture (mTexture, true, x, mYpos, DTA_Clean, true);
screen.DrawText(mFont, mColor, x, mYpos, text, DTA_Clean, true);
TextItem "Set it up!","o", "OptionsMenu"
for (int i = 0; i < mDesc.mItems.Size(); i++)
{
if (mDesc.mItems[i] is "ListMenuItemTextItem")
{
console.printf("%s", ListMenuItemTextItem(mDesc.mItems[i]).mText);
}
}
Nash wrote:Can someone explain to me menu descriptors like I'm a 5 year old?
Despite being able to work with menus and produce somewhat usable widgets, I can't honestly say I truly understand the descriptor concept.
AFADoomer wrote:Each menu item is referenced in the menu descriptor's mItems array. You have to access the correct entry of that array, cast the item as the right type of control (ListMenuItemTextItem), and retrieve the mText value.
So something like this running in your list menu class's Init code should print the list menu text item values to the console every time the menu is opened:
- Code: Select all • Expand view
for (int i = 0; i < mDesc.mItems.Size(); i++)
{
if (mDesc.mItems[i] is "ListMenuItemTextItem")
{
console.printf("%s", ListMenuItemTextItem(mDesc.mItems[i]).mText);
}
}
If you want to select a specific item, you can experiment with the GetItem function - GetItem('OptionsMenu') should return the list item you use in your example (See the player menu for an example of this in action).
Spoiler: "Original Post"
Users browsing this forum: No registered users and 2 guests