-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCGos.cpp
executable file
·65 lines (54 loc) · 1.37 KB
/
CGos.cpp
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
#include "CGos.h"
CGos::CGos(){
_pos.x = 0;
_pos.y = 0;
_selected = D3DCOLOR_XRGB(255, 255, 255);
_img = NULL;
_type = 0x00;
}
CGos::CGos(POINT pos) {
setPos(pos);
_type = 0x00;
}
void CGos::render(POINT offset){
CustomVertex* retour = new CustomVertex[4];
//défition de la position
retour[0].x=_pos.x+offset.x;
retour[0].y=_pos.y+TILEHEIGHT+offset.y;;
retour[1].x = _pos.x+offset.x;
retour[1].y = _pos.y+offset.y;;
retour[2].x =_pos.x+TILEWIDTH+offset.x;
retour[2].y =_pos.y+TILEHEIGHT+offset.y;
retour[3].x = _pos.x+TILEWIDTH+offset.x;
retour[3].y = _pos.y+offset.y;
//défition du RHW et du Z et du diffuse color
for(int i=0; i<4; i++) {
retour[i].rhw = 1.0f;
retour[i].z = 1.0f;
retour[i].diffuse = _selected;
}
// remplissage des coordonnées de textures
retour[0].u = 0.0;
retour[0].v = 1.0;
retour[1].u = 0.0;
retour[1].v = 0.0;
retour[2].u = 1.0;
retour[2].v = 1.0;
retour[3].u = 1.0;
retour[3].v = 0.0;
// début du rendu
_dd3dInter->SetTexture(0, _img);
_dd3dInter->BeginScene();
_dd3dInter->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP , 2 ,retour , sizeof ( CustomVertex ) );
_dd3dInter->EndScene();
_selected= D3DCOLOR_XRGB(255, 255, 255);
delete[] retour;
}
void CGos::setColor(D3DCOLOR color) {
_selected = color;
}
vertexCoord CGos::getPoint() {
return _pos;
}
CGos::~CGos(){
}