示例#1
0
        public DebugWindow()
        {

            if (instance != null)
                Log.Fatal("Debug Window already created");

            instance = this;

            InitializeComponent();
        }
示例#2
0
		protected override bool OnKeyDown( KeyEvent e )
		{
			//Engine console
			if( EngineConsole.Instance != null )
				if( EngineConsole.Instance.DoKeyDown( e ) )
					return true;

			//Profiling Tool
			if( ( PlatformInfo.Platform == PlatformInfo.Platforms.Windows && e.Key == EKeys.F11 ) ||
				( PlatformInfo.Platform == PlatformInfo.Platforms.MacOSX && e.Key == EKeys.F5 ) )
			{
				bool show = ProfilingToolWindow.Instance == null;
				ShowProfilingTool( show );
				return true;
			}
			if( e.Key == EKeys.Escape )
			{
				if( ProfilingToolWindow.Instance != null && !ProfilingToolWindow.Instance.Background & !MouseRelativeMode )
				{
					ProfilingToolWindow.Instance.SetShouldDetach();
					return true;
				}
			}

			//UI controls
			if( controlManager != null && !IsScreenFadingOut() )
				if( controlManager.DoKeyDown( e ) )
					return true;

			//make screenshot
			if( ( PlatformInfo.Platform == PlatformInfo.Platforms.Windows && e.Key == EKeys.F12 ) ||
				( PlatformInfo.Platform == PlatformInfo.Platforms.MacOSX && e.Key == EKeys.F6 ) )
			{
				MakeScreenshot();
				return true;
			}
			#region Community dev tools
			//Live Debug Window
			if( e.Key == EKeys.PageUp && !EngineApp.Instance.FullScreen )
			{
				//the order of if's is important
				
				if( window == null )//create
				{
					window = new DebugWindow();
					window.Show();
					window.SaveEntityType();
					EngineApp.Instance.MouseRelativeMode = window.Visible;
				}
				else if( window != null && window.Visible )
				{
					window.Visible = false;
					window.Hide();
					EngineApp.Instance.MouseRelativeMode = window.Visible;
				}
				else //if( window != null && !window.Visible )
				{
					window.Visible = true;
					window.Activate();
					EngineApp.Instance.MouseRelativeMode = window.Visible;
				}
			}
			#endregion
			return base.OnKeyDown( e );
		}