Files
KaijuSaveEarth/src/assetmgr/GameObject.cpp
2021-01-29 21:14:20 -05:00

42 lines
605 B
C++

/*
* GameObject.cpp
*
* Created on: Feb 11, 2020
* Author: ayoungblood
*/
#include "GameObject.h"
#include "TextureManager.h"
GameObject::GameObject(const char* texturesheet, int x, int y)
{
objTexture = TextureManager::LoadTexture(texturesheet);
xpos = x;
ypos = y;
}
void GameObject::Update()
{
xpos++;
// ypos = 0;
srcRect.h = 40;
srcRect.w = 30;
srcRect.x = 0;
srcRect.y = 0;
destRect.x = xpos;
destRect.y = ypos;
destRect.w = srcRect.w * 2;
destRect.h = srcRect.h * 2;
}
void GameObject::Render()
{
SDL_RenderCopy(Game::renderer, objTexture, &srcRect, &destRect);
}