forked from ManalHasan/OOP-Project-Manal-Moiz-Naaseh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBirdY.cpp
More file actions
43 lines (37 loc) · 1.14 KB
/
BirdY.cpp
File metadata and controls
43 lines (37 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "BirdB.hpp"
#include "TextureManager.hpp"
//constructor
BirdY::BirdY():Tex1(nullptr),frate(0){}
//destructor
BirdY::~BirdY(){
Tex1=nullptr;
std::cout<<"Yellow bird destructed"<<std::endl;
}
//copy constructor
BirdY::BirdY(const BirdY& other):Tex1(other.Tex1),frate(other.frate){}
//Rendering the two frames of yellow birds
void BirdY::Render(SDL_Renderer* ren){
frate++;
if (frate < 10)
{
SDL_RenderCopyEx(ren, getTexture(), &getSrc(), &getDest(), 0, NULL, SDL_FLIP_NONE);
}
else if (frate >= 10 && frate <= 20)
{
SDL_RenderCopyEx(ren, Tex1, &getSrc(), &getDest(), 0, NULL, SDL_FLIP_NONE);
}
if (frate > 19)
{
frate = 0;
}
}
void BirdY::createTexture1(const char* address, SDL_Renderer* ren){
Tex1=TextureManager::Texture(address, ren);
}
//following functions are defined only to make this class not abstract, because Player(parent) these functions are virtual
void BirdY::createTexture2(const char* address, SDL_Renderer* ren){
std::cout<<"No need"<<std::endl;
}
void BirdY::createTexture3(const char* address, SDL_Renderer* ren){
std::cout<<"No need"<<std::endl;
}