method ovveride
This commit is contained in:
parent
9cd2593f47
commit
7acfc27bb5
BIN
assets/heart.si2
Normal file
BIN
assets/heart.si2
Normal file
Binary file not shown.
@ -14,7 +14,7 @@
|
|||||||
#
|
#
|
||||||
general:
|
general:
|
||||||
maxFPS: 30
|
maxFPS: 30
|
||||||
theme: bad
|
theme: good
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
|
@ -47,6 +47,19 @@ class GoodPixelManager : public PixelManager{
|
|||||||
* @brief sprite of the torpedo
|
* @brief sprite of the torpedo
|
||||||
*/
|
*/
|
||||||
MySprite torpedo;
|
MySprite torpedo;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief sprite of the heart
|
||||||
|
*/
|
||||||
|
MySprite heart;
|
||||||
|
|
||||||
|
void drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor& color) const override;
|
||||||
|
void drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor& color) const override;
|
||||||
|
void drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor& color) const override;
|
||||||
|
void drawPlayer(unsigned x, unsigned width, const RGBAcolor& color) const override;
|
||||||
|
void drawMissile(const Position& baseVector, unsigned width, const RGBAcolor& color) const override;
|
||||||
|
void drawTorpedo(const Position& baseVector, unsigned width, const RGBAcolor& color) const override;
|
||||||
|
void drawHeart(const Position& baseVector) const override;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
* @param[in] color : color multiplicaror of the invader
|
* @param[in] color : color multiplicaror of the invader
|
||||||
* @fn void drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
* @fn void drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
virtual void drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a type B invader on screen
|
* @brief display a type B invader on screen
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
* @param[in] color : color multiplicaror of the invader
|
* @param[in] color : color multiplicaror of the invader
|
||||||
* @fn void drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
* @fn void drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
virtual void drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a type C invader on screen
|
* @brief display a type C invader on screen
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
* @param[in] color : color multiplicaror of the invader
|
* @param[in] color : color multiplicaror of the invader
|
||||||
* @fn void drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
* @fn void drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
virtual void drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor& color) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a player on screen
|
* @brief display a player on screen
|
||||||
@ -123,7 +123,7 @@ public:
|
|||||||
* @param[in] color : color of the plater
|
* @param[in] color : color of the plater
|
||||||
* @fn void drawPlayer(unsigned x, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
* @fn void drawPlayer(unsigned x, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawPlayer(unsigned x, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
virtual void drawPlayer(unsigned x, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a missile on screen
|
* @brief display a missile on screen
|
||||||
@ -132,7 +132,7 @@ public:
|
|||||||
* @param[in] color : color of the missile
|
* @param[in] color : color of the missile
|
||||||
* @fn void drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
* @fn void drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
virtual void drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a torpedo on screen
|
* @brief display a torpedo on screen
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
* @param[in] color : color of the torpedo
|
* @param[in] color : color of the torpedo
|
||||||
* @fn void drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
* @fn void drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
*/
|
*/
|
||||||
void drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
virtual void drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color) const;
|
||||||
|
|
||||||
#define HEART_LENGTH 40
|
#define HEART_LENGTH 40
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
* @param[in] baseVector : pixel coordinates of the heart
|
* @param[in] baseVector : pixel coordinates of the heart
|
||||||
* @fn void drawHeart(const Position& baseVector) const;
|
* @fn void drawHeart(const Position& baseVector) const;
|
||||||
*/
|
*/
|
||||||
void drawHeart(const Position& baseVector) const;
|
virtual void drawHeart(const Position& baseVector) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief display a sprite on screen
|
* @brief display a sprite on screen
|
||||||
|
@ -8,8 +8,37 @@ void GoodPixelManager::loadSprites(vector<Task>& tasks) {
|
|||||||
ADD_SPRITE_TASK(invaderC)
|
ADD_SPRITE_TASK(invaderC)
|
||||||
ADD_SPRITE_TASK(missile)
|
ADD_SPRITE_TASK(missile)
|
||||||
ADD_SPRITE_TASK(torpedo)
|
ADD_SPRITE_TASK(torpedo)
|
||||||
|
ADD_SPRITE_TASK(heart)
|
||||||
}
|
}
|
||||||
|
|
||||||
GoodPixelManager::GoodPixelManager(MinGL& win) : PixelManager(win) {
|
GoodPixelManager::GoodPixelManager(MinGL& win) : PixelManager(win) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawInvaderA(const Position& baseVector, unsigned size, const RGBAcolor &color) const {
|
||||||
|
drawSprite(invaderA, baseVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawInvaderB(const Position& baseVector, unsigned size, const RGBAcolor &color) const {
|
||||||
|
drawSprite(invaderB, baseVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawInvaderC(const Position& baseVector, unsigned size, const RGBAcolor &color) const {
|
||||||
|
drawSprite(invaderC, baseVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawPlayer(unsigned x, unsigned width, const RGBAcolor& color) const {
|
||||||
|
drawSprite(player, Position(x, PLAYER_HEIGHT));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawMissile(const Position& baseVector, unsigned width, const RGBAcolor& color) const {
|
||||||
|
drawSprite(missile, baseVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawTorpedo(const Position& baseVector, unsigned width, const RGBAcolor& color) const {
|
||||||
|
drawSprite(torpedo, baseVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoodPixelManager::drawHeart(const Position& baseVector) const {
|
||||||
|
drawSprite(heart, baseVector);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user