/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.ToggleVSync(); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.VSyncInterval = (Parameters.VSyncInterval == 0) ? 1 : 0; } if (e.Key == Keys.F5) { Game.Instance.Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
void InputDevice_KeyDown(object sender, InputDevice.KeyEventArgs e) { Log.Message("...key down event : {0}", e.Key); if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.ToggleVSync(); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
static void Main(string[] args) { using (var game = new AnimationDemo()) { if (DevCon.Prepare(game, @"..\..\..\Content\Content.xml", "Content")) { game.Run(args); } } }
static void Main(string[] args) { Trace.Listeners.Add(new ColoredTraceListener()); using (var game = new PhysicsDemo()) { if (DevCon.Prepare(game, @"..\..\..\Content\Content.xml", "Content")) { game.Run(args); } } }
public void Clear(RendererBufferType buffer) { if ((buffer & RendererBufferType.Color) != 0) { DevCon.ClearRenderTargetView(BackBuffer, DX.Color.CornflowerBlue); } if ((buffer & RendererBufferType.Depth) != 0) { DevCon.ClearDepthStencilView(DepthStencilView, D3D11.DepthStencilClearFlags.Depth | D3D11.DepthStencilClearFlags.Stencil, 1.0f, 0); } }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } }
static void Main(string[] args) { Trace.Listeners.Add(new ColoredTraceListener()); using (var game = new SubmarinesWars()) { //Console.WriteLine(args.Length); if (args.Length != 0) { game.Run(args); } else if (DevCon.Prepare(game, @"..\..\..\Content\Content.xml", "Content")) { game.Run(args); } } }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> protected override void Update(GameTime gameTime) { var ds = GetService <DebugStrings>(); ds.Add(Color.Orange, "FPS = {0}", gameTime.Fps); ds.Add("========================================================"); ds.Add("F1 - open editor"); ds.Add("F5 - reload textures"); ds.Add("F6 - purge ubershader cache"); ds.Add("ESC - exit"); ds.Add("========================================================"); ds.Add("Total images : {0}", images.Length); if (InputDevice.IsKeyDown(Keys.F1)) { DevCon.Show(this); } // exit on ESC : if (InputDevice.IsKeyDown(Keys.Escape)) { Exit(); } if (InputDevice.IsKeyDown(Fusion.Input.Keys.Right)) { offset += InputDevice.IsKeyDown(Keys.LeftShift) ? 10 : 1; } if (InputDevice.IsKeyDown(Fusion.Input.Keys.Left)) { offset -= InputDevice.IsKeyDown(Keys.LeftShift) ? 10 : 1; } if (InputDevice.IsKeyDown(Keys.Space)) { GetService <TexturePump>().RemoveAllFailedTextures(); } base.Update(gameTime); }
/// <summary> /// Update stuff here /// </summary> /// <param name="gameTime"></param> protected override void Update(GameTime gameTime) { var ds = GetService <DebugStrings>(); ds.Add(Color.Orange, "FPS {0}", gameTime.Fps); ds.Add("F1 - show developer console"); ds.Add("F2 - toggle vsync"); ds.Add("F5 - build content and reload textures"); ds.Add("F12 - make screenshot"); ds.Add("ESC - exit"); ds.Add(""); if (InputDevice.IsKeyDown(Keys.F1)) { DevCon.Show(this); } if (InputDevice.IsKeyDown(Keys.F5)) { Reload(); } if (InputDevice.IsKeyDown(Keys.PageUp)) { numSprites += 100; } if (InputDevice.IsKeyDown(Keys.PageDown)) { numSprites -= 100; } numSprites = Math.Max(numSprites, 0); angle += gameTime.ElapsedSec * MathUtil.DegreesToRadians(15.0f); offset += gameTime.ElapsedSec * 0.75f; base.Update(gameTime); ds.Add("PgUp - increase number of sprites"); ds.Add("PgDn - decrease number of sprites"); }
public bool Prepare() { return(DevCon.Prepare(Visualisator, String.Format(@"..\Content\{0}\Content.xml", VisualisatorName.Namespace), "Content")); }
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.P) // pause/unpause { var gs = GetService <GraphSystem>(); if (gs.Paused) { gs.Unpause(); } else { gs.Pause(); } } if (e.Key == Keys.F) // focus on a node { var cam = GetService <GreatCircleCamera>(); var pSys = GetService <GraphSystem>(); if (nodeSelected) { pSys.Focus(selectedNodeIndex, cam); } } if (e.Key == Keys.LeftButton) { var pSys = GetService <GraphSystem>(); Point cursor = InputDevice.MousePosition; int selNode = 0; if (nodeSelected = pSys.ClickNode(cursor, StereoEye.Mono, 0.025f, out selNode)) { selectedNodeIndex = selNode; var protein = protGraph.GetProtein(selectedNodeIndex); var inEdges = protGraph.GetIncomingInteractions(protein.Name); var outEdges = protGraph.GetOutcomingInteractions(protein.Name); string protName = ((NodeWithText)protGraph.Nodes[selNode]).Text; Console.WriteLine("id = " + selNode + " name: " + protein.Name + ": "); Console.WriteLine("incoming:"); foreach (var ie in inEdges) { Console.WriteLine(ie.Item1.GetInfo()); } Console.WriteLine("outcoming:"); foreach (var oe in outEdges) { Console.WriteLine(oe.Item1.GetInfo()); } Console.WriteLine(); } } if (e.Key == Keys.R) { ResetGraph(); } //if (e.Key == Keys.Q) //{ // Graph graph = GetService<GraphSystem>().GetGraph(); // graph.WriteToFile("../../../../graph.gr"); // Log.Message("Graph saved to file"); //} if (e.Key == Keys.D1) { action1(); } if (e.Key == Keys.D2) { action2(); } if (e.Key == Keys.D3) { action3(); } if (e.Key == Keys.D4) { action4(); } if (e.Key == Keys.D5) { action5(); } if (e.Key == Keys.D6) { action6(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.ToggleVSync(); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.P) { if (soundInstance == null) { Log.Message("Play sound"); soundInstance = soundEffect.CreateInstance(); soundInstance.Apply3D(listener, emitter); soundInstance.IsLooped = true; soundInstance.Play(); } else { soundInstance.Play(); } } if (e.Key == Keys.I && soundInstance != null) { soundInstance.Stop(false); } if (e.Key == Keys.O && soundInstance != null) { var state = soundInstance.State; if (state == SoundState.Paused) { soundInstance.Resume(); } if (state == SoundState.Playing) { soundInstance.Pause(); } } if (e.Key == Keys.U && soundInstance != null) { soundInstance.Stop(true); } if (e.Key == Keys.B) { soundEffectBite.Play(); } }
/// <summary> /// Handle keys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.K) { if (simulationSpeed < 100) { simulationSpeed = simulationSpeed + 5; } iterationTimer = 0; } if (e.Key == Keys.L) { if (simulationSpeed > 10) { simulationSpeed = simulationSpeed - 5; } iterationTimer = 0; } // if (e.Key == Keys.I) if (e.Key == Keys.LeftButton) { GetService <ParticleSystem>().AddMaxParticles(); iterationTimer = simulationSpeed - 10; startSimulation = true; } if (e.Key == Keys.Q) { iterationTimer = 0; } if (e.Key == Keys.B) { iterationTimer = 0; } }
/// <summary> /// Handle keys for each demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void InputDevice_KeyDown(object sender, Fusion.Input.InputDevice.KeyEventArgs e) { if (e.Key == Keys.F1) { DevCon.Show(this); } if (e.Key == Keys.F2) { Parameters.ToggleVSync(); } if (e.Key == Keys.F5) { Reload(); } if (e.Key == Keys.F12) { GraphicsDevice.Screenshot(); } if (e.Key == Keys.Escape) { Exit(); } if (e.Key == Keys.T) { foreach (var box in space.Entities) { box.AngularMomentum *= 10.1f; } } // pause physics if (e.Key == Keys.P) { if (flag) { flag = false; } else { flag = true; } } // shoot box from camera if (e.Key == Keys.LeftButton) { Vector3Fusion vector = GetService <Camera>().FreeCamPosition; Box box = new Box(new Vector3BEPU(vector.X, vector.Y, vector.Z), 1, 1, 1, 1); Vector3Fusion velocity = 10 * GetService <Camera>().GetCameraMatrix(StereoEye.Mono).Forward; box.LinearVelocity = new Vector3BEPU(velocity.X, velocity.Y, velocity.Z); box.Tag = RandomExt.NextColor(random); space.Add(box); } // add new box somewhere if (e.Key == Keys.O) { Vector3Fusion vector = RandomExt.NextVector3(random, new Vector3Fusion(-10, 20, -10), new Vector3Fusion(10, 30, 10)); Box box = new Box(new Vector3BEPU(vector.X, vector.Y, vector.Z), 1, 1, 1, 1); box.Tag = RandomExt.NextColor(random); space.Add(box); } }