-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
39 lines (29 loc) · 1.13 KB
/
main.c
File metadata and controls
39 lines (29 loc) · 1.13 KB
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
#define TIGR_IMPLEMENTATION
#include "node_modules/tigr.c/tigr.h"
int main(int argc, char* argv[]) {
Tigr* screen = tigrWindow(320, 240, "Clip", 0);
TPixel c0 = tigrRGB(55, 55, 55);
TPixel c1 = tigrRGB(255, 255, 255);
TPixel c2 = tigrRGB(100, 200, 100);
TPixel c3 = tigrRGBA(100, 100, 200, 150);
while (!tigrClosed(screen) && !tigrKeyDown(screen, TK_ESCAPE)) {
tigrClear(screen, c0);
int cx = screen->w / 2;
int cy = screen->h / 2;
int w = 100;
int d = 50;
tigrClip(screen, cx - d, cy - d, w, w);
tigrFill(screen, cx - d, cy - d, w, w, c1);
tigrRect(screen, cx - w, cy - w, w, w, c2);
tigrFillRect(screen, cx - w, cy - w, w, w, c3);
tigrCircle(screen, cx + d, cy - d, d, c2);
tigrFillCircle(screen, cx + d, cy - d, d, c3);
const char* message = "Half a thought is also a thought";
int tw = tigrTextWidth(tfont, message);
int th = tigrTextHeight(tfont, message);
tigrPrint(screen, tfont, cx - tw / 2, cy + d - th / 2, c2, message);
tigrUpdate(screen);
}
tigrFree(screen);
return 0;
}