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
|
#define _POSIX_C_SOURCE 199309L
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <raylib.h>
const char *the_alphabet = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ"
"abcdefghijklmnopqrstuvwxyzæøå"
"!@#$%^&*()[];'\\:\"|,./<>?";
void
line(int x, int y, Font f, Color c, char *s)
{
DrawTextEx(f, s, (Vector2){x, y}, (float)f.baseSize, 2, c);
}
int
main(void)
{
const int sw = 1920;
const int sh = 1080;
InitWindow(sw, sh, "opplysning");
SetTargetFPS(60);
int ncp = 0;
int *cp = LoadCodepoints(the_alphabet, &ncp);
Font font_h = LoadFontEx("font/adventpro-bold.ttf", 60, cp, ncp);
Font font_p = LoadFontEx("font/adventpro-semibold.ttf", 40, cp, ncp);
UnloadCodepoints(cp);
Color bg = RAYWHITE;
Color fg = BLACK;
Color hd = {0xf0, 0x4a, 0x00, 0xff};
while (!WindowShouldClose()) {
struct timespec now = {0};
clock_gettime(CLOCK_REALTIME, &now);
struct tm *ti = localtime(&now.tv_sec);
char ts[64] = {0};
snprintf(ts, sizeof(ts), "%02d:%02d", ti->tm_hour, ti->tm_min);
BeginDrawing();
ClearBackground(bg);
// DrawFPS(1920-100, 20);
int y = 0;
line(sw / 2 - 60, 0, font_h, fg, ts);
line(20, y += 60, font_h, hd, "FREDAG 18. APRIL");
line(25, y += 60, font_p, fg, "19:00 PRUSA 3D printer course");
line(20, y += 60, font_h, hd, "LØRDAG 19. APRIL");
line(25, y += 60, font_p, fg,
"17:00 Lasercutter: basic use and safety");
line(20, y += 60, font_h, hd, "SØNDAG 20. APRIL");
line(25, y += 60, font_p, fg, "13:00 Armor Workshop");
y = 0;
line(sw / 2 + 20, y += 60, font_h, hd, "MANDAG 21. APRIL");
line(sw / 2 + 20, y += 60, font_h, hd, "TIRSDAG 22. APRIL");
line(sw / 2 + 20, y += 60, font_h, hd, "ONSDAG 23. APRIL");
line(sw / 2 + 25, y += 60, font_p, fg,
"16:00 Learn to use Bitraf's Table Saw");
line(sw / 2 + 20, y += 60, font_h, hd, "TORSDAG 24. APRIL");
line(sw / 2 + 25, y += 60, font_p, fg,
"18:00 Omvisning (guided tour)");
line(sw / 2 + 25, y += 60, font_p, fg, "18:00 Byggekveld");
line(sw / 2 + 25, y += 60, font_p, fg,
"20:00 Bitrafs årsmøte 2025");
EndDrawing();
}
CloseWindow();
}
|