SpriteTexture.generated.cs 5.5 KB

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