first commit
This commit is contained in:
41
src/assetmgr/GameObject.cpp
Normal file
41
src/assetmgr/GameObject.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user