Rise
The Vieneo Province
Sprite.h
Go to the documentation of this file.
1 #pragma once
2 #include "../Logger.h"
3 #include <d3dx9.h>
4 #include "DeviceObject.h"
5 
7 class Sprite
8 {
9  //ID3DX10Sprite* pSprite = nullptr;
10  LPD3DXSPRITE pSprite = nullptr;
11  //D3DX10_SPRITE dxSprite;
12  LPDIRECT3DTEXTURE9 pTexture = nullptr;
13  Logger* logger = nullptr;
14  int x = 0, y = 0, width = 0, height = 0;
15  float z = 0.0f;
16  //std::string pathAndFilename;
17  D3DXCOLOR color = {};
18  D3DXMATRIX matWorld = {};
19  D3DXVECTOR3 position = D3DXVECTOR3(0, 0, 0);
20  D3DXVECTOR2 centerRotation = D3DXVECTOR2(0, 0);
21  D3DXVECTOR2 scale;
22  RECT rect = {};
23  int top = 0;
24  int left = 0;
25  D3DXVECTOR2 centerOffset = D3DXVECTOR2(0, 0);
26 
27 public:
28  //D3D10_TEXTURE2D_DESC desc; // to store details of the texture
29  //std::string elementName;
30  float rotate = 0.0f;
31  float mag = 1.0f;
32  //bool normallyHidden = false;
33  //D3DXVECTOR2 texCoord = D3DXVECTOR2(0, 0);
34  //D3DXVECTOR2 texSize = D3DXVECTOR2(1, 1);
35 
36  Sprite(Logger* prmLogger, DeviceObject* prmpDevice, std::string prmPathAndFilename, int prmX, int prmY, float prmZ,
37  int prmTop, int prmLeft, int prmWidth, int prmHeight, DWORD prmColor, float scaleX = 1.0f, float scaleY = 1.0f);
38 
39  void Update();
40 
41  void Draw(D3DXCOLOR prmColor);
42  void Draw() const;
43  void SetLocation(int absoluteX, int absoluteY);
44  void SetRectangle(int top, int left, int right, int bottom);
45 
46  // by default this sets it to the middle (width/2 height/2)
47  void SetRotationCenter(D3DXVECTOR2 rotationCenter) { centerOffset = rotationCenter; }
48 };
void SetLocation(int absoluteX, int absoluteY)
Definition: Sprite.cpp:90
void Draw() const
Definition: Sprite.cpp:72
D3DXVECTOR2 centerRotation
Definition: Sprite.h:20
float mag
Definition: Sprite.h:31
Sprite(Logger *prmLogger, DeviceObject *prmpDevice, std::string prmPathAndFilename, int prmX, int prmY, float prmZ, int prmTop, int prmLeft, int prmWidth, int prmHeight, DWORD prmColor, float scaleX=1.0f, float scaleY=1.0f)
Definition: Sprite.cpp:5
D3DXVECTOR3 position
Definition: Sprite.h:19
void SetRectangle(int top, int left, int right, int bottom)
Definition: Sprite.cpp:96
Definition: Logger.h:9
int y
Definition: Sprite.h:14
void Update()
Definition: Sprite.cpp:41
LPDIRECT3DTEXTURE9 pTexture
Definition: Sprite.h:12
float rotate
Definition: Sprite.h:30
D3DXVECTOR2 centerOffset
Definition: Sprite.h:25
int x
Definition: Sprite.h:14
float z
Definition: Sprite.h:15
int height
Definition: Sprite.h:14
Definition: Sprite.h:7
void SetRotationCenter(D3DXVECTOR2 rotationCenter)
Definition: Sprite.h:47
LPD3DXSPRITE pSprite
Definition: Sprite.h:10
D3DXCOLOR color
Definition: Sprite.h:17
int width
Definition: Sprite.h:14
int top
Definition: Sprite.h:23
Logger * logger
Definition: Sprite.h:13
D3DXVECTOR2 scale
Definition: Sprite.h:21
D3DXMATRIX matWorld
Definition: Sprite.h:18
int left
Definition: Sprite.h:24
RECT rect
Definition: Sprite.h:22