PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/Samples/ExampleToolForm/Program.cs

#
C# | 53 lines | 38 code | 5 blank | 10 comment | 2 complexity | dc5cf67e5a8b4b3a081039dbf97c2425 MD5 | raw file
Possible License(s): Apache-2.0
  1. using System;
  2. using Delta.Engine;
  3. using Delta.Platforms.Windows;
  4. using Delta.Utilities.Datatypes;
  5. using Delta.InputSystem;
  6. using Delta.Rendering.Basics.Fonts;
  7. using Delta.Rendering.Basics.Drawing;
  8. namespace Delta.Tools.ExampleToolForm
  9. {
  10. /// <summary>
  11. /// Program, will start the tool.
  12. /// </summary>
  13. public static class Program
  14. {
  15. #region Main
  16. /// <summary>
  17. /// Initializes the ExampleForm and starts the whole editor!
  18. /// </summary>
  19. [STAThread]
  20. static void Main()
  21. {
  22. using (ExampleForm form = new ExampleForm())
  23. {
  24. // Make sure to use our editor window for the engine.
  25. WindowsApplication.SetEditorForm(form, form.viewportPanel);
  26. // Add something to render
  27. Application.BackgroundColor = Color.CornflowerBlue;
  28. float wheelValue = 0.0f;
  29. // And start the application the normal way (it will show the editor)
  30. Application.Start(delegate
  31. {
  32. // Line from top left up to bottom right in quadratic space
  33. Line.Draw(new Point(0, 0), new Point(1, 1), Color.Red);
  34. Font.Default.Draw("Mouse position=" + Input.Mouse.Position,
  35. ScreenSpace.DrawArea);
  36. float wheelDelta = Input.Mouse.ScrollWheelDelta;
  37. if (wheelDelta != 0)
  38. {
  39. wheelValue += wheelDelta;
  40. } // if
  41. Font.Default.Draw("Mouse wheelValue= '" + wheelValue + "'",
  42. Rectangle.FromCenter(new Point(0.5f, 0.65f), Size.Half));
  43. });
  44. }
  45. }
  46. #endregion
  47. }
  48. }