AnimationWindow.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. /** @addtogroup Windows
  7. * @{
  8. */
  9. /// <summary>
  10. /// Displays animation curve editor window.
  11. /// </summary>
  12. internal class AnimationWindow : EditorWindow
  13. {
  14. private GUICanvas canvas;
  15. /// <summary>
  16. /// Opens the animation window.
  17. /// </summary>
  18. [MenuItem("Windows/Animation", ButtonModifier.CtrlAlt, ButtonCode.A, 6000)]
  19. private static void OpenGameWindow()
  20. {
  21. OpenWindow<AnimationWindow>();
  22. }
  23. /// <inheritdoc/>
  24. protected override LocString GetDisplayName()
  25. {
  26. return new LocEdString("Animation");
  27. }
  28. private void OnInitialize()
  29. {
  30. canvas = new GUICanvas(GUIOption.FixedWidth(200), GUIOption.FixedHeight(200));
  31. {
  32. Vector2I a = new Vector2I(0, 0);
  33. Vector2I b = new Vector2I(200, 0);
  34. Vector2I c = new Vector2I(200, 200);
  35. Vector2I d = new Vector2I(0, 200);
  36. canvas.DrawTriangleStrip(new Vector2I[] { b, c, a, d }, Color.BansheeOrange);
  37. }
  38. {
  39. Vector2I a = new Vector2I(50, 20);
  40. Vector2I b = new Vector2I(100, 20);
  41. Vector2I c = new Vector2I(240, 60);
  42. Vector2I[] vertices = {c, b};
  43. canvas.DrawPolyLine(vertices, 1.0f);
  44. }
  45. GUI.AddElement(canvas);
  46. }
  47. private void OnEditorUpdate()
  48. {
  49. //int position = (int)(MathEx.Sin(Time.RealElapsed)*50.0f + 50.0f);
  50. //canvas.SetPosition(position, 0);
  51. }
  52. private void OnDestroy()
  53. {
  54. // TODO
  55. }
  56. }
  57. /** @} */
  58. }