-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSDLGameObject.cpp
More file actions
44 lines (22 loc) · 855 Bytes
/
SDLGameObject.cpp
File metadata and controls
44 lines (22 loc) · 855 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
41
42
#include "SDLGameObject.h"
#include "Game.h"
SDLGameObject::SDLGameObject(const LoaderParams* pParams) :
GameObject(pParams), m_position(pParams->getX(), pParams->getY()), m_velocity(0,0), m_acceleration(0,0)
{
m_width = pParams->getWidth();
m_height = pParams->getHeight();
m_textureID = pParams->getTextureID();
m_currentRow = 1;
m_currentFrame = 1;
}
void SDLGameObject::draw(){
TextureManager::Instance()->drawFrame(m_textureID, (Uint32)m_position.getX(), (Uint32)m_position.getY(), m_width, m_height, m_currentRow, m_currentFrame, TheGame::Instance()->getRenderer());
}
void SDLGameObject::update(){
//adding velocity to initial position
m_position += m_velocity;
//adding acceleration
//m_velocity += m_acceleration;
}
void SDLGameObject::clean(){}
//for collision handling in PlayState