forked from abartlett139/Omni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIWrappers.h
89 lines (84 loc) · 2.94 KB
/
UIWrappers.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef UIWRAPPERS_H
#define UIWRAPPERS_H
#include "Graphics.h"
template <class T>
void SafeRelease(T*& pT)
{
if( pT )
{
pT->Release();
pT = NULL;
}
}
class Surface
{
protected:
LPDIRECT3DSURFACE9 m_Surface;
Surface* m_BackBuffer;
// LPDIRECT3DDEVICE9 m_pDevice;
RECT* m_SourceRect;
public:
D3DXIMAGE_INFO Info;
Surface();
~Surface();
LPDIRECT3DSURFACE9 GetSurface() const{ return m_Surface; }
void SetSurface(LPDIRECT3DSURFACE9 Surf) { m_Surface = Surf; }
// LPDIRECT3DDEVICE9 GetDevice()const { return m_pDevice; }
// void SetDevice() { m_pDevice = pDevice; }
HRESULT CreateSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool);
HRESULT LoadFromFile(LPSTR Path);
HRESULT MakeBackBuffer(void);
HRESULT UpdateSurface(Surface* Source, RECT* pSourceRect, int x, int y);
HRESULT CopySurface(IDirect3DSurface9* CopyTo, RECT CopyFromRect, int x, int y);
void Render(void);
};
class Texture
{
protected:
LPDIRECT3DTEXTURE9 m_Texture;
D3DXVECTOR2 m_RotationCenter;
D3DXVECTOR2 m_Translation;
D3DXVECTOR2 m_Scaling;
FLOAT m_Rotation;
D3DXIMAGE_INFO m_Info;
RECT m_SrcRect;
public:
Texture();
Texture(LPSTR Path, D3DXVECTOR2 RotationCenter, FLOAT Rotation, D3DXVECTOR2 Translation, D3DXVECTOR2 Scaling);
void InitTexture( D3DXVECTOR2 RotationCenter, FLOAT Rotation, D3DXVECTOR2 Translation, D3DXVECTOR2 Scaling);
~Texture();
LPDIRECT3DTEXTURE9 GetTexture()const { return m_Texture; }
void SetTexture(LPDIRECT3DTEXTURE9 Texture) { m_Texture = Texture; }
// LPDIRECT3DDEVICE9 GetDevice() const { return m_pDevice; }
// void SetDevice() { m_pDevice = pDevice; }
D3DXVECTOR2 GetRotationCenter() const { return m_RotationCenter; }
void SetRotationCenter(D3DXVECTOR2 RotationCenter) { m_RotationCenter = RotationCenter; }
D3DXVECTOR2 GetTranslation() const { return m_Translation; }
void SetTranslation(D3DXVECTOR2 Translation) { m_Translation = Translation; }
D3DXVECTOR2 GetScaling() { return m_Scaling; }
void SetScaling(D3DXVECTOR2 Scaling) { m_Scaling = Scaling; }
FLOAT GetRotation()const { return m_Rotation; }
void SetRotation(FLOAT Rotation) { m_Rotation = Rotation; }
RECT GetRect()const { return m_SrcRect; }
void SetRect(RECT SrcRect) { m_SrcRect = SrcRect; }
HRESULT LoadFromFile(LPSTR Path);
DWORD GetWidth() { return m_Info.Width; }
DWORD GetHeight() { return m_Info.Height; }
D3DXIMAGE_INFO GetImageInfo() { return m_Info; }
};
class Sprite
{
protected:
LPD3DXSPRITE m_Sprite;
// LPDIRECT3DDEVICE9 m_pDevice;
public:
Sprite();
~Sprite();
LPD3DXSPRITE GetSprite() const { return m_Sprite; }
void SetSprite(LPD3DXSPRITE Sprite) { m_Sprite = Sprite; }
// LPDIRECT3DDEVICE9 GetDevice()const { return m_pDevice; }
// void SetDevice() { m_pDevice = pDevice; }
HRESULT DrawTexture(Texture* Tex, D3DXVECTOR2 Pos);
HRESULT DrawBackground(Texture * Tex);
};
#endif // !UIWRAPPERS_H_