protected override void Start() { base.Start(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { for (int k = 0; k < 5; k++) { var child = Scene.CreateChild(); child.SetScale(0.05f); var sphere = child.CreateComponent <Box>(); //sphere.Model = ResourceCache.GetModel("Sphere.mdl"); var mat = Material.FromColor(Randoms.NextColor()); sphere.SetMaterial(mat); child.Position = new Vector3(i * 0.12f, j * 0.12f, 1 + k * 0.12f); } } } Time.FrameEnded += Time_FrameEnded; new MonoDebugHud(this) { FpsOnly = true }.Show(Color.Green, 72); hud = Engine.CreateDebugHud(); hud.ToggleAll(); }
public Gui() { var cache = Application.Current.ResourceCache; statusText = Application.Current.UI.Root.CreateText(); statusText.HorizontalAlignment = HorizontalAlignment.Center; statusText.VerticalAlignment = VerticalAlignment.Center; statusText.SetFont(cache.GetFont("Fonts/OpenSans-Bold.ttf"), 24); debugText = Application.Current.UI.Root.CreateText(); debugText.HorizontalAlignment = HorizontalAlignment.Left; debugText.VerticalAlignment = VerticalAlignment.Bottom; debugText.SetFont(cache.GetFont("Fonts/OpenSans-Light.ttf"), 12); debugHud = Application.Current.Engine.CreateDebugHud(); debugHud.DefaultStyle = cache.GetXmlFile("UI/DefaultStyle.xml"); Application.Current.Input.Enabled = true; Application.Current.Input.KeyDown += (e) => { switch (e.Key) { case Key.F2: debugHud.ToggleAll(); break; } }; }
protected override async void Start() { base.Start(); new MonoDebugHud(this) { FpsOnly = true }.Show(Color.Green, 50); debugHud = Engine.CreateDebugHud(); debugHud.ToggleAll(); environmentNode = Scene.CreateChild(); EnableGestureTapped = true; spatMaterial = new Material(); spatMaterial.SetTechnique(0, CoreAssets.Techniques.NoTexture, 1, 1); spatMaterial.SetShaderParameter("MatDiffColor", Color.Cyan); // make sure 'spatialMapping' capabilaty is enabled in the app manifest. var cortanaAllowed = await RegisterCortanaCommands(new Dictionary <string, Action> { { "show results", ShowResults } }); var spatialMappingAllowed = await StartSpatialMapping(new Vector3(50, 50, 50), color : Color.Yellow); }
void HandleKeyDown(KeyDownEventArgs e) { switch (e.Key) { case Key.Esc: Exit(); return; case Key.F1: Console.Toggle(); return; case Key.F2: DebugHud.ToggleAll(); return; case Key.Up: PreviousPanelMode(); return; case Key.Down: SetPanelMode(PanelMode.Node); return; } }
void OnKeyDown(KeyDownEventArgs e) { switch (e.Key) { case Key.Esc: //Exit(); break; case Key.R: RotateRootNode(false); rootNode.Rotation = new Quaternion(0, 0, 0); RotateRootNode(true); break; case Key.H: HandMode = !HandMode; break; case Key.Space: DrawDebugFrame = !DrawDebugFrame; break; case Key.Q: console?.Toggle(); break; case Key.E: debugHud?.ToggleAll(); break; case Key.KP_Plus: if (Input.GetKeyDown(Key.B)) { Brightness += 0.2f; } break; case Key.KP_Minus: if (Input.GetKeyDown(Key.B)) { Brightness -= 0.2f; } break; } }
/*void HandleUpdate(StringHash eventType, IntPtr eventData) * { * VariantMap map = new VariantMap(eventData); * Console.WriteLine(eventType.Value == StringHash.Calculate("Update")); * Console.WriteLine("UPDATE " + map["TimeStep"].Value.Float + "s"); * * Input input = GetSubsystem<Input>(); * if (input.GetKeyPress(Keys.F2)) * { * DebugHud debugHud = GetSubsystem<DebugHud>(); * debugHud.ToggleAll(); * } * * //GC.Collect(); * }*/ public override void Start() { Log.Write(LogLevel.LOG_INFO, "!!!!!!!!!!!!!!!!!!!!! Start()"); Input input = context_.GetSubsystem <Input>(); //input.SetMouseMode(MouseMode.Free); //input.SetMouseVisible(true); Engine engine = context_.GetSubsystem <Engine>(); DebugHud debugHud = engine.CreateDebugHud(); ResourceCache cache = GetSubsystem <ResourceCache>(); XMLFile xmlFile = cache.GetResource <XMLFile>("UI/DefaultStyle.xml"); debugHud.SetDefaultStyle(xmlFile); debugHud.ToggleAll(); //GC.Collect(); // FOR TEST ONLY CreateLogo(); }
void HandleKeyDown(KeyDownEventArgs e) { switch (e.Key) { case Key.Esc: Exit(); return; case Key.F1: console.Toggle(); return; case Key.F2: debugHud.ToggleAll(); return; case Key.F3: MainWindow.thisOne.showToolWindow(); return; } var renderer = Renderer; switch (e.Key) { case Key.X: mobileMushroomMove = !mobileMushroomMove; break; case Key.N1: var quality = renderer.TextureQuality; ++quality; if (quality > 2) { quality = 0; } renderer.TextureQuality = quality; break; case Key.N2: var mquality = renderer.MaterialQuality; ++mquality; if (mquality > 2) { mquality = 0; } renderer.MaterialQuality = mquality; break; case Key.N3: renderer.SpecularLighting = !renderer.SpecularLighting; break; case Key.N4: renderer.DrawShadows = !renderer.DrawShadows; break; case Key.N5: var shadowMapSize = renderer.ShadowMapSize; shadowMapSize *= 2; if (shadowMapSize > 2048) { shadowMapSize = 512; } renderer.ShadowMapSize = shadowMapSize; break; // shadow depth and filtering quality case Key.N6: var q = (int)renderer.ShadowQuality++; if (q > 3) { q = 0; } renderer.ShadowQuality = (ShadowQuality)q; break; // occlusion culling case Key.N7: var o = !(renderer.MaxOccluderTriangles > 0); renderer.MaxOccluderTriangles = o ? 5000 : 0; break; // instancing case Key.N8: renderer.DynamicInstancing = !renderer.DynamicInstancing; break; case Key.N9: Image screenshot = new Image(); Graphics.TakeScreenShot(screenshot); screenshot.SavePNG(FileSystem.ProgramDir + $"Data/Screenshot_{GetType().Name}_{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss", CultureInfo.InvariantCulture)}.png"); break; } }
void HandleKeyDown(KeyDownEventArgs e) { switch (e.Key) { case Key.Esc: Engine.Exit(); return; case Key.F1: console.Toggle(); return; case Key.F2: debugHud.ToggleAll(); return; } if (UI.FocusElement == null) { return; } var renderer = Renderer; switch (e.Key) { case Key.N1: var quality = renderer.TextureQuality; ++quality; if (quality > 2) { quality = 0; } renderer.TextureQuality = quality; break; case Key.N2: var mquality = renderer.MaterialQuality; ++mquality; if (mquality > 2) { mquality = 0; } renderer.MaterialQuality = mquality; break; case Key.N3: renderer.SpecularLighting = !renderer.SpecularLighting; break; case Key.N4: renderer.DrawShadows = !renderer.DrawShadows; break; case Key.N5: var shadowMapSize = renderer.ShadowMapSize; shadowMapSize *= 2; if (shadowMapSize > 2048) { shadowMapSize = 512; } renderer.ShadowMapSize = shadowMapSize; break; // shadow depth and filtering quality case Key.N6: var q = renderer.ShadowQuality; q++; if (q > 3) { q = 0; } renderer.ShadowQuality = q; break; // occlusion culling case Key.N7: var o = !(renderer.MaxOccluderTriangles > 0); renderer.MaxOccluderTriangles = o ? 5000 : 0; break; // instancing case Key.N8: renderer.DynamicInstancing = !renderer.DynamicInstancing; break; } }