using System; using System.Collections.Generic; using System.Text; using System.Drawing; namespace KS.GUI.Menus { public class MainMenu { Window Menu; Button Play; Button Editor; Button Exit; public MainMenu( ) { Menu = new Window( new Rectangle( 0, 0, 200, 80 ), "Main Menu", ( Window.CreateFlags.Center | Window.CreateFlags.NonMovable ) ); // These buttons have the center and auto size flags toggled, so there is no need to specify the X location and dimensions. Play = new Button( new Rectangle( 0, 20, 0, 0 ), "Play Game", ( Widget.CreateFlags.Center | Widget.CreateFlags.FitToCaption ) ); Editor = new Button( new Rectangle( 0, 40, 0, 0 ), "Map Editor", ( Widget.CreateFlags.Center | Widget.CreateFlags.FitToCaption ) ); Exit = new Button( new Rectangle( 0, 60, 0, 0 ), "Exit Game", ( Widget.CreateFlags.Center | Widget.CreateFlags.FitToCaption ) ); Play.ClickMessage += new Widget.ClickDelegate( Play_ClickMessage ); Editor.ClickMessage += new Widget.ClickDelegate( Editor_ClickMessage ); Exit.ClickMessage += new Widget.ClickDelegate( Exit_ClickMessage ); Menu.AddWidget( Play ); Menu.AddWidget( Editor ); Menu.AddWidget( Exit ); Game.WindowManager.AddWindow( Menu ); } void Exit_ClickMessage( Microsoft.DirectX.Vector2 LocalMousePosition, Window.enum_MouseButton mouseButton ) { Game.Parent.Dispose( ); } void Editor_ClickMessage( Microsoft.DirectX.Vector2 LocalMousePosition, Window.enum_MouseButton mouseButton ) { /*throw new Exception( "The method or operation is not implemented." );*/ } void Play_ClickMessage( Microsoft.DirectX.Vector2 LocalMousePosition, Window.enum_MouseButton mouseButton ) { /*throw new Exception( "The method or operation is not implemented." );*/ } } }