EditorWindow.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. public class EditorWindow : ScriptObject
  7. {
  8. internal int width { get { return Internal_GetWidth(); } }
  9. internal int height { get { return Internal_GetHeight(); } }
  10. protected EditorGUI GUI;
  11. public static EditorWindow OpenWindow<T>() where T : EditorWindow
  12. {
  13. return Internal_CreateOrGetInstance(typeof(T).Namespace, typeof(T).Name);
  14. }
  15. protected EditorWindow()
  16. {
  17. GUI = new EditorGUI(this);
  18. }
  19. protected virtual void WindowResized(int width, int height)
  20. {
  21. }
  22. [MethodImpl(MethodImplOptions.InternalCall)]
  23. private static extern EditorWindow Internal_CreateOrGetInstance(string ns, string typeName);
  24. [MethodImpl(MethodImplOptions.InternalCall)]
  25. private static extern int Internal_GetWidth();
  26. [MethodImpl(MethodImplOptions.InternalCall)]
  27. private static extern int Internal_GetHeight();
  28. }
  29. }