diff options
Diffstat (limited to 'opplysning.c')
| -rw-r--r-- | opplysning.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/opplysning.c b/opplysning.c new file mode 100644 index 0000000..6db5d7e --- /dev/null +++ b/opplysning.c @@ -0,0 +1,81 @@ +#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, "TORSDAG 17. APRIL"); + line(25, y += 60, font_p, fg, "18:00 Byggekveld"); + line(25, y += 50, font_p, fg, "18:00 Omvisning (guided tour)"); + 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(); +} |
