AnimationWindow.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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(150, 20);
  40. Vector2I b = new Vector2I(230, 20);
  41. Vector2I c = new Vector2I(150, 70);
  42. canvas.DrawTriangleList(new Vector2I[] {a, b, c});
  43. }
  44. GUI.AddElement(canvas);
  45. }
  46. private void OnEditorUpdate()
  47. {
  48. int position = (int)(MathEx.Sin(Time.RealElapsed)*50.0f + 50.0f);
  49. canvas.SetPosition(position, 0);
  50. }
  51. private void OnDestroy()
  52. {
  53. // TODO
  54. }
  55. }
  56. /** @} */
  57. }