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
|
panel::panel(IDirect3DDevice9* device, int x, int y, char* file)
{
this->device = device;
//textur
D3DXIMAGE_INFO info;
ZeroMemory(&info, sizeof(D3DXIMAGE_INFO));
if(FAILED(D3DXCreateTextureFromFileEx(this->device, file, D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_NONE, 0, D3DCOLOR_ARGB(255, 0, 255, 0), &info, NULL, &texture)))
this->texture = NULL;
int width = info.Width;
int height = info.Height;
//vertizes
this->ver = new vertex2d[4];
ver[0].x = x;
ver[0].y = y;
ver[0].z = 0;
ver[0].rhw = 1.0f;
ver[0].u = 0.0f;
ver[0].v = 0.0f;
ver[1].x = x + width;
ver[1].y = y;
ver[1].z = 0;
ver[1].rhw = 1.0f;
ver[1].u = 1.0f;
ver[1].v = 0.0f;
ver[2].x = x;
ver[2].y = y + height;
ver[2].z = 0;
ver[2].rhw = 1.0f;
ver[2].u = 0.0f;
ver[2].v = 1.0f;
ver[3].x = x + width;
ver[3].y = y + height;
ver[3].z = 0;
ver[3].rhw = 1.0f;
ver[3].u = 1.0f;
ver[3].v = 1.0f;
}
|