GUIRenderTexture.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. public sealed class GUIRenderTexture : GUIElement
  6. {
  7. private RenderTexture2D renderTexture;
  8. public RenderTexture2D RenderTexture
  9. {
  10. get
  11. {
  12. return renderTexture;
  13. }
  14. set
  15. {
  16. IntPtr texturePtr = IntPtr.Zero;
  17. if (value != null)
  18. texturePtr = value.GetCachedPtr();
  19. renderTexture = value;
  20. Internal_SetTexture(mCachedPtr, texturePtr);
  21. }
  22. }
  23. public GUIRenderTexture(RenderTexture2D texture, string style, params GUIOption[] options)
  24. {
  25. IntPtr texturePtr = IntPtr.Zero;
  26. if (texture != null)
  27. texturePtr = texture.GetCachedPtr();
  28. Internal_CreateInstance(this, texturePtr, style, options);
  29. }
  30. public GUIRenderTexture(RenderTexture2D texture, params GUIOption[] options)
  31. {
  32. IntPtr texturePtr = IntPtr.Zero;
  33. if (texture != null)
  34. texturePtr = texture.GetCachedPtr();
  35. Internal_CreateInstance(this, texturePtr, "", options);
  36. }
  37. [MethodImpl(MethodImplOptions.InternalCall)]
  38. private static extern void Internal_CreateInstance(GUIRenderTexture instance, IntPtr texture,
  39. string style, GUIOption[] options);
  40. [MethodImpl(MethodImplOptions.InternalCall)]
  41. private static extern void Internal_SetTexture(IntPtr nativeInstance, IntPtr texture);
  42. }
  43. }