From c47526499a2e17de5df904c79d5df5f4cb9ad3f7 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Wed, 11 Mar 2026 01:23:57 -0400 Subject: [PATCH] Mostly working except for loading images. --- Makefile | 6 +- sample/01-a-good-first-program.md | 13 +- src/control_ui.cpp | 2 - src/md_parser.cpp | 802 ++++++++++++++++++++++-------- src/md_parser.rl | 53 +- src/slides_ui.cpp | 11 +- wraps/lel-guecs.wrap | 4 +- 7 files changed, 648 insertions(+), 243 deletions(-) diff --git a/Makefile b/Makefile index e8e4e01..fed343f 100644 --- a/Makefile +++ b/Makefile @@ -29,14 +29,14 @@ ifeq '$(OS)' 'Windows_NT' powershell "cp ./builddir/bezos.exe ." ./bezos ${SAMPLE} else - ./builddir/besos ${SAMPLE} + ./builddir/bezos ${SAMPLE} endif debug: build - gdb --nx -x .gdbinit --ex run --args builddir/besos + gdb --nx -x .gdbinit --ex run --args builddir/bezos debug_run: build - gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args builddir/besos ${SAMPLE} + gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args builddir/bezos ${SAMPLE} clean: meson compile --clean -C builddir diff --git a/sample/01-a-good-first-program.md b/sample/01-a-good-first-program.md index 9647b60..16f77d6 100644 --- a/sample/01-a-good-first-program.md +++ b/sample/01-a-good-first-program.md @@ -8,9 +8,12 @@ * The key is this * That's what we want --- +{ +"bg_color": [255, 0, 0, 255] +} # What You Should See -Yes, but with more feeling. +- Yes, but with more feeling. --- # Study Drills @@ -18,14 +21,14 @@ Yes, but with more feeling. --- # Common Student Questions -- This again. -- That too. +* This again. +* That too. --- # The Blue Plus -_You must find it_. +- _You must find it._ --- # The End -See You Soon! +- See You Soon! --- diff --git a/src/control_ui.cpp b/src/control_ui.cpp index bacac37..22ad6ed 100644 --- a/src/control_ui.cpp +++ b/src/control_ui.cpp @@ -86,7 +86,5 @@ void ControlUI::handle_events(sf::RenderWindow& controller, const sf::Event& eve default: break; } - - fmt::println("window pos: {},{}", pos.x, pos.y); } } diff --git a/src/md_parser.cpp b/src/md_parser.cpp index 321750c..b510c4e 100644 --- a/src/md_parser.cpp +++ b/src/md_parser.cpp @@ -1,246 +1,600 @@ -#line 1 "md_parser.rl" +#line 1 "..//src/md_parser.rl" #include #include enum { PLAIN=0, TITLE=1, - ENUM=2 + ENUM=2, + DECK=3 }; -#line 72 "md_parser.rl" +#line 90 "..//src/md_parser.rl" -#line 13 "md_parser.cpp" +#line 14 "..//src/md_parser.cpp" static const char _Parser_actions[] = { 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, - 7, 1, 8, 2, 0, 5, 2, 1, - 3, 2, 2, 3, 2, 3, 0, 2, - 3, 2, 2, 5, 0, 2, 7, 0, - 3, 5, 7, 0 + 7, 1, 8, 1, 9, 2, 0, 6, + 2, 1, 4, 2, 2, 4, 2, 3, + 4, 2, 4, 0, 2, 4, 2, 2, + 4, 3, 2, 5, 8, 3, 5, 8, + 4 }; static const short _Parser_key_offsets[] = { - 0, 0, 1, 1, 2, 3, 4, 5, - 6, 7, 12, 14, 19, 22, 24, 27, - 33, 37, 40, 43, 48, 53, 58, 66, - 69, 71, 74, 79, 84, 89, 97, 102, - 104, 106, 111, 113, 114, 117, 119, 122, - 128, 132, 135, 138, 139, 145, 151, 154, - 157, 160, 169, 173, 176, 179, 182, 188, - 194, 200, 209, 215, 221, 227, 230, 232, - 236, 239, 245, 251, 254, 259, 264, 267, - 273, 279, 288, 292, 295, 301, 307, 313, - 322, 328, 332, 335, 341, 347, 350, 356, - 359, 364 + 0, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 17, 21, 29, 30, 31, 32, + 35, 40, 42, 44, 46, 51, 59, 62, + 65, 68, 77, 82, 84, 85, 89, 95, + 101, 110, 114, 117, 122, 127, 132, 137, + 145, 148, 151, 154, 159, 164, 169, 174, + 182, 185, 188, 191, 196, 201, 203, 204, + 207, 212, 215, 220, 221, 222, 230, 233, + 236, 239, 242, 245, 248, 254, 260, 266, + 275, 281, 285, 288, 294, 300, 306, 312, + 321, 327, 331, 334, 340, 346, 352, 355, + 357, 361, 367, 371, 377, 379, 381, 390, + 395, 397, 399, 408, 412, 418, 421, 424, + 427, 435, 440, 446, 455, 459, 463, 467, + 477, 483, 486, 488, 493, 500, 507, 517, + 522, 526, 532, 538, 544, 550, 559, 562, + 565, 568, 576, 582, 586, 590, 594, 600, + 606, 612, 618, 624, 633, 636, 639, 642, + 650, 655, 661, 665, 669, 673, 679, 685, + 691, 697, 700, 702, 706, 712, 716, 722, + 726, 730, 739, 745, 748, 752, 756, 765, + 771, 777, 783, 786, 790, 794, 803, 809, + 815, 822, 829, 836, 846, 853, 858, 862, + 869, 876, 883, 890, 900, 907, 912, 916, + 923, 930, 937, 941, 944, 949, 956, 961, + 968, 972, 979, 986, 990, 996, 999, 1004, + 1006, 1009, 1015, 1018, 1023, 1025, 1029, 1030, + 1039, 1049, 1059 }; static const char _Parser_trans_keys[] = { - 123, 125, 10, 61, 61, 61, 10, 10, - 33, 35, 42, 45, 10, 45, 10, 33, - 35, 42, 45, 10, 40, 45, 10, 45, - 10, 41, 45, 10, 33, 35, 41, 42, - 45, 10, 40, 41, 45, 10, 41, 45, - 10, 41, 45, 10, 33, 35, 42, 45, - 10, 32, 45, 9, 13, 10, 32, 45, - 9, 13, 10, 32, 33, 35, 42, 45, - 9, 13, 10, 40, 45, 10, 45, 10, - 41, 45, 10, 33, 35, 42, 45, 10, + 123, 125, 125, 10, 61, 61, 61, 10, + 10, 32, 33, 35, 42, 45, 123, 9, + 13, 10, 32, 9, 13, 10, 32, 33, + 35, 42, 45, 9, 13, 40, 41, 41, + 32, 9, 13, 10, 32, 45, 9, 13, + 10, 45, 10, 45, 10, 45, 10, 32, + 45, 9, 13, 10, 32, 33, 35, 42, + 45, 9, 13, 10, 40, 45, 10, 41, + 45, 10, 41, 45, 10, 32, 33, 35, + 41, 42, 45, 9, 13, 10, 32, 41, + 9, 13, 40, 41, 41, 32, 41, 9, + 13, 10, 32, 41, 45, 9, 13, 10, + 32, 41, 45, 9, 13, 10, 32, 33, + 35, 41, 42, 45, 9, 13, 10, 40, + 41, 45, 10, 41, 45, 10, 33, 35, + 42, 45, 10, 32, 45, 9, 13, 10, 32, 45, 9, 13, 10, 32, 45, 9, 13, 10, 32, 33, 35, 42, 45, 9, - 13, 10, 32, 45, 9, 13, 10, 45, - 10, 45, 10, 32, 45, 9, 13, 10, - 45, 10, 10, 40, 45, 10, 45, 10, - 41, 45, 10, 33, 35, 41, 42, 45, - 10, 40, 41, 45, 10, 41, 45, 10, - 41, 45, 41, 10, 32, 41, 45, 9, - 13, 10, 32, 41, 45, 9, 13, 10, + 13, 10, 40, 45, 10, 41, 45, 10, + 41, 45, 10, 33, 35, 42, 45, 10, + 32, 45, 9, 13, 10, 32, 45, 9, + 13, 10, 32, 45, 9, 13, 10, 32, + 33, 35, 42, 45, 9, 13, 10, 40, + 45, 10, 41, 45, 10, 41, 45, 10, + 33, 35, 42, 45, 10, 32, 45, 9, + 13, 10, 45, 10, 32, 9, 13, 10, + 32, 45, 9, 13, 32, 9, 13, 10, + 32, 45, 9, 13, 125, 125, 10, 32, + 33, 35, 42, 45, 9, 13, 10, 41, + 45, 10, 41, 45, 10, 41, 45, 10, 41, 45, 10, 41, 45, 10, 41, 45, - 10, 32, 33, 35, 41, 42, 45, 9, + 10, 32, 41, 45, 9, 13, 10, 32, + 41, 45, 9, 13, 10, 32, 41, 45, + 9, 13, 10, 32, 33, 35, 41, 42, + 45, 9, 13, 10, 32, 41, 45, 9, 13, 10, 40, 41, 45, 10, 41, 45, - 10, 41, 45, 10, 41, 45, 10, 32, + 10, 32, 41, 45, 9, 13, 10, 32, 41, 45, 9, 13, 10, 32, 41, 45, 9, 13, 10, 32, 41, 45, 9, 13, 10, 32, 33, 35, 41, 42, 45, 9, 13, 10, 32, 41, 45, 9, 13, 10, - 32, 41, 45, 9, 13, 10, 32, 41, - 45, 9, 13, 10, 41, 45, 10, 41, - 10, 40, 41, 45, 10, 41, 45, 10, - 32, 41, 45, 9, 13, 10, 32, 41, - 45, 9, 13, 10, 41, 45, 10, 32, - 45, 9, 13, 10, 32, 45, 9, 13, - 10, 41, 45, 10, 32, 41, 45, 9, - 13, 10, 32, 41, 45, 9, 13, 10, + 40, 41, 45, 10, 41, 45, 10, 32, + 41, 45, 9, 13, 10, 32, 41, 45, + 9, 13, 10, 32, 41, 45, 9, 13, + 10, 41, 45, 10, 41, 32, 41, 9, + 13, 10, 32, 41, 45, 9, 13, 32, + 41, 9, 13, 10, 32, 41, 45, 9, + 13, 41, 125, 41, 125, 10, 32, 33, + 35, 42, 45, 125, 9, 13, 10, 32, + 125, 9, 13, 40, 125, 41, 125, 10, 32, 33, 35, 41, 42, 45, 9, 13, - 10, 40, 41, 45, 10, 41, 45, 10, - 32, 41, 45, 9, 13, 10, 32, 41, + 32, 125, 9, 13, 10, 32, 45, 125, + 9, 13, 10, 45, 125, 10, 45, 125, + 10, 45, 125, 10, 32, 33, 35, 42, + 45, 9, 13, 10, 32, 45, 9, 13, + 10, 32, 45, 125, 9, 13, 10, 32, + 33, 35, 42, 45, 125, 9, 13, 10, + 40, 45, 125, 10, 41, 45, 125, 10, + 41, 45, 125, 10, 32, 33, 35, 41, + 42, 45, 125, 9, 13, 10, 32, 41, + 125, 9, 13, 40, 41, 125, 41, 125, + 32, 41, 125, 9, 13, 10, 32, 41, + 45, 125, 9, 13, 10, 32, 41, 45, + 125, 9, 13, 10, 32, 33, 35, 41, + 42, 45, 125, 9, 13, 10, 40, 41, + 45, 125, 10, 41, 45, 125, 10, 33, + 35, 42, 45, 125, 10, 32, 45, 125, + 9, 13, 10, 32, 45, 125, 9, 13, + 10, 32, 45, 125, 9, 13, 10, 32, + 33, 35, 42, 45, 125, 9, 13, 10, + 45, 125, 10, 45, 125, 10, 45, 125, + 10, 32, 33, 35, 42, 45, 9, 13, + 10, 32, 45, 125, 9, 13, 10, 40, + 45, 125, 10, 41, 45, 125, 10, 41, + 45, 125, 10, 33, 35, 42, 45, 125, + 10, 32, 45, 125, 9, 13, 10, 32, + 45, 125, 9, 13, 10, 32, 45, 125, + 9, 13, 10, 32, 45, 125, 9, 13, + 10, 32, 33, 35, 42, 45, 125, 9, + 13, 10, 45, 125, 10, 45, 125, 10, + 45, 125, 10, 32, 33, 35, 42, 45, + 9, 13, 10, 32, 45, 9, 13, 10, + 32, 45, 125, 9, 13, 10, 40, 45, + 125, 10, 41, 45, 125, 10, 41, 45, + 125, 10, 33, 35, 42, 45, 125, 10, + 32, 45, 125, 9, 13, 10, 32, 45, + 125, 9, 13, 10, 32, 45, 125, 9, + 13, 10, 45, 125, 10, 125, 32, 125, + 9, 13, 10, 32, 45, 125, 9, 13, + 32, 125, 9, 13, 10, 32, 45, 125, + 9, 13, 10, 41, 45, 125, 10, 41, + 45, 125, 10, 32, 33, 35, 41, 42, 45, 9, 13, 10, 32, 41, 45, 9, - 13, 10, 32, 33, 35, 41, 42, 45, - 9, 13, 10, 32, 41, 45, 9, 13, - 10, 40, 41, 45, 10, 41, 45, 10, - 32, 41, 45, 9, 13, 10, 32, 41, - 45, 9, 13, 10, 41, 45, 10, 32, - 41, 45, 9, 13, 10, 41, 45, 10, - 33, 35, 42, 45, 10, 33, 35, 41, - 42, 45, 0 + 13, 10, 45, 125, 10, 41, 45, 125, + 10, 41, 45, 125, 10, 32, 33, 35, + 41, 42, 45, 9, 13, 10, 32, 41, + 45, 9, 13, 10, 32, 45, 125, 9, + 13, 10, 32, 45, 125, 9, 13, 10, + 45, 125, 10, 41, 45, 125, 10, 41, + 45, 125, 10, 32, 33, 35, 41, 42, + 45, 9, 13, 10, 32, 41, 45, 9, + 13, 10, 32, 41, 45, 9, 13, 10, + 32, 41, 45, 125, 9, 13, 10, 32, + 41, 45, 125, 9, 13, 10, 32, 41, + 45, 125, 9, 13, 10, 32, 33, 35, + 41, 42, 45, 125, 9, 13, 10, 32, + 41, 45, 125, 9, 13, 10, 40, 41, + 45, 125, 10, 41, 45, 125, 10, 32, + 41, 45, 125, 9, 13, 10, 32, 41, + 45, 125, 9, 13, 10, 32, 41, 45, + 125, 9, 13, 10, 32, 41, 45, 125, + 9, 13, 10, 32, 33, 35, 41, 42, + 45, 125, 9, 13, 10, 32, 41, 45, + 125, 9, 13, 10, 40, 41, 45, 125, + 10, 41, 45, 125, 10, 32, 41, 45, + 125, 9, 13, 10, 32, 41, 45, 125, + 9, 13, 10, 32, 41, 45, 125, 9, + 13, 10, 41, 45, 125, 10, 41, 125, + 32, 41, 125, 9, 13, 10, 32, 41, + 45, 125, 9, 13, 32, 41, 125, 9, + 13, 10, 32, 41, 45, 125, 9, 13, + 10, 41, 45, 125, 10, 32, 41, 45, + 125, 9, 13, 10, 32, 41, 45, 125, + 9, 13, 10, 41, 45, 125, 32, 41, + 45, 125, 9, 13, 41, 45, 125, 32, + 45, 125, 9, 13, 45, 125, 10, 41, + 45, 10, 32, 41, 45, 9, 13, 10, + 41, 45, 32, 41, 45, 9, 13, 41, + 45, 32, 45, 9, 13, 45, 10, 32, + 33, 35, 42, 45, 123, 9, 13, 10, + 32, 33, 35, 41, 42, 45, 123, 9, + 13, 10, 32, 33, 35, 42, 45, 123, + 125, 9, 13, 10, 32, 33, 35, 41, + 42, 45, 123, 125, 9, 13, 0 }; static const char _Parser_single_lengths[] = { - 0, 1, 0, 1, 1, 1, 1, 1, - 1, 5, 2, 5, 3, 2, 3, 6, - 4, 3, 3, 5, 3, 3, 6, 3, - 2, 3, 5, 3, 3, 6, 3, 2, - 2, 3, 2, 1, 3, 2, 3, 6, - 4, 3, 3, 1, 4, 4, 3, 3, - 3, 7, 4, 3, 3, 3, 4, 4, - 4, 7, 4, 4, 4, 3, 2, 4, - 3, 4, 4, 3, 3, 3, 3, 4, - 4, 7, 4, 3, 4, 4, 4, 7, - 4, 4, 3, 4, 4, 3, 4, 3, - 5, 6 + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 7, 2, 6, 1, 1, 1, 1, + 3, 2, 2, 2, 3, 6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0, 1, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, + 1, 0, 0, 1, 1, 1, 1, 1, + 1, 0, 0, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 0, 0, 1, 1, + 0, 0, 1, 1, 1, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 1, + 1, 0, 0, 1, 1, 1, 1, 0, + 0, 0, 1, 1, 1, 1, 0, 0, + 0, 1, 1, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 0, 0, 0, 1, + 1, 1, 0, 0, 0, 0, 1, 1, + 1, 0, 0, 1, 1, 1, 1, 0, + 0, 1, 1, 0, 0, 0, 1, 1, + 1, 1, 0, 0, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 0, 1, + 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, - 1, 0, 0, 1, 1, 0, 1, 0, - 0, 0 + 0, 1, 1, 0, 1, 0, 1, 0, + 0, 1, 0, 1, 0, 1, 0, 1, + 1, 1, 1 }; static const short _Parser_index_offsets[] = { - 0, 0, 2, 3, 5, 7, 9, 11, - 13, 15, 21, 24, 30, 34, 37, 41, - 48, 53, 57, 61, 67, 72, 77, 85, - 89, 92, 96, 102, 107, 112, 120, 125, - 128, 131, 136, 139, 141, 145, 148, 152, - 159, 164, 168, 172, 174, 180, 186, 190, - 194, 198, 207, 212, 216, 220, 224, 230, - 236, 242, 251, 257, 263, 269, 273, 276, - 281, 285, 291, 297, 301, 306, 311, 315, - 321, 327, 336, 341, 345, 351, 357, 363, - 372, 378, 383, 387, 393, 399, 403, 409, - 413, 419 -}; - -static const unsigned char _Parser_indicies[] = { - 0, 1, 2, 3, 2, 4, 1, 5, - 1, 6, 1, 7, 1, 8, 1, 10, - 11, 12, 13, 14, 9, 16, 17, 15, - 19, 20, 21, 22, 23, 18, 16, 24, - 17, 15, 26, 27, 25, 29, 30, 31, - 28, 32, 33, 34, 35, 36, 37, 25, - 29, 38, 30, 31, 28, 26, 39, 27, - 25, 29, 30, 40, 28, 16, 20, 21, - 22, 23, 18, 42, 41, 17, 41, 15, - 44, 43, 45, 43, 18, 46, 43, 47, - 21, 48, 49, 43, 18, 16, 50, 17, - 15, 26, 52, 51, 29, 54, 55, 53, - 16, 47, 21, 48, 49, 18, 57, 56, - 17, 56, 15, 59, 58, 45, 58, 18, - 60, 58, 20, 21, 22, 23, 58, 18, - 61, 56, 17, 56, 15, 16, 62, 15, - 16, 1, 15, 61, 56, 63, 56, 15, - 16, 64, 15, 65, 1, 16, 66, 17, - 15, 68, 69, 67, 71, 30, 72, 70, - 73, 74, 75, 35, 76, 77, 67, 71, - 38, 30, 72, 70, 71, 30, 78, 70, - 71, 30, 79, 70, 39, 79, 81, 80, - 30, 72, 80, 70, 84, 83, 85, 86, - 83, 82, 71, 54, 88, 87, 71, 54, - 89, 87, 71, 54, 79, 87, 90, 83, - 91, 92, 85, 93, 94, 83, 82, 71, - 95, 54, 88, 87, 26, 39, 52, 51, - 29, 54, 96, 53, 29, 54, 79, 53, - 81, 80, 54, 88, 80, 87, 98, 97, - 54, 88, 97, 87, 100, 99, 85, 86, - 99, 82, 102, 101, 74, 75, 103, 76, - 77, 101, 67, 100, 101, 103, 69, 101, - 67, 105, 104, 30, 72, 104, 70, 105, - 104, 30, 106, 104, 70, 71, 30, 107, - 70, 108, 39, 79, 71, 109, 30, 72, - 70, 68, 39, 69, 67, 105, 104, 30, - 78, 104, 70, 98, 97, 54, 110, 97, - 87, 71, 54, 107, 87, 61, 56, 62, - 56, 15, 57, 56, 63, 56, 15, 29, - 30, 79, 28, 112, 111, 30, 31, 111, - 28, 114, 113, 85, 52, 113, 51, 115, - 113, 116, 117, 85, 118, 119, 113, 51, - 29, 120, 54, 55, 53, 26, 54, 52, - 51, 112, 111, 54, 55, 111, 53, 122, - 121, 54, 55, 121, 53, 124, 123, 85, - 52, 123, 51, 126, 125, 127, 34, 103, - 36, 37, 125, 25, 124, 125, 103, 27, - 125, 25, 29, 128, 30, 31, 28, 26, - 30, 27, 25, 130, 129, 30, 31, 129, - 28, 130, 129, 30, 131, 129, 28, 29, - 30, 107, 28, 122, 121, 54, 132, 121, - 53, 29, 54, 107, 53, 10, 11, 12, - 13, 14, 9, 134, 135, 136, 137, 138, - 139, 133, 0 + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 25, 29, 37, 39, 41, 43, + 46, 51, 54, 57, 60, 65, 73, 77, + 81, 85, 94, 99, 102, 104, 108, 114, + 120, 129, 134, 138, 144, 149, 154, 159, + 167, 171, 175, 179, 185, 190, 195, 200, + 208, 212, 216, 220, 226, 231, 234, 236, + 239, 244, 247, 252, 254, 256, 264, 268, + 272, 276, 280, 284, 288, 294, 300, 306, + 315, 321, 326, 330, 336, 342, 348, 354, + 363, 369, 374, 378, 384, 390, 396, 400, + 403, 407, 413, 417, 423, 426, 429, 438, + 443, 446, 449, 458, 462, 468, 472, 476, + 480, 488, 493, 499, 508, 513, 518, 523, + 533, 539, 543, 546, 551, 558, 565, 575, + 581, 586, 593, 599, 605, 611, 620, 624, + 628, 632, 640, 646, 651, 656, 661, 668, + 674, 680, 686, 692, 701, 705, 709, 713, + 721, 726, 732, 737, 742, 747, 754, 760, + 766, 772, 776, 779, 783, 789, 793, 799, + 804, 809, 818, 824, 828, 833, 838, 847, + 853, 859, 865, 869, 874, 879, 888, 894, + 900, 907, 914, 921, 931, 938, 944, 949, + 956, 963, 970, 977, 987, 994, 1000, 1005, + 1012, 1019, 1026, 1031, 1035, 1040, 1047, 1052, + 1059, 1064, 1071, 1078, 1083, 1089, 1093, 1098, + 1101, 1105, 1111, 1115, 1120, 1123, 1127, 1129, + 1138, 1148, 1158 }; -static const char _Parser_trans_targs[] = { - 2, 0, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 36, 20, 30, 68, 10, - 11, 31, 10, 11, 12, 20, 30, 33, - 13, 14, 15, 18, 14, 15, 19, 18, - 15, 16, 71, 19, 83, 84, 17, 11, - 70, 21, 22, 21, 22, 31, 22, 23, - 27, 69, 24, 25, 52, 25, 26, 52, - 28, 29, 28, 29, 29, 29, 32, 34, - 35, 88, 37, 38, 39, 41, 38, 39, - 41, 39, 40, 44, 59, 60, 42, 43, - 45, 49, 46, 45, 49, 26, 47, 46, - 47, 48, 49, 50, 54, 55, 66, 51, - 53, 56, 57, 56, 57, 58, 57, 19, - 58, 57, 61, 62, 89, 64, 67, 72, - 73, 72, 73, 73, 74, 76, 77, 86, - 75, 78, 79, 78, 79, 80, 79, 81, - 82, 80, 79, 85, 87, 38, 39, 63, - 44, 19, 59, 65 +static const unsigned char _Parser_trans_targs[] = { + 2, 0, 0, 3, 4, 3, 5, 0, + 6, 0, 7, 0, 8, 0, 9, 0, + 11, 10, 12, 15, 55, 57, 59, 10, + 0, 11, 10, 10, 0, 11, 10, 12, + 15, 55, 213, 10, 0, 13, 0, 0, + 14, 11, 14, 16, 16, 0, 16, 20, + 18, 20, 17, 11, 18, 17, 11, 19, + 17, 11, 0, 17, 21, 20, 18, 20, + 17, 21, 20, 22, 36, 37, 45, 20, + 17, 11, 23, 18, 17, 25, 17, 66, + 24, 25, 35, 66, 24, 25, 26, 27, + 29, 11, 88, 211, 26, 14, 25, 26, + 11, 26, 14, 28, 11, 14, 11, 14, + 30, 11, 30, 14, 30, 31, 35, 66, + 31, 24, 32, 31, 35, 66, 31, 24, + 32, 31, 33, 68, 35, 69, 209, 31, + 24, 25, 34, 35, 66, 24, 25, 35, + 66, 24, 11, 22, 36, 37, 45, 17, + 21, 20, 18, 20, 17, 39, 38, 18, + 38, 17, 39, 38, 18, 38, 17, 39, + 38, 40, 36, 44, 45, 38, 17, 11, + 41, 18, 17, 25, 17, 64, 42, 25, + 43, 64, 42, 11, 40, 36, 44, 45, + 17, 39, 38, 18, 38, 17, 47, 46, + 53, 46, 17, 47, 46, 18, 46, 17, + 47, 46, 48, 36, 44, 52, 46, 17, + 11, 49, 18, 17, 25, 17, 62, 50, + 25, 51, 62, 50, 11, 48, 36, 44, + 52, 17, 47, 46, 53, 46, 17, 11, + 54, 17, 215, 0, 56, 56, 0, 56, + 38, 18, 38, 17, 58, 58, 0, 58, + 46, 18, 46, 17, 0, 60, 61, 60, + 11, 10, 12, 15, 55, 57, 10, 0, + 25, 51, 63, 50, 25, 51, 14, 50, + 25, 43, 65, 42, 25, 43, 14, 42, + 25, 35, 67, 24, 25, 35, 14, 24, + 32, 31, 35, 66, 31, 24, 71, 70, + 35, 66, 70, 24, 71, 70, 35, 66, + 70, 24, 71, 72, 73, 75, 43, 76, + 77, 72, 42, 71, 72, 43, 64, 72, + 42, 25, 74, 43, 64, 42, 25, 43, + 64, 42, 32, 31, 43, 64, 31, 42, + 71, 72, 43, 64, 72, 42, 79, 78, + 43, 208, 78, 42, 79, 78, 43, 64, + 78, 42, 79, 80, 81, 83, 51, 84, + 85, 80, 50, 79, 80, 51, 62, 80, + 50, 25, 82, 51, 62, 50, 25, 51, + 62, 50, 32, 31, 51, 62, 31, 50, + 71, 72, 51, 62, 72, 50, 79, 80, + 51, 86, 80, 50, 25, 51, 87, 50, + 216, 11, 14, 89, 11, 89, 14, 89, + 72, 43, 64, 72, 42, 91, 11, 91, + 14, 91, 80, 51, 62, 80, 50, 94, + 14, 93, 94, 98, 93, 94, 95, 96, + 99, 155, 206, 61, 95, 60, 94, 95, + 61, 95, 60, 97, 61, 60, 60, 98, + 93, 25, 26, 27, 29, 11, 88, 90, + 26, 14, 100, 61, 100, 60, 100, 106, + 102, 104, 106, 101, 94, 102, 104, 101, + 94, 103, 104, 101, 94, 60, 104, 101, + 11, 17, 22, 36, 37, 105, 17, 17, + 47, 46, 19, 46, 17, 107, 106, 102, + 104, 106, 101, 107, 106, 108, 122, 123, + 168, 104, 106, 101, 94, 109, 102, 104, + 101, 111, 101, 171, 173, 110, 111, 121, + 171, 173, 110, 111, 112, 113, 115, 94, + 196, 204, 98, 112, 93, 111, 112, 94, + 98, 112, 93, 114, 94, 98, 93, 94, + 98, 93, 116, 94, 98, 116, 93, 116, + 117, 121, 171, 173, 117, 110, 118, 117, + 121, 171, 173, 117, 110, 118, 117, 119, + 176, 121, 177, 201, 173, 117, 110, 111, + 120, 121, 171, 173, 110, 111, 121, 171, + 173, 110, 94, 108, 122, 123, 168, 104, + 101, 107, 106, 102, 104, 106, 101, 125, + 124, 102, 104, 124, 101, 125, 124, 102, + 104, 124, 101, 125, 130, 131, 135, 136, + 137, 129, 130, 126, 94, 127, 129, 126, + 94, 128, 129, 126, 94, 60, 129, 126, + 11, 17, 40, 36, 44, 105, 17, 17, + 125, 130, 127, 129, 130, 126, 94, 132, + 127, 129, 126, 111, 126, 164, 166, 133, + 111, 134, 164, 166, 133, 94, 131, 135, + 136, 137, 129, 126, 107, 106, 127, 129, + 106, 126, 125, 130, 127, 129, 130, 126, + 139, 138, 163, 129, 138, 126, 139, 138, + 127, 129, 138, 126, 139, 145, 146, 150, + 151, 152, 143, 145, 140, 94, 141, 143, + 140, 94, 142, 143, 140, 94, 60, 143, + 140, 11, 17, 48, 36, 44, 144, 17, + 17, 47, 46, 19, 46, 17, 139, 145, + 141, 143, 145, 140, 94, 147, 141, 143, + 140, 111, 140, 159, 161, 148, 111, 149, + 159, 161, 148, 94, 146, 150, 151, 152, + 143, 140, 107, 106, 141, 143, 106, 140, + 125, 130, 141, 143, 130, 140, 139, 145, + 153, 143, 145, 140, 94, 154, 143, 140, + 217, 61, 60, 156, 61, 156, 60, 156, + 130, 127, 129, 130, 126, 158, 61, 158, + 60, 158, 145, 141, 143, 145, 140, 111, + 149, 160, 161, 148, 111, 149, 93, 161, + 148, 25, 50, 81, 83, 51, 84, 162, + 50, 50, 79, 80, 51, 63, 80, 50, + 94, 154, 129, 126, 111, 134, 165, 166, + 133, 111, 134, 93, 166, 133, 25, 42, + 73, 75, 43, 76, 167, 42, 42, 79, + 78, 43, 65, 78, 42, 139, 169, 170, + 104, 169, 101, 139, 169, 102, 104, 169, + 101, 94, 154, 104, 101, 111, 121, 172, + 173, 110, 111, 121, 93, 173, 110, 25, + 24, 33, 68, 35, 69, 174, 24, 24, + 79, 175, 35, 67, 175, 24, 79, 175, + 35, 66, 175, 24, 118, 117, 121, 171, + 173, 117, 110, 179, 178, 121, 171, 173, + 178, 110, 179, 178, 121, 171, 173, 178, + 110, 179, 180, 181, 183, 134, 184, 185, + 166, 180, 133, 179, 180, 134, 164, 166, + 180, 133, 111, 182, 134, 164, 166, 133, + 111, 134, 164, 166, 133, 118, 117, 134, + 164, 166, 117, 133, 179, 180, 134, 164, + 166, 180, 133, 187, 186, 134, 200, 166, + 186, 133, 187, 186, 134, 164, 166, 186, + 133, 187, 188, 189, 191, 149, 192, 193, + 161, 188, 148, 187, 188, 149, 159, 161, + 188, 148, 111, 190, 149, 159, 161, 148, + 111, 149, 159, 161, 148, 118, 117, 149, + 159, 161, 117, 148, 179, 180, 149, 159, + 161, 180, 148, 187, 188, 149, 194, 161, + 188, 148, 111, 149, 195, 161, 148, 218, + 94, 98, 93, 197, 94, 98, 197, 93, + 197, 180, 134, 164, 166, 180, 133, 199, + 94, 98, 199, 93, 199, 188, 149, 159, + 161, 188, 148, 111, 134, 195, 166, 133, + 187, 202, 121, 203, 173, 202, 110, 187, + 202, 121, 171, 173, 202, 110, 111, 121, + 195, 173, 110, 199, 94, 205, 98, 199, + 93, 94, 195, 98, 93, 158, 207, 61, + 158, 60, 154, 61, 60, 25, 43, 87, + 42, 79, 175, 35, 210, 175, 24, 25, + 35, 87, 24, 91, 11, 212, 91, 14, + 11, 87, 14, 58, 214, 58, 0, 54, + 0, 11, 10, 12, 15, 55, 57, 59, + 10, 0, 25, 26, 27, 29, 11, 88, + 90, 92, 26, 14, 94, 95, 96, 99, + 155, 157, 60, 61, 95, 60, 111, 112, + 113, 115, 94, 196, 198, 93, 98, 112, + 93, 0 }; static const char _Parser_trans_actions[] = { - 1, 0, 0, 0, 9, 0, 0, 0, - 13, 37, 15, 37, 37, 37, 37, 0, - 7, 0, 1, 0, 1, 1, 1, 1, - 0, 1, 28, 1, 0, 7, 11, 0, - 0, 1, 1, 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 0, + 0, 0, 27, 5, 0, 5, 0, 9, + 0, 0, 19, 0, 7, 7, 0, 0, + 1, 1, 1, 1, 5, 5, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, + 42, 42, 42, 42, 42, 42, 42, 0, + 9, 13, 0, 0, 9, 13, 0, 0, + 9, 13, 0, 0, 9, 13, 0, 0, + 9, 13, 0, 0, 9, 13, 0, 0, + 24, 3, 13, 0, 3, 0, 39, 7, + 13, 0, 7, 0, 9, 1, 21, 1, + 1, 1, 0, 1, 1, 1, 21, 1, + 1, 1, 1, 9, 1, 21, 1, 1, + 1, 9, 0, 13, 0, 0, 33, 13, + 1, 1, 24, 3, 13, 0, 3, 0, + 30, 7, 13, 0, 7, 0, 36, 5, + 13, 0, 5, 0, 9, 1, 21, 1, + 1, 1, 0, 1, 1, 1, 21, 1, + 1, 1, 1, 9, 1, 21, 1, 1, + 1, 9, 0, 13, 0, 0, 33, 13, + 1, 1, 24, 3, 13, 0, 3, 0, + 30, 7, 13, 0, 7, 0, 27, 5, + 13, 0, 5, 0, 9, 13, 0, 0, + 19, 13, 0, 7, 13, 7, 0, 0, + 1, 21, 1, 1, 1, 5, 13, 5, + 0, 0, 1, 21, 1, 1, 1, 13, + 0, 0, 13, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 1, 42, 42, 42, 42, 13, 42, 42, + 42, 0, 3, 0, 3, 0, 0, 1, + 1, 1, 1, 1, 9, 0, 0, 0, + 9, 0, 0, 0, 9, 0, 0, 0, + 45, 42, 42, 42, 42, 42, 42, 0, + 36, 5, 0, 5, 0, 9, 1, 1, + 1, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 9, 0, 0, 0, + 0, 33, 0, 1, 1, 1, 9, 13, + 0, 0, 0, 0, 0, 0, 0, 13, + 0, 0, 0, 0, 0, 0, 0, 13, + 0, 0, 0, 0, 13, 0, 0, 13, + 1, 1, 3, 13, 0, 3, 0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0, 45, + 42, 42, 42, 13, 42, 42, 42, 0, + 36, 5, 13, 0, 5, 0, 9, 1, + 21, 1, 1, 1, 24, 3, 13, 0, + 0, 3, 0, 39, 7, 13, 0, 0, + 7, 0, 9, 1, 21, 1, 1, 1, + 1, 0, 1, 1, 1, 21, 1, 1, + 1, 1, 1, 9, 1, 21, 1, 1, + 1, 1, 9, 0, 13, 0, 0, 0, + 33, 13, 1, 1, 1, 24, 3, 13, + 0, 0, 3, 0, 30, 7, 13, 0, + 0, 7, 0, 36, 5, 13, 0, 0, + 5, 0, 9, 1, 21, 1, 1, 1, + 1, 0, 1, 1, 1, 21, 1, 1, + 1, 1, 1, 9, 1, 21, 1, 1, + 1, 1, 9, 0, 13, 0, 0, 0, + 33, 13, 1, 1, 1, 24, 3, 13, + 0, 0, 3, 0, 30, 7, 13, 0, + 0, 7, 0, 27, 5, 13, 0, 0, + 5, 0, 9, 13, 0, 0, 0, 19, + 13, 0, 0, 7, 13, 0, 7, 0, + 0, 1, 21, 1, 1, 1, 1, 5, + 13, 0, 5, 0, 0, 1, 21, 1, + 1, 1, 1, 9, 13, 0, 0, 0, + 36, 5, 13, 0, 0, 5, 0, 9, + 1, 21, 1, 1, 1, 1, 9, 13, + 0, 0, 0, 5, 13, 0, 0, 5, + 0, 13, 0, 0, 0, 5, 0, 0, + 5, 0, 0, 0, 0, 9, 13, 0, + 0, 36, 5, 13, 0, 5, 0, 9, + 13, 0, 0, 5, 13, 0, 5, 0, + 13, 0, 0, 5, 0, 5, 0, 0, + 0, 17, 17, 17, 17, 17, 17, 1, + 17, 0, 17, 17, 17, 17, 13, 17, + 17, 1, 17, 0, 17, 17, 17, 17, + 17, 17, 1, 0, 17, 0, 17, 17, + 17, 17, 13, 17, 17, 1, 0, 17, + 0, 0 }; static const int Parser_start = 1; -static const int Parser_first_final = 88; +static const int Parser_first_final = 215; static const int Parser_error = 0; static const int Parser_en_main = 1; -#line 75 "md_parser.rl" +#line 93 "..//src/md_parser.rl" bool Parser::parse(const std::string& input) { @@ -252,15 +606,18 @@ bool Parser::parse(const std::string& input) { const char *eof = p + input.size(); (void)eof; std::string tk; + // need this so that @meta knows it's a deck config first + last = DECK; + -#line 248 "md_parser.cpp" +#line 605 "..//src/md_parser.cpp" { cs = Parser_start; } -#line 87 "md_parser.rl" +#line 108 "..//src/md_parser.rl" -#line 251 "md_parser.cpp" +#line 608 "..//src/md_parser.cpp" { int _klen; unsigned int _trans; @@ -322,7 +679,6 @@ _resume: } _match: - _trans = _Parser_indicies[_trans]; cs = _Parser_trans_targs[_trans]; if ( _Parser_trans_actions[_trans] == 0 ) @@ -335,24 +691,30 @@ _match: switch ( *_acts++ ) { case 0: -#line 14 "md_parser.rl" +#line 15 "..//src/md_parser.rl" { start = p; } break; case 1: -#line 15 "md_parser.rl" +#line 16 "..//src/md_parser.rl" { last = TITLE; } break; case 2: -#line 17 "md_parser.rl" - { last = ENUM; } +#line 17 "..//src/md_parser.rl" + { last = PLAIN; } break; case 3: -#line 19 "md_parser.rl" +#line 18 "..//src/md_parser.rl" + { last = ENUM; } + break; + case 4: +#line 20 "..//src/md_parser.rl" { + tk = input.substr(start - begin, p - start); + if(last == TITLE) { - title = input.substr(start - begin, p - start); + title = tk; } else if(last == ENUM) { - content += "* " + input.substr(start - begin, p - start); + content += "* " + tk; content += "\n"; } else { content += input.substr(start - begin, p - start); @@ -362,38 +724,50 @@ _match: last = PLAIN; } break; - case 4: -#line 32 "md_parser.rl" + case 5: +#line 36 "..//src/md_parser.rl" { tk = input.substr(start - begin, p - start); - deck->config = json::parse(tk); - std::cout << "META:" << deck->config << '\n'; + if(last == DECK) { + deck->config = json::parse(tk); + std::cout << "META:" << deck->config << '\n'; + } else { + config = json::parse(tk); + std::cout << "SLIDE META:" << config << '\n'; + } } break; - case 5: -#line 38 "md_parser.rl" + case 6: +#line 47 "..//src/md_parser.rl" { - config["image"] = input.substr(start - begin, p - start); + std::string image = input.substr(start - begin, p - start); + fmt::println("IMAGE image={}, start={}, length={}", + image, start - begin, p - start); + config["image"] = image; } - break; - case 6: -#line 42 "md_parser.rl" - { fmt::println("----- START"); } break; case 7: -#line 44 "md_parser.rl" +#line 54 "..//src/md_parser.rl" + { + last = PLAIN; + fmt::println("----- START"); + } + break; + case 8: +#line 59 "..//src/md_parser.rl" { title.clear(); content.clear(); } break; - case 8: -#line 49 "md_parser.rl" + case 9: +#line 64 "..//src/md_parser.rl" { deck->slides.emplace_back(title, content, config); + config.clear(); } break; -#line 374 "md_parser.cpp" +#line 747 "..//src/md_parser.cpp" } } @@ -406,7 +780,7 @@ _again: _out: {} } -#line 88 "md_parser.rl" +#line 109 "..//src/md_parser.rl" bool good = pe - p == 0; diff --git a/src/md_parser.rl b/src/md_parser.rl index 0b4fa31..6ad411b 100644 --- a/src/md_parser.rl +++ b/src/md_parser.rl @@ -4,7 +4,8 @@ enum { PLAIN=0, TITLE=1, - ENUM=2 + ENUM=2, + DECK=3 }; %%{ @@ -13,14 +14,16 @@ enum { action mark { start = fpc; } action title { last = TITLE; } - + action plain { last = PLAIN; } action enum { last = ENUM; } action content { + tk = input.substr(start - begin, fpc - start); + if(last == TITLE) { - title = input.substr(start - begin, fpc - start); + title = tk; } else if(last == ENUM) { - content += "* " + input.substr(start - begin, fpc - start); + content += "* " + tk; content += "\n"; } else { content += input.substr(start - begin, fpc - start); @@ -29,17 +32,29 @@ enum { last = PLAIN; } + action meta { tk = input.substr(start - begin, fpc - start); - deck->config = json::parse(tk); - std::cout << "META:" << deck->config << '\n'; + if(last == DECK) { + deck->config = json::parse(tk); + std::cout << "META:" << deck->config << '\n'; + } else { + config = json::parse(tk); + std::cout << "SLIDE META:" << config << '\n'; + } } action image { - config["image"] = input.substr(start - begin, fpc - start); + std::string image = input.substr(start - begin, fpc - start); + fmt::println("IMAGE image={}, start={}, length={}", + image, start - begin, fpc - start); + config["image"] = image; } - action start { fmt::println("----- START"); } + action start { + last = PLAIN; + fmt::println("----- START"); + } action start_slide { title.clear(); @@ -48,6 +63,7 @@ enum { action end_slide { deck->slides.emplace_back(title, content, config); + config.clear(); } eol = '\n'; @@ -55,20 +71,22 @@ enum { end = '---' %end_slide; pound = '#' %title; asterisk = '*' %enum; - dash = '-' %enum; + dash = '-' %plain; bang = '!'; - image = bang '(' (any+) >mark %image :>> ')'; - meta = ('{' ( any+) :>> '}') >mark %meta; - content = (any+ -- (eol|end)) >mark %content; - title = pound space+ content eol; - enum = (asterisk | dash) space+ content eol; - line = content :>> eol; + image = bang '(' (any+ -- ')' ) >mark %image ')'; + meta = ('{' ( any+ -- '}') '}') >mark %meta; + content = (any+ -- (eol|end)) >mark %content eol; + title = pound space+ content; + enum = asterisk space+ content; + line = dash space+ content; blank = space* eol; - slide = (title | enum | line | blank | image)+ >start_slide end eol; + + slide = meta? (title | enum | line | blank | image)+ >start_slide end eol; main := meta eol start eol (slide)+; + }%% %% write data; @@ -83,6 +101,9 @@ bool Parser::parse(const std::string& input) { const char *eof = p + input.size(); (void)eof; std::string tk; + // need this so that @meta knows it's a deck config first + last = DECK; + %% write init; %% write exec; diff --git a/src/slides_ui.cpp b/src/slides_ui.cpp index 7f58fbd..f4a9f57 100644 --- a/src/slides_ui.cpp +++ b/src/slides_ui.cpp @@ -40,6 +40,11 @@ void Slide::init(lel::Cell& cell) { CONTENT_SIZE, guecs::THEME.TEXT_COLOR, 20}); + if($config.contains("image")) { + // STOPPED HERE, need to fix how images are loaded + // $gui.set(content, {$config["image"]}); + } + $gui.init(); } } @@ -97,10 +102,14 @@ void SlidesUI::prev_slide() { void SlidesUI::show_slide() { auto& slide = current(); + + // kind of have to set the background for the whole UI using the slide config auto& bg = $gui.get($gui.MAIN); sf::Color color = guecs::THEME.FILL_COLOR; - if(slide.$config.contains("bg_color")) { + if(slide.$config.contains("bg_image")) { + bg.set_sprite(slide.$config["bg_image"], true); + } else if(slide.$config.contains("bg_color")) { auto color_conf = slide.$config["bg_color"]; color = {color_conf[0], color_conf[1], color_conf[2], color_conf[3]}; } diff --git a/wraps/lel-guecs.wrap b/wraps/lel-guecs.wrap index 8c799b5..4286f0d 100644 --- a/wraps/lel-guecs.wrap +++ b/wraps/lel-guecs.wrap @@ -1,6 +1,6 @@ [wrap-git] -directory=lel-guecs-0.7.0 -url=https://git.learnjsthehardway.com/learn-code-the-hard-way/lel-guecs.git +directory=lel-guecs-0.7.1 +url=https://git.zedshaw.games/games/lel-guecs.git revision=HEAD depth=1 method=meson