diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-26 21:02:24 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-26 21:02:24 +0100 |
commit | a614626b21849eed9c5f1580388fb31402f4bc31 (patch) | |
tree | 99cbe2372cd58eeafc089bfea24fd50444dd23e8 /src | |
parent | 950706fdaf3f6bc9a94d881f79dfe244261c15ad (diff) | |
download | cw_tree-a614626b21849eed9c5f1580388fb31402f4bc31.tar.gz cw_tree-a614626b21849eed9c5f1580388fb31402f4bc31.tar.bz2 cw_tree-a614626b21849eed9c5f1580388fb31402f4bc31.zip |
Functioning main loop which draws number lines and iterations
Pretty cool!
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2fefb17..91610db 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,18 +106,22 @@ void draw_number_line(const NodeAllocator &allocator) int main(void) { - // NodeAllocator allocator{256}; - // std::queue<word_t> to_iterate; - // Fraction best_frac{1, 2}; - // word_t root = allocator.alloc_node({best_frac}); - // to_iterate.push(root); - - InitWindow(800, 600, "Calkin-Wilf Trees"); + NodeAllocator allocator{0}; + std::queue<word_t> to_iterate; + Fraction best_frac{1, 2}; + word_t root = allocator.alloc({best_frac}); + to_iterate.push(root); + InitWindow(WIDTH, HEIGHT, "Calkin-Wilf Trees"); while (!WindowShouldClose()) { + if (IsKeyPressed(KEY_SPACE)) + { + iterate(to_iterate, allocator); + count += 2; + } ClearBackground(BLACK); BeginDrawing(); - DrawText("Hello, world!", 50, 50, 25, WHITE); + draw_number_line(allocator); EndDrawing(); } CloseWindow(); |