diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-01-14 06:33:54 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-01-14 06:33:54 +0100 |
commit | dced6f7768e02252af11f9b41017d75c66b47d81 (patch) | |
tree | 008f4cb816a09b776013d5903b34fb89c01cf042 /examples/graph.c | |
parent | c9208089c6074575342d529f494295c13269a1aa (diff) | |
download | reduced_system_layer-dced6f7768e02252af11f9b41017d75c66b47d81.zip |
Correct examples for changed graphics procs
Diffstat (limited to 'examples/graph.c')
-rw-r--r-- | examples/graph.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/examples/graph.c b/examples/graph.c index f03cc93..99f916d 100644 --- a/examples/graph.c +++ b/examples/graph.c @@ -53,16 +53,15 @@ void draw_node(i64 node_index) { Node n = world.nodes[node_index]; - vec3_f32 color = {0}; // black color + vec4_f32 color = { 0.f, 0.f, 0.f, 1.f }; // black color if (n.highlight) - color = (vec3_f32) { 1.f, .0f, 1.f }; // pink color + color = (vec4_f32) { 1.f, .0f, 1.f, 1.f }; // pink color if (n.hover) - color = (vec3_f32) { 0.f, .5f, 0.f }; // green color + color = (vec4_f32) { 0.f, .5f, 0.f, 1.f }; // green color fill_ellipse( - OP_SET, // set pixels - color, + (Brush) { .color = color }, n.x - n.radius, n.y - n.radius, n.radius * 2, @@ -78,16 +77,15 @@ void draw_edge(i64 edge_index) { Node n0 = world.nodes[e.src]; Node n1 = world.nodes[e.dst]; - vec3_f32 color = { .5f, .5f, .5f }; // grey color + vec4_f32 color = { .5f, .5f, .5f, 1.f }; // grey color if (e.highlight) - color = (vec3_f32) { 1.f, .0f, 1.f }; // pink color + color = (vec4_f32) { 1.f, .0f, 1.f, 1.f }; // pink color if (e.hover) - color = (vec3_f32) { 0.f, .5f, 0.f }; // green color + color = (vec4_f32) { 0.f, .5f, 0.f, 1.f }; // green color fill_line( - OP_SET, // set pixels - color, + (Brush) { .color = color }, n0.x, n0.y, n1.x, @@ -504,7 +502,7 @@ void update_and_render_frame(void) { // Render - fill_rectangle(OP_SET, (vec3_f32) { .7f, .8f, .9f }, 0, 0, g_platform.frame_width, g_platform.frame_height); + fill_rectangle((Brush) { .color = { .7f, .8f, .9f, 1.f } }, 0, 0, g_platform.frame_width, g_platform.frame_height); if (adding_edge) { f64 x0 = world.nodes[adding_src].x; @@ -517,7 +515,7 @@ void update_and_render_frame(void) { y1 = world.nodes[adding_dst].y; } - fill_line(OP_SET, (vec3_f32) { .5f, 0.f, .5f }, x0, y0, x1, y1, 30); + fill_line((Brush) { .color = { .5f, 0.f, .5f, 1.f } }, x0, y0, x1, y1, 30); } draw_graph(); @@ -530,9 +528,7 @@ i32 main(i32 argc, c8 **argv) { (void) argv; g_platform = (Platform) { - .title = "Graph", - .frame_width = 960, - .frame_height = 720, + .title = "Graph", }; add_node(100, 100); |