123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the Sprite.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_Sprite:
- Sprite
- ======
- **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
- **Category:** Core
- Brief Description
- -----------------
- General purpose Sprite node.
- Member Functions
- ----------------
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_frame<class_Sprite_get_frame>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_hframes<class_Sprite_get_hframes>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`Texture<class_texture>` | :ref:`get_normal_map<class_Sprite_get_normal_map>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_Sprite_get_offset>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`Rect2<class_rect2>` | :ref:`get_region_rect<class_Sprite_get_region_rect>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`Texture<class_texture>` | :ref:`get_texture<class_Sprite_get_texture>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_vframes<class_Sprite_get_vframes>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_centered<class_Sprite_is_centered>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_flipped_h<class_Sprite_is_flipped_h>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_flipped_v<class_Sprite_is_flipped_v>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_region<class_Sprite_is_region>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_region_filter_clip_enabled<class_Sprite_is_region_filter_clip_enabled>` **(** **)** const |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_centered<class_Sprite_set_centered>` **(** :ref:`bool<class_bool>` centered **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_flip_h<class_Sprite_set_flip_h>` **(** :ref:`bool<class_bool>` flip_h **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_flip_v<class_Sprite_set_flip_v>` **(** :ref:`bool<class_bool>` flip_v **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_frame<class_Sprite_set_frame>` **(** :ref:`int<class_int>` frame **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_hframes<class_Sprite_set_hframes>` **(** :ref:`int<class_int>` hframes **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_normal_map<class_Sprite_set_normal_map>` **(** :ref:`Texture<class_texture>` normal_map **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_offset<class_Sprite_set_offset>` **(** :ref:`Vector2<class_vector2>` offset **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_region<class_Sprite_set_region>` **(** :ref:`bool<class_bool>` enabled **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_region_filter_clip<class_Sprite_set_region_filter_clip>` **(** :ref:`bool<class_bool>` enabled **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_region_rect<class_Sprite_set_region_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_texture<class_Sprite_set_texture>` **(** :ref:`Texture<class_texture>` texture **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_vframes<class_Sprite_set_vframes>` **(** :ref:`int<class_int>` vframes **)** |
- +--------------------------------+------------------------------------------------------------------------------------------------------------------+
- Signals
- -------
- - **frame_changed** **(** **)**
- Emitted when the member frame changes.
- - **texture_changed** **(** **)**
- Emitted when the member texture changes.
- Member Variables
- ----------------
- - :ref:`bool<class_bool>` **centered** - If ``true`` texture is centered. Default value: ``true``.
- - :ref:`bool<class_bool>` **flip_h** - If ``true`` texture is flipped horizontally. Default value: ``false``.
- - :ref:`bool<class_bool>` **flip_v** - If ``true`` texture is flipped vertically. Default value: ``false``.
- - :ref:`int<class_int>` **frame** - Current frame to display from sprite sheet. member vframes or member hframes must be greater than 1.
- - :ref:`int<class_int>` **hframes** - The number of collumns in the sprite sheet.
- - :ref:`Texture<class_texture>` **normal_map** - The normal map gives depth to the Sprite.
- - :ref:`Vector2<class_vector2>` **offset** - The texture's drawing offset.
- - :ref:`bool<class_bool>` **region_enabled** - If ``true`` texture is cut from a larger atlas texture. See ``region_rect``. Default value: ``false``.
- - :ref:`bool<class_bool>` **region_filter_clip** - If ``true`` the outermost pixels get blurred out.
- - :ref:`Rect2<class_rect2>` **region_rect** - The region of the atlas texture to display. member region_enabled must be ``true``.
- - :ref:`Texture<class_texture>` **texture** - :ref:`Texture<class_texture>` object to draw.
- - :ref:`int<class_int>` **vframes** - The number of rows in the sprite sheet.
- Description
- -----------
- A node that displays a 2D texture. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.
- Member Function Description
- ---------------------------
- .. _class_Sprite_get_frame:
- - :ref:`int<class_int>` **get_frame** **(** **)** const
- Return the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
- .. _class_Sprite_get_hframes:
- - :ref:`int<class_int>` **get_hframes** **(** **)** const
- Return the amount of horizontal frames. See :ref:`set_hframes<class_Sprite_set_hframes>`.
- .. _class_Sprite_get_normal_map:
- - :ref:`Texture<class_texture>` **get_normal_map** **(** **)** const
- .. _class_Sprite_get_offset:
- - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
- Return sprite draw offset.
- .. _class_Sprite_get_region_rect:
- - :ref:`Rect2<class_rect2>` **get_region_rect** **(** **)** const
- Return the region rect to read from.
- .. _class_Sprite_get_texture:
- - :ref:`Texture<class_texture>` **get_texture** **(** **)** const
- Return the base texture for the sprite.
- .. _class_Sprite_get_vframes:
- - :ref:`int<class_int>` **get_vframes** **(** **)** const
- Return the amount of vertical frames. See :ref:`set_vframes<class_Sprite_set_vframes>`.
- .. _class_Sprite_is_centered:
- - :ref:`bool<class_bool>` **is_centered** **(** **)** const
- Return if the sprite is centered at the local origin.
- .. _class_Sprite_is_flipped_h:
- - :ref:`bool<class_bool>` **is_flipped_h** **(** **)** const
- Return true if the sprite is flipped horizontally.
- .. _class_Sprite_is_flipped_v:
- - :ref:`bool<class_bool>` **is_flipped_v** **(** **)** const
- Return true if the sprite is flipped vertically.
- .. _class_Sprite_is_region:
- - :ref:`bool<class_bool>` **is_region** **(** **)** const
- Return if the sprite reads from a region.
- .. _class_Sprite_is_region_filter_clip_enabled:
- - :ref:`bool<class_bool>` **is_region_filter_clip_enabled** **(** **)** const
- .. _class_Sprite_set_centered:
- - void **set_centered** **(** :ref:`bool<class_bool>` centered **)**
- Set whether the sprite should be centered on the origin.
- .. _class_Sprite_set_flip_h:
- - void **set_flip_h** **(** :ref:`bool<class_bool>` flip_h **)**
- Set true to flip the sprite horizontally.
- .. _class_Sprite_set_flip_v:
- - void **set_flip_v** **(** :ref:`bool<class_bool>` flip_v **)**
- Set true to flip the sprite vertically.
- .. _class_Sprite_set_frame:
- - void **set_frame** **(** :ref:`int<class_int>` frame **)**
- Set the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
- .. _class_Sprite_set_hframes:
- - void **set_hframes** **(** :ref:`int<class_int>` hframes **)**
- Set the amount of horizontal frames and converts the sprite into a sprite-sheet. This is useful for animation.
- .. _class_Sprite_set_normal_map:
- - void **set_normal_map** **(** :ref:`Texture<class_texture>` normal_map **)**
- .. _class_Sprite_set_offset:
- - void **set_offset** **(** :ref:`Vector2<class_vector2>` offset **)**
- Set the sprite draw offset, useful for setting rotation pivots.
- .. _class_Sprite_set_region:
- - void **set_region** **(** :ref:`bool<class_bool>` enabled **)**
- Set the sprite as a sub-region of a bigger texture. Useful for texture-atlases.
- .. _class_Sprite_set_region_filter_clip:
- - void **set_region_filter_clip** **(** :ref:`bool<class_bool>` enabled **)**
- .. _class_Sprite_set_region_rect:
- - void **set_region_rect** **(** :ref:`Rect2<class_rect2>` rect **)**
- Set the region rect to read from.
- .. _class_Sprite_set_texture:
- - void **set_texture** **(** :ref:`Texture<class_texture>` texture **)**
- Set the base texture for the sprite.
- .. _class_Sprite_set_vframes:
- - void **set_vframes** **(** :ref:`int<class_int>` vframes **)**
- Set the amount of vertical frames and converts the sprite into a sprite-sheet. This is useful for animation.
|