SpriteTexture.generated.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. [NativeWrapper]
  38. public RRef<Texture> Texture
  39. {
  40. get { return Internal_getTexture(mCachedPtr); }
  41. set { Internal_setTexture(mCachedPtr, value); }
  42. }
  43. /// <summary>Returns width of the sprite texture in pixels.</summary>
  44. [ShowInInspector]
  45. [NativeWrapper]
  46. public uint Width
  47. {
  48. get { return Internal_getWidth(mCachedPtr); }
  49. }
  50. /// <summary>Returns height of the sprite texture in pixels.</summary>
  51. [ShowInInspector]
  52. [NativeWrapper]
  53. public uint Height
  54. {
  55. get { return Internal_getHeight(mCachedPtr); }
  56. }
  57. /// <summary>
  58. /// Determines the offset into the referenced texture where the sprite starts. The offset is in UV coordinates, in range
  59. /// [0, 1].
  60. /// </summary>
  61. [ShowInInspector]
  62. [NativeWrapper]
  63. public Vector2 Offset
  64. {
  65. get
  66. {
  67. Vector2 temp;
  68. Internal_getOffset(mCachedPtr, out temp);
  69. return temp;
  70. }
  71. set { Internal_setOffset(mCachedPtr, ref value); }
  72. }
  73. /// <summary>
  74. /// Determines the size of the sprite in the referenced texture. Size is in UV coordinates, range [0, 1].
  75. /// </summary>
  76. [ShowInInspector]
  77. [NativeWrapper]
  78. public Vector2 Scale
  79. {
  80. get
  81. {
  82. Vector2 temp;
  83. Internal_getScale(mCachedPtr, out temp);
  84. return temp;
  85. }
  86. set { Internal_setScale(mCachedPtr, ref value); }
  87. }
  88. /// <summary>
  89. /// Sets properties describing sprite animation. The animation splits the sprite area into a grid of sub-images which can
  90. /// be evaluated over time. In order to view the animation you must also enable playback through setAnimationPlayback().
  91. /// </summary>
  92. [ShowInInspector]
  93. [NativeWrapper]
  94. public SpriteSheetGridAnimation Animation
  95. {
  96. get
  97. {
  98. SpriteSheetGridAnimation temp;
  99. Internal_getAnimation(mCachedPtr, out temp);
  100. return temp;
  101. }
  102. set { Internal_setAnimation(mCachedPtr, ref value); }
  103. }
  104. /// <summary>Determines if and how should the sprite animation play.</summary>
  105. [ShowInInspector]
  106. [NativeWrapper]
  107. public SpriteAnimationPlayback AnimationPlayback
  108. {
  109. get { return Internal_getAnimationPlayback(mCachedPtr); }
  110. set { Internal_setAnimationPlayback(mCachedPtr, value); }
  111. }
  112. /// <summary>Returns a reference wrapper for this resource.</summary>
  113. public static implicit operator RRef<SpriteTexture>(SpriteTexture x)
  114. { return Internal_GetRef(x.mCachedPtr); }
  115. [MethodImpl(MethodImplOptions.InternalCall)]
  116. private static extern RRef<SpriteTexture> Internal_GetRef(IntPtr thisPtr);
  117. [MethodImpl(MethodImplOptions.InternalCall)]
  118. private static extern void Internal_setTexture(IntPtr thisPtr, RRef<Texture> texture);
  119. [MethodImpl(MethodImplOptions.InternalCall)]
  120. private static extern RRef<Texture> Internal_getTexture(IntPtr thisPtr);
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern uint Internal_getWidth(IntPtr thisPtr);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern uint Internal_getHeight(IntPtr thisPtr);
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern void Internal_setOffset(IntPtr thisPtr, ref Vector2 offset);
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern void Internal_getOffset(IntPtr thisPtr, out Vector2 __output);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern void Internal_setScale(IntPtr thisPtr, ref Vector2 scale);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern void Internal_getScale(IntPtr thisPtr, out Vector2 __output);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern void Internal_setAnimation(IntPtr thisPtr, ref SpriteSheetGridAnimation anim);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern void Internal_getAnimation(IntPtr thisPtr, out SpriteSheetGridAnimation __output);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern void Internal_setAnimationPlayback(IntPtr thisPtr, SpriteAnimationPlayback playback);
  139. [MethodImpl(MethodImplOptions.InternalCall)]
  140. private static extern SpriteAnimationPlayback Internal_getAnimationPlayback(IntPtr thisPtr);
  141. [MethodImpl(MethodImplOptions.InternalCall)]
  142. private static extern void Internal_create(SpriteTexture managedInstance, RRef<Texture> texture);
  143. [MethodImpl(MethodImplOptions.InternalCall)]
  144. private static extern void Internal_create0(SpriteTexture managedInstance, ref Vector2 uvOffset, ref Vector2 uvScale, RRef<Texture> texture);
  145. }
  146. /** @} */
  147. }