summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Stensgård <mastensg@mastensg.net>2025-04-18 20:13:29 +0200
committerMartin Stensgård <mastensg@mastensg.net>2025-04-18 20:13:29 +0200
commitbb882015b61939eb24719f949e6e8e5dae3c32e0 (patch)
treeb67d6fec97d6a767e322deb830a4fc9c17e8158a
parente3e1751aaaaa39d1c6453d138aeceabf55fcfed9 (diff)
draw the events
-rw-r--r--opplysning.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/opplysning.c b/opplysning.c
index 163db47..bfc0edd 100644
--- a/opplysning.c
+++ b/opplysning.c
@@ -114,6 +114,12 @@ line(int x, int y, Font f, Color c, char *s)
DrawTextEx(f, s, (Vector2){x, y}, (float)f.baseSize, 2, c);
}
+void
+draw_hd(int x, int y, Font f, Color c, char *s)
+{
+ DrawTextEx(f, s, (Vector2){x, y}, (float)f.baseSize, 2, c);
+}
+
int
main(void)
{
@@ -150,28 +156,32 @@ main(void)
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");
+
+ int y = 0;
+ int year = 0, month = 0, day = 0;
+ for (int i = 0; i < num_events; ++i) {
+ struct event *e = the_events + i;
+ if (year != e->year || month != e->month ||
+ day != e->day) {
+ year = e->year;
+ month = e->month;
+ day = e->day;
+
+ char s[64] = {0};
+ snprintf(s, sizeof(s), "%s %u. %s",
+ ukedag[e->wday], e->day,
+ maaned[e->month]);
+ line(20, y += 50, font_h, hd, s);
+ y += 20;
+ }
+ {
+ char s[64] = {0};
+ snprintf(s, sizeof(s), "%02u:%02u %s", e->hour,
+ e->minute, e->title);
+ line(25, y += 40, font_p, fg, s);
+ }
+ }
EndDrawing();
}