-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrow.cpp
80 lines (76 loc) · 1.67 KB
/
Arrow.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "menuElements.h"
#include "Image.h"
#include "systeminterface.h"
#include "game.h"
void Arrow2D::DrawUp(float x0,float y0,float x1,float y1,bool white,bool hole)
{
glDisable(GL_TEXTURE_2D);
if(white) glColor4f(1,1,1,1); else glColor4f(0,0,0,1);
if(hole)
{
glLineWidth(3);
glBegin(GL_LINE_LOOP);
}
else
glBegin(GL_TRIANGLE_STRIP);
float nx=(x1+x0)*0.5f;
glVertex2f(nx,y0);
glVertex2f(x0,y1);
glVertex2f(x1,y1);
glEnd();
if(hole) glLineWidth(1);
}
void Arrow2D::DrawDown(float x0,float y0,float x1,float y1,bool white,bool hole)
{
glDisable(GL_TEXTURE_2D);
if(white) glColor4f(1,1,1,1); else glColor4f(0,0,0,1);
if(hole)
{
glLineWidth(3);
glBegin(GL_LINE_LOOP);
}
else
glBegin(GL_TRIANGLE_STRIP);
float nx=(x1+x0)*0.5f;
glVertex2f(x0,y0);
glVertex2f(x1,y0);
glVertex2f(nx,y1);
glEnd();
if(hole) glLineWidth(1);
}
void Arrow2D::DrawRight(float x0,float y0,float x1,float y1,bool white,bool hole)
{
glDisable(GL_TEXTURE_2D);
if(white) glColor4f(1,1,1,1); else glColor4f(0,0,0,1);
if(hole)
{
glLineWidth(3);
glBegin(GL_LINE_LOOP);
}
else
glBegin(GL_TRIANGLE_STRIP);
float ny=(y1+y0)*0.5f;
glVertex2f(x0,y0);
glVertex2f(x0,y1);
glVertex2f(x1,ny);
glEnd();
if(hole) glLineWidth(1);
}
void Arrow2D::DrawLeft(float x0,float y0,float x1,float y1,bool white,bool hole)
{
glDisable(GL_TEXTURE_2D);
if(white) glColor4f(1,1,1,1); else glColor4f(0,0,0,1);
if(hole)
{
glLineWidth(3);
glBegin(GL_LINE_LOOP);
}
else
glBegin(GL_TRIANGLE_STRIP);
float ny=(y1+y0)*0.5f;
glVertex2f(x0,ny);
glVertex2f(x1,y0);
glVertex2f(x1,y1);
glEnd();
if(hole) glLineWidth(1);
}