-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathObject.cpp
More file actions
66 lines (51 loc) · 1.12 KB
/
Object.cpp
File metadata and controls
66 lines (51 loc) · 1.12 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Object.h"
#include "TextureLoader.h"
Object::Object(const char* texturename, SDL_Renderer* ren, int x, int y){
renderer = ren;
obj = Texture::LoadTexture(texturename,ren);
pos.set(x,y);
}
Object::~Object() {}
void Object::Update(float h, float w)
{
//return an int by some manner
// xcord = ;
// ycord = ;
srcRect.h = h;
srcRect.w = w;
srcRect.x = 0;
srcRect.y = 0;
destRect.x = pos.getX() - w/2;
destRect.y = pos.getY() - h/2;
destRect.h = h;
destRect.w = w;
}
void Object::UpdateBoard(float h, float w)
{
//return an int by some manner
// xcord = ;
// ycord = ;
srcRect.h = h;
srcRect.w = w;
srcRect.x = 0;
srcRect.y = 0;
destRect.x = pos.getX();
destRect.y = pos.getY();
destRect.h = h;
destRect.w = w;
}
void Object::Render()
{
SDL_RenderCopy(renderer,obj,&srcRect,&destRect);
}
void Object::UpdateMainMenu(float h,float w)
{
srcRect.h = h;
srcRect.w = w;
srcRect.x = 0;
srcRect.y = 0;
destRect.x = 0;
destRect.y = 0;
destRect.h = h;
destRect.w = w;
}