Build a Menu [C#]

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Revan1985
Posts: 89
Joined: Tue May 08, 2007 4:11 pm
Location: Italy

Build a Menu [C#]

Post by Revan1985 »

ok, i believe to have posted in wrong section, so i repeat it here

Hi all, i'm trying to build a menu in Irrlicht, for my game, but i've some problem...

1) I'm not able to "Clear" the IGUIEnvironment after i quit from a menu
2) I'm trying to dispose the GUIEnvironment, and recreate it

Code: Select all

                switch(ev.GUIEvent)
                {
                    case(GUIEventType.ButtonClicked):
                        if (id == 101)
                        {
                            menu = 'p';         // Entra nel menu di gioco
                            env.Dispose();
                            env = device.GUIEnvironment;
                            CreateOnlyBackground();
                        }
but it don't work


How can i create it?
Thx :wink:
CPU: AMD PHENOMII X6 1090T BE 3,2GHZ
RAM : OCZ 8GB 2*4GB DDR3 LOW VOLTAGE 1333
VGA: GeForce GTX680 2GB
HD : 500GB + 500GB + 2x1TB Raid Edition + 500GB External
Motherboard: ASUS CROSSHAIR FORMULA 4 890FX AM3
PSU: Corsair 750W
CPU Cooling: Katana 2
Revan1985
Posts: 89
Joined: Tue May 08, 2007 4:11 pm
Location: Italy

Post by Revan1985 »

noone can help?

ok, more easy thing...
how can i clear a object?

or better, how i destroy an object [i suppose i need to use Dispose() ] and then recreate it?

why the istructions

env.Dispose();
env = new GUIEnvironment();

don't work?
please, help me, i'm crying :oops:
CPU: AMD PHENOMII X6 1090T BE 3,2GHZ
RAM : OCZ 8GB 2*4GB DDR3 LOW VOLTAGE 1333
VGA: GeForce GTX680 2GB
HD : 500GB + 500GB + 2x1TB Raid Edition + 500GB External
Motherboard: ASUS CROSSHAIR FORMULA 4 890FX AM3
PSU: Corsair 750W
CPU Cooling: Katana 2
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

try element.Remove();
Revan1985
Posts: 89
Joined: Tue May 08, 2007 4:11 pm
Location: Italy

Post by Revan1985 »

IGUIEnvironment had not a Method called Rmove();

I try a link, but is revealing impossible to convert it in C#

http://irrlicht.sourceforge.net/phpBB2/ ... game+state
and i am becoming crazy...
noone know how do it?

thx :D

EDIT : ehm, there is a core::list like for c#?
CPU: AMD PHENOMII X6 1090T BE 3,2GHZ
RAM : OCZ 8GB 2*4GB DDR3 LOW VOLTAGE 1333
VGA: GeForce GTX680 2GB
HD : 500GB + 500GB + 2x1TB Raid Edition + 500GB External
Motherboard: ASUS CROSSHAIR FORMULA 4 890FX AM3
PSU: Corsair 750W
CPU Cooling: Katana 2
Delight
Posts: 42
Joined: Tue Jul 05, 2005 3:16 pm
Location: Muenster, Germany

Post by Delight »

In IrrlichtNetCP following code should work. Just call the Clear() Function to remove all gui elements

Code: Select all

public static void Clear()
		{
			ClearChildren( env.RootElement );
		}
		
		public static void ClearChildren( GUIElement element )
		{
			GUIElement[] children = element.Children;
			
			for( int i = 0; i < children.Length; i++ )
			{
				if( children[i].Children.Length != 0 )
					ClearChildren( children[i] );

				children[i].Remove();
			}
		}
Revan1985
Posts: 89
Joined: Tue May 08, 2007 4:11 pm
Location: Italy

Post by Revan1985 »

:)

you are a god, now this?
thx ^^
CPU: AMD PHENOMII X6 1090T BE 3,2GHZ
RAM : OCZ 8GB 2*4GB DDR3 LOW VOLTAGE 1333
VGA: GeForce GTX680 2GB
HD : 500GB + 500GB + 2x1TB Raid Edition + 500GB External
Motherboard: ASUS CROSSHAIR FORMULA 4 890FX AM3
PSU: Corsair 750W
CPU Cooling: Katana 2
Locked