-
Notifications
You must be signed in to change notification settings - Fork 0
/
shapes.c
48 lines (48 loc) · 1.64 KB
/
shapes.c
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
#include <math.h>
#include <time.h>
#include <windows.h>
int pos[8];
RECT rect;
void generateChord(HDC hdc, HWND hwnd){
SetROP2(hdc, R2_NOTXORPEN);
RECT rect;
GetWindowRect(hwnd, &rect);
HBRUSH hbrOld = SelectObject(hdc, GetStockObject(HOLLOW_BRUSH));
srand(time(NULL));
pos[2]=(int)(rand()%rect.right);
pos[3]=(int)(rand()%rect.bottom);
pos[0]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[1]=(int)(rand()%(pos[3]-(pos[3]/50)));
pos[4]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[5]=(int)(rand()%(pos[3]-(pos[3]/50)));
pos[6]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[7]=(int)(rand()%(pos[3]-(pos[3]/50)));
Chord(hdc,pos[0],pos[1],pos[2],pos[3],pos[4],pos[5],pos[6],pos[7]);
}
void generateEllipse(HDC hdc, HWND hwnd){
SetROP2(hdc, R2_NOTXORPEN);
GetWindowRect(hwnd, &rect);
HBRUSH hbrOld = SelectObject(hdc, GetStockObject(HOLLOW_BRUSH));
srand(time(NULL));
pos[2]=(int)(rand()%rect.right);
pos[3]=(int)(rand()%rect.bottom);
pos[0]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[1]=(int)(rand()%(pos[3]-(pos[3]/50)));
Ellipse(hdc,pos[0],pos[1],pos[2],pos[3]);
}
void generateArc(HDC hdc, HWND hwnd){
SetROP2(hdc, R2_NOTXORPEN);
RECT rect;
GetWindowRect(hwnd, &rect);
HBRUSH hbrOld = SelectObject(hdc, GetStockObject(HOLLOW_BRUSH));
srand(time(NULL));
pos[2]=(int)(rand()%rect.right);
pos[3]=(int)(rand()%rect.bottom);
pos[0]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[1]=(int)(rand()%(pos[3]-(pos[3]/50)));
pos[4]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[5]=(int)(rand()%(pos[3]-(pos[3]/50)));
pos[6]=(int)(rand()%(pos[2]-(pos[2]/50)));
pos[7]=(int)(rand()%(pos[3]-(pos[3]/50)));
Arc(hdc,pos[0],pos[1],pos[2],pos[3],pos[4],pos[5],pos[6],pos[7]);
}