![]() |
Rune Engine
Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
|
A sprite that can be given a texture and animated. More...
#include <sprite.h>
Public Member Functions | |
| Sprite () | |
| Default empty constructor for generating a sprite, uses default shader. | |
| Sprite (std::string const &spriteLocation, unsigned int drawMode=LINEAR_FILTER) | |
| Default constructor for generating a sprite from a PNG file, uses default shader. More... | |
| virtual void | awake () override |
| Virtual awake method being overloaded. | |
| virtual void | start () override |
| Virtual start method being overloaded. | |
| void | setUpBuffers (void) |
| Initialize opengl for the sprite. | |
| virtual void | draw (rune::RenderWindow &) |
| Draw overload so that sprite can be displayed to the screen. More... | |
| void | setTexture (std::string const &texture, unsigned int drawMode=LINEAR_FILTER) |
| Set the texture of the sprite. More... | |
| void | setTexture (Texture *texture) |
| Set the texture based off another already loaded texture. More... | |
| void | setTextureRect (int xPos, int yPos, int width, int height) |
| Set the area of the texture to be rendered. More... | |
| IntRect | getTextureRect (void) |
| Return the rectangle. More... | |
| unsigned int | getDrawMode () |
| Returns the filtering mode of the sprite. More... | |
| void | setMirror (bool mirror) |
| Sets whether or not the sprite should be drawn in reverse. | |
| bool | getMirror (void) |
| Gets whether or not the sprite should be drawn in reverse. More... | |
Public Member Functions inherited from rune::Component | |
| Component ()=default | |
| Default constructor to set up. | |
| virtual void | update () |
| A function for each component that is called every frame. | |
| virtual void | fixedUpdate () |
| A function for each component that is called once every physics update. | |
| void | setParent (GameObject *newParent) |
| A function to set the pointer to the parent rune::GameObject for each component. More... | |
| void | setEnable (bool newEnable) |
| Enable or disable the component. More... | |
| bool | isComponentEnabled (void) |
| Gets whether or not the current component is enabled. | |
| void | onNotify (Signal const &signal) override |
| A virtual method to be overridden by a concrete implementation of the observer class. | |
Public Attributes | |
| Shader | objectShader |
| The Shader that should be used to draw the sprite. | |
| Color | spriteColor |
| The Color of the sprite for drawing purposes. | |
Additional Inherited Members | |
Protected Attributes inherited from rune::Component | |
| GameObject * | parentObject = nullptr |
| The rune::GameObject that this component is attached to. If not attached to a rune::GameObject this will equal nullptr. | |
| bool | isEnabled = true |
| Whether or not the component is currently enabled. If not enabled, update function will not be called. | |
A sprite that can be given a texture and animated.
| rune::Sprite::Sprite | ( | std::string const & | spriteLocation, |
| unsigned int | drawMode = LINEAR_FILTER |
||
| ) |
Default constructor for generating a sprite from a PNG file, uses default shader.
| spriteLocation | A filepath for the sprite png file to be drawn. |
| drawMode | How would you like the sprite to be filtered when drawn. |
|
virtual |
Draw overload so that sprite can be displayed to the screen.
| window | The window that the sprite is being drawn to. |
Implements rune::Drawable.
| unsigned int rune::Sprite::getDrawMode | ( | ) |
Returns the filtering mode of the sprite.
| bool rune::Sprite::getMirror | ( | void | ) |
Gets whether or not the sprite should be drawn in reverse.
| rune::IntRect rune::Sprite::getTextureRect | ( | void | ) |
Return the rectangle.
| void rune::Sprite::setTexture | ( | std::string const & | texture, |
| unsigned int | drawMode = LINEAR_FILTER |
||
| ) |
Set the texture of the sprite.
| texture | The file path to the texture that is to be loaded onto the sprite. |
| drawMode | How would you like the sprite to be filtered when drawn. |
| void rune::Sprite::setTexture | ( | Texture * | texture | ) |
Set the texture based off another already loaded texture.
| texture | The texture that should be given to this sprite for drawing. |
| void rune::Sprite::setTextureRect | ( | int | xPos, |
| int | yPos, | ||
| int | width, | ||
| int | height | ||
| ) |
Set the area of the texture to be rendered.
| xPos | The left most x position of the texture to be used. |
| yPos | The top most y position of the texture to be used. |
| width | The width of the texture. |
| height | The height of the texture. |