forked from ManalHasan/OOP-Project-Manal-Moiz-Naaseh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject.cpp
More file actions
40 lines (36 loc) · 746 Bytes
/
Object.cpp
File metadata and controls
40 lines (36 loc) · 746 Bytes
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
#include "Object.hpp"
#include "TextureManager.hpp"
//constructor
Object::Object(){
Tex=nullptr;
}
Object::~Object(){
std::cout<<"Object destructed"<<std::endl;
}
//Accesors
SDL_Texture* Object::getTexture() {
return Tex;
}
SDL_Rect& Object::getSrc(){
return src;
}
SDL_Rect& Object::getDest(){
return dest;
}
//mutator
void Object::setSource(int x, int y, int w, int h){
src.x=x;
src.y=y;
src.w=w;
src.h=h;
}
void Object::setDest(int x, int y, int w, int h){
dest.x=x;
dest.y=y;
dest.w=w;
dest.h=h;
}
//creating texture of all bjects
void Object::CreateTexture(const char* address, SDL_Renderer* ren){
Tex=TextureManager::Texture(address, ren);
}