Page 2 of 10

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 8:33 am
by Nash
@Graf Zahl:

Is this a bug or "you're doing it wrong"? Calling Super.Drawer() on my custom OptionMenu class just produces blank menus. If I remove the Super.Drawer call, I don't get blank menus.

EDIT: Attachment removed, see this post for an updated and functional example

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 11:35 am
by Graf Zahl
Nash wrote:due to lack of documentation or proper consultation - may have just pasted the entire contents of ZDoom's MENUDEF into their own mod, and then only made cosmetic changes here and there.
That seems to be a common problem with modders which ultimately will kill the engine because nothing can get refactored again.

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 11:38 am
by Major Cooke
Kinsie wrote:How times change.
I'm still working on updating documentation but with college back in full swing, things have slowed down.

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 12:07 pm
by Graf Zahl
Nash wrote:@Graf Zahl:

Is this a bug or "you're doing it wrong"? Calling Super.Drawer() on my custom OptionMenu class just produces blank menus. If I remove the Super.Drawer call, I don't get blank menus.

The menu is blank. What do you expect?

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 1:02 pm
by Major Cooke
Graf, why is Selectable for things like submenus backwards? I.e. if selectable returns true, it cannot be selected.

Shouldn't that be renamed to NotSelectable, or have the logic be reversed?

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 1:16 pm
by Graf Zahl
What did you do?

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 1:22 pm
by Major Cooke
Turns out I was only looking at the very base version instead, didn't notice the version where it does mGrayCheck. Nevermind.

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 1:44 pm
by Major Cooke
What's this third parameter supposed to do for submenu? It takes an int but I'm not seeing what for...

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 2:27 pm
by Graf Zahl
It's a parameter that gets passed to the Init function of the submenu (e.g. to notify the skill menu of the chosen episode.)

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 5:46 pm
by Major Cooke
Okay. Is there a way to effectively replace all of one type of menu, say... OptionMenu without needing to go through, copy/paste GZDoom's menudef into our own and mass replace them?

Re: How to do things with the new menu functions?

Posted: Thu Feb 16, 2017 9:13 pm
by Nash
Here's an example CustomMenu. What I did:

- Every OptionMenu's header is changed to SmallFont, via way of DefaultOptionMenu (every OptionMenu is affected without me having to copy/paste a lot of stuff in MENUDEF)
- Controls changed to use SmallFont instead of ConFont

Shows the basics of doing stuff.

NOTE: Specifying a Class inside DefaultOptionMenu and DefaultListMenu only will work after this commit ... if you try my example WAD and you don't see SmallFont being used as the title header in every Option menu, just wait for a newer devbuild to come out

EDIT: Even BETTAR example here! -> viewtopic.php?p=978168#p978168

Re: How to do things with the new menu functions?

Posted: Fri Feb 17, 2017 9:06 am
by Major Cooke
I figured out how to get the player. It was actually not very difficult.

Code: Select all

Actor plr;
bool printOnce;
override void Ticker()
{
	Super.Ticker();
	if (!printOnce)
	{
		if (playeringame[consoleplayer])
			plr = players[consoleplayer].mo;
		
			
		if (plr)		plr.A_LogInt(1);
		else			console.Printf("Ruh roh!");
			
		printOnce = true;
	}
}
If I'm right about this, I might be able to replace the alias keyconf hackery used to prop up D4D's purchase menu after all. :D

Re: How to do things with the new menu functions?

Posted: Fri Feb 17, 2017 10:21 am
by Nash
Graf - what are the key differences between ListMenu and OptionMenu and more importantly, which should I pick for a particular situation, if I want to make a completely new menu?

You can put widgets and functionality in both, and you can also draw images and text on both... for example, the player menu is one complicated ListMenu with all kinds of stuff in it, but nothing's stopping from making the player menu an OptionMenu if one wanted to. So I'm not really understanding why are there 2 distinct kinds of menus...

Re: How to do things with the new menu functions?

Posted: Fri Feb 17, 2017 10:59 am
by Nash
An even more updated menu example!!!!!!!

I added a completely fresh and custom menu, an imaginary "Items Menu".

In this demo, I show you how to create a pretty cool widget that is unselectable, prints the player's current health and bullets, and show you how to hook it all up so that your players can call this menu in-game.

This will be the basis for your custom shop system, inventory screen or player stats screen... anything you can think of!

Thanks to MajorCooke for confirming that you can retrieve player data in the menu!

EDIT: File deleted. It does not work anymore in the latest revisions as some underlying systems have changed. See Major Cooke's new example instead: viewtopic.php?p=982760#p982760

Re: How to do things with the new menu functions?

Posted: Fri Feb 17, 2017 11:51 am
by Major Cooke
No problem. ;)

Note to self: Do not attempt to inherit from ListMenuItemTextItem or ListMenuItemPatchItem. It's impossible to get a working Init function going and, without its definition, will fail to initialize at all. Instead, inherit from ListMenuItemSelectable and use the aforementioned classes innards.