SpriteTexture.generated.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Rendering
  7. * @{
  8. */
  9. /// <summary>
  10. /// Texture that references a part of a larger texture by specifying an UV subset. When the sprite texture is rendererd
  11. /// only the portion of the texture specified by the UV subset will be rendered. This allows you to use the same texture
  12. /// for multiple sprites (texture atlasing). Sprite textures also allow you to specify sprite sheet animation by varying
  13. /// which portion of the UV is selected over time.
  14. /// </summary>
  15. [ShowInInspector]
  16. public partial class SpriteTexture : Resource
  17. {
  18. private SpriteTexture(bool __dummy0) { }
  19. protected SpriteTexture() { }
  20. /// <summary>Creates a new sprite texture that references the entire area of the provided texture.</summary>
  21. public SpriteTexture(RRef<Texture> texture)
  22. {
  23. Internal_create(this, texture);
  24. }
  25. /// <summary>Creates a new sprite texture that references a sub-area of the provided texture.</summary>
  26. public SpriteTexture(Vector2 uvOffset, Vector2 uvScale, RRef<Texture> texture)
  27. {
  28. Internal_create0(this, ref uvOffset, ref uvScale, texture);
  29. }
  30. /// <summary>Returns a reference wrapper for this resource.</summary>
  31. public RRef<SpriteTexture> Ref
  32. {
  33. get { return Internal_GetRef(mCachedPtr); }
  34. }
  35. /// <summary>Determines the internal texture that the sprite texture references.</summary>
  36. [ShowInInspector]
  37. public RRef<Texture> Texture
  38. {
  39. get { return Internal_getTexture(mCachedPtr); }
  40. set { Internal_setTexture(mCachedPtr, value); }
  41. }
  42. /// <summary>Returns width of the sprite texture in pixels.</summary>
  43. [ShowInInspector]
  44. public uint Width
  45. {
  46. get { return Internal_getWidth(mCachedPtr); }
  47. }
  48. /// <summary>Returns height of the sprite texture in pixels.</summary>
  49. [ShowInInspector]
  50. public uint Height
  51. {
  52. get { return Internal_getHeight(mCachedPtr); }
  53. }
  54. /// <summary>
  55. /// Determines the offset into the referenced texture where the sprite starts. The offset is in UV coordinates, in range
  56. /// [0, 1].
  57. /// </summary>
  58. [ShowInInspector]
  59. public Vector2 Offset
  60. {
  61. get
  62. {
  63. Vector2 temp;
  64. Internal_getOffset(mCachedPtr, out temp);
  65. return temp;
  66. }
  67. set { Internal_setOffset(mCachedPtr, ref value); }
  68. }
  69. /// <summary>
  70. /// Determines the size of the sprite in the referenced texture. Size is in UV coordinates, range [0, 1].
  71. /// </summary>
  72. [ShowInInspector]
  73. public Vector2 Scale
  74. {
  75. get
  76. {
  77. Vector2 temp;
  78. Internal_getScale(mCachedPtr, out temp);
  79. return temp;
  80. }
  81. set { Internal_setScale(mCachedPtr, ref value); }
  82. }
  83. /// <summary>
  84. /// Sets properties describing sprite animation. The animation splits the sprite area into a grid of sub-images which can
  85. /// be evaluated over time. In order to view the animation you must also enable playback through setAnimationPlayback().
  86. /// </summary>
  87. [ShowInInspector]
  88. public SpriteSheetGridAnimation Animation
  89. {
  90. get
  91. {
  92. SpriteSheetGridAnimation temp;
  93. Internal_getAnimation(mCachedPtr, out temp);
  94. return temp;
  95. }
  96. set { Internal_setAnimation(mCachedPtr, ref value); }
  97. }
  98. /// <summary>Determines if and how should the sprite animation play.</summary>
  99. [ShowInInspector]
  100. public SpriteAnimationPlayback AnimationPlayback
  101. {
  102. get { return Internal_getAnimationPlayback(mCachedPtr); }
  103. set { Internal_setAnimationPlayback(mCachedPtr, value); }
  104. }
  105. /// <summary>Returns a reference wrapper for this resource.</summary>
  106. public static implicit operator RRef<SpriteTexture>(SpriteTexture x)
  107. { return Internal_GetRef(x.mCachedPtr); }
  108. [MethodImpl(MethodImplOptions.InternalCall)]
  109. private static extern RRef<SpriteTexture> Internal_GetRef(IntPtr thisPtr);
  110. [MethodImpl(MethodImplOptions.InternalCall)]
  111. private static extern void Internal_setTexture(IntPtr thisPtr, RRef<Texture> texture);
  112. [MethodImpl(MethodImplOptions.InternalCall)]
  113. private static extern RRef<Texture> Internal_getTexture(IntPtr thisPtr);
  114. [MethodImpl(MethodImplOptions.InternalCall)]
  115. private static extern uint Internal_getWidth(IntPtr thisPtr);
  116. [MethodImpl(MethodImplOptions.InternalCall)]
  117. private static extern uint Internal_getHeight(IntPtr thisPtr);
  118. [MethodImpl(MethodImplOptions.InternalCall)]
  119. private static extern void Internal_setOffset(IntPtr thisPtr, ref Vector2 offset);
  120. [MethodImpl(MethodImplOptions.InternalCall)]
  121. private static extern void Internal_getOffset(IntPtr thisPtr, out Vector2 __output);
  122. [MethodImpl(MethodImplOptions.InternalCall)]
  123. private static extern void Internal_setScale(IntPtr thisPtr, ref Vector2 scale);
  124. [MethodImpl(MethodImplOptions.InternalCall)]
  125. private static extern void Internal_getScale(IntPtr thisPtr, out Vector2 __output);
  126. [MethodImpl(MethodImplOptions.InternalCall)]
  127. private static extern void Internal_setAnimation(IntPtr thisPtr, ref SpriteSheetGridAnimation anim);
  128. [MethodImpl(MethodImplOptions.InternalCall)]
  129. private static extern void Internal_getAnimation(IntPtr thisPtr, out SpriteSheetGridAnimation __output);
  130. [MethodImpl(MethodImplOptions.InternalCall)]
  131. private static extern void Internal_setAnimationPlayback(IntPtr thisPtr, SpriteAnimationPlayback playback);
  132. [MethodImpl(MethodImplOptions.InternalCall)]
  133. private static extern SpriteAnimationPlayback Internal_getAnimationPlayback(IntPtr thisPtr);
  134. [MethodImpl(MethodImplOptions.InternalCall)]
  135. private static extern void Internal_create(SpriteTexture managedInstance, RRef<Texture> texture);
  136. [MethodImpl(MethodImplOptions.InternalCall)]
  137. private static extern void Internal_create0(SpriteTexture managedInstance, ref Vector2 uvOffset, ref Vector2 uvScale, RRef<Texture> texture);
  138. }
  139. /** @} */
  140. }