-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.cpp
More file actions
61 lines (52 loc) · 830 Bytes
/
Copy pathutility.cpp
File metadata and controls
61 lines (52 loc) · 830 Bytes
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
#include "includes.h"
#define LEN 8192
bool blocked[15]={false};
void printv(va_list args, const char * format)
{
char buf[LEN];
char * ch=buf;
vsnprintf(buf,LEN,format,args);
while(*ch)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,*ch++);
}
void print(const char * format, ...)
{
va_list args;
va_start(args,format);
printv(args,format);
va_end(args);
}
void printAt(int x,int y, const char * format, ...)
{
va_list args;
glWindowPos2i(x,y);
va_start(args,format);
printv(args,format);
va_end(args);
}
float random_x()
{
int i=1;
while(i<16)
{
i<<=1;
i+=(rand()%2);
}
float a=-3.5,d=0.5;
return a + ( ( (float)i - 16)*d);
}
void block(int i)
{
blocked[i]=1;
}
bool isBlocked(int i)
{
if(blocked[i])
return true;
return false;
}
void unblock()
{
for(int i=0;i<15;i++)
blocked[i]=false;
}