-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircles.c
72 lines (62 loc) · 1.24 KB
/
circles.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* circles.c
* Patater GUI Kit
*
* Created by Jaeden Amero on 2020-12-20.
* Copyright 2021. SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "guikit/graphics.h"
#include "guikit/prandom.h"
#include "guikit/panic.h"
#include <stdio.h>
void RandomCircles(int num)
{
int color;
int x;
int y;
int r;
int i;
for (i = 0; i < num; ++i)
{
color = RandRange(0, NUM_COLORS - 1);
SetColor(color);
x = RandRange(0, SCREEN_WIDTH - 1);
y = RandRange(0, SCREEN_HEIGHT - 1);
r = RandRange(1, 100);
if (RandRange(0, 1) == 0)
{
FillCircle(x, y, r);
}
else
{
DrawCircle(x, y, r);
}
if (i % 100 == 0)
{
ShowGraphics();
}
}
}
void TestDrawCircles(void)
{
SetColor(COLOR_GREEN);
DrawCircle(24, 44, 12);
SetColor(COLOR_RED);
FillCircle(44, 44, 12);
}
int main(void)
{
int ret;
ret = InitGraphics();
if (ret < 0)
{
panic("Couldn't init graphics\n");
}
printf("Drawing 10000 circles...\n");
RandomCircles(10000);
ShowGraphics();
SaveScreenShot("circles.bmp");
FreeGraphics();
printf("Goodbye.\n");
return 0;
}