protected override void Initialize() { GS.Initialize(this); _fpsCounter = new FpsCounter(this); _memoryMonitor = new MemoryMonitor(this); Components.Add(_fpsCounter); Components.Add(_memoryMonitor); base.Initialize(); GS.Action(() => GS.GearsetComponent.Console.Inspect("Profiler", new ProfilerInpectorSettings(GS.GearsetComponent.Console.Profiler))); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { _screenManager.Load(Content, GraphicsDevice); // TODO: Add your initialization logic here _screenManager.Initialize(GraphicsDevice, _physicsSpace); GraphicsDevice.PresentationParameters.MultiSampleCount = 4; //Initialise Gearset in 'headless' mode with no 'external' UI - (overlays are still available). //We want to monitor managed memory allocations from our app and the UIs generate a fair amount of garbage which would distort the profiling. GS.Initialize(this, createUI: true); GS.Action(() => GS.GearsetComponent.Console.Inspect("Profiler", new ProfilerInpectorSettings(GS.GearsetComponent.Console.Profiler))); base.Initialize(); }
protected override void Initialize() { //Initialise Gearset with the full UI experience. //GS.Initialize(this); //GS.Initialize(this, createUI: true); //Initialise Gearset in 'headless' mode with no 'external' UI - (overlays are still available). //We want to monitor managed memory allocations from our app and the UIs generate a fair amount of garbage which would distort the profiling. GS.Initialize(this, createUI: true); _fpsCounter = new FpsCounter(this); Components.Add(_fpsCounter); IsMouseVisible = true; base.Initialize(); #if USE_GEARSET GearsetSettings.Instance.MemoryMonitorConfig.Visible = true; GearsetSettings.Instance.MemoryMonitorConfig.MemoryGraphConfig.Visible = true; GearsetSettings.Instance.MemoryMonitorConfig.MemoryGraphConfig.Position = new Vector2(100, 50); GearsetSettings.Instance.MemoryMonitorConfig.MemoryGraphConfig.Size = new Vector2(400, 75); #endif GS.Action(() => GS.GearsetComponent.Console.Inspect("Profiler", new ProfilerInpectorSettings(GS.GearsetComponent.Console.Profiler))); GS.Log("I am a log message - tra la la"); //Finder! //You can double click finder result items to add them to the Inspector window! //Comment this to use the default search query for finder (by default it's GameComponent based). GS.Action(ConfigureFinder); //Quick Actions GS.AddQuickAction("QuickAction1", () => { /* Pass in a delegate here to do something */ }); GS.AddQuickAction("QuickAction2", () => { /* Pass in a delegate here to do something */ }); //Command Console //Comes with 3 built in commands (help, cls, echo). //Some examples of things you can do... GS.RegisterCommand("helloworld", "runs a test command", (host, command, args) => { host.EchoWarning("Hello World"); }); GS.RegisterCommand("echotest", "echotest message [warning|error]", (host, command, args) => { if (args.Count < 1) { host.EchoError("You must specify a message"); } else if (args.Count == 1) { host.Echo(args[0]); } else if (args.Count == 2) { if (args[1] == "warning") { host.EchoWarning(args[0]); } else if (args[1] == "error") { host.EchoError(args[0]); } else { host.Echo(args[0]); } } else if (args.Count > 2) { host.Echo("Too many arguments specified"); } }); GS.RegisterCommand("fixedstep", "toggles Game.IsFixedStep", (host, command, args) => { IsFixedTimeStep = !IsFixedTimeStep; host.Echo($"IsFixedStep: {IsFixedTimeStep}"); }); //Let's list all those registered commands now... GS.ExecuteCommand("help"); //Call one of our custom commands... GS.ExecuteCommand("helloworld"); //Set Gerset Matrices if you want to show ovelaid geometry (boxes, spheres, etc). var prj = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1); var halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); _worldMatrix = Matrix.Identity; _viewMatrix = Matrix.Identity; _projectionMatrix = halfPixelOffset * prj; }