FormSceneGraph2D.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using CommonFroms.SceneGraph2D;
  2. using CommonFroms.SceneGraph2D.Edit;
  3. using CommonLang.Geometry;
  4. using CommonLang.Geometry.SceneGraph2D;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. namespace CommonTest
  14. {
  15. public partial class FormSceneGraph2D : Form
  16. {
  17. public FormSceneGraph2D()
  18. {
  19. InitializeComponent();
  20. stage.OnCanvasUpdate += Stage_OnCanvasUpdate;
  21. stage.OnCanvasDraw += Stage_OnCanvasDraw;
  22. }
  23. protected override void OnLoad(EventArgs e)
  24. {
  25. base.OnLoad(e);
  26. var body = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\body.png");
  27. var head = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\head.png");
  28. var handL = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\handL.png");
  29. var handR = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\handR.png");
  30. var root = stage.RootNode;
  31. {
  32. root.AddChild(body);
  33. head.Translation = new Vector2(0, -100);
  34. head.Scale = new Vector2(0.8f, 0.7f);
  35. head.Rotation = 30;
  36. body.AddChild(head);
  37. handL.Translation = new Vector2(-120, 0);
  38. handL.Scale = new Vector2(1.2f, 1.4f);
  39. head.Rotation = 20;
  40. body.AddChild(handL);
  41. handR.Translation = new Vector2(120, 0);
  42. handL.Scale = new Vector2(1.3f, 1.1f);
  43. head.Rotation = -20;
  44. body.AddChild(handR);
  45. //body.Scale = new Vector2(1.6f, 2.3f);
  46. //handL.Scale = new Vector2(1f, -1f / 0.001f);
  47. //body.Rotation = 45;
  48. // var mpos = stage.PointToClient(MousePosition);
  49. // var rpos = head.RootToLocal(new Vector2(mpos.X, mpos.Y));
  50. // handL.Translation = rpos;
  51. }
  52. }
  53. private void Stage_OnCanvasUpdate(int intervalMS)
  54. {
  55. }
  56. private void Stage_OnCanvasDraw(Graphics g)
  57. {
  58. }
  59. }
  60. }