SpriteTexture.generated.cs 5.0 KB

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