-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpriteComponent.h
30 lines (27 loc) · 897 Bytes
/
SpriteComponent.h
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
// ----------------------------------------------------------------
// From Game Programming in C++ by Sanjay Madhav
// Copyright (C) 2017 Sanjay Madhav. All rights reserved.
//
// Released under the BSD License
// See LICENSE in root directory for full details.
// ----------------------------------------------------------------
#pragma once
#include "Component.h"
#include "SDL.h"
class SpriteComponent : public Component
{
public:
// (Lower draw order corresponds with further back)
SpriteComponent(class Actor* owner, int drawOrder = 100);
~SpriteComponent();
virtual void Draw(SDL_Renderer* renderer);
virtual void SetTexture(SDL_Texture* texture);
int GetDrawOrder() const { return mDrawOrder; }
int GetTexHeight() const { return mTexHeight; }
int GetTexWidth() const { return mTexWidth; }
protected:
SDL_Texture* mTexture;
int mDrawOrder;
int mTexWidth;
int mTexHeight;
};