Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Sprite/Sprite.cpp
- Revision:
- 14:1e6f74233e8e
- Parent:
- 9:96969b1c6bde
- Child:
- 15:1cb1eb0136aa
--- a/Sprite/Sprite.cpp Mon May 06 15:07:28 2019 +0000
+++ b/Sprite/Sprite.cpp Wed May 08 14:41:56 2019 +0000
@@ -1,9 +1,20 @@
#include "Sprite.h"
+/**
+* @brief Constructor (no paramateters)
+*/
Sprite::Sprite() {}
-
+/**
+* @brief Deconstructor
+*/
Sprite::~Sprite() {}
-
+/**
+* @brief Initialises the Sprite
+* @param int height @details Sprite Height
+* @param int width @details Sprite Width
+* @param int * bitmap @details Pointer to 2D bitmap array
+* @param Vector2D pos @details Initial Position
+*/
void Sprite::init(int height,int width,int * bitmap,Vector2D pos)
{
_height = height;
@@ -11,28 +22,34 @@
_bitmap = bitmap;
_pos = pos;
}
-
-void Sprite::update()
-{
-
-}
-
+/**
+* @brief Renders the Sprite on the LCD
+* @param N5110 lcd @details LCD object.
+*/
void Sprite::render(N5110 &lcd)
{
lcd.drawSprite(_pos.x,_pos.y,_height,_width, _bitmap);
};
-
+/**
+* @brief Get Sprite Position
+* @returns Sprite Positon.
+*/
Vector2D Sprite::get_pos()
{
return _pos;
};
-
+/**
+* @brief Sets Sprite Position
+* @param Vector2D pos @details Sprite Position.
+*/
void Sprite::set_pos(Vector2D pos)
{
_pos = pos;
};
-
+/**
+* @brief Sets Sprite Bitmap (Note: Must be of Sprite dimensions.)
+* @param int * bitmap @details Pointer to 2D array containing Sprite Bitmap.
void Sprite::setBitmap(int * bitmap)
{
_bitmap = bitmap ;