#if 0 /* #/ ================================================================ #/ #/ graph.c #/ #/ ================================================================ #/ #/ Self-compilation shell script #/ SRC=${0##*./} BIN=${SRC%.*} gcc \ -Wall -Wextra -Werror -pedantic \ -Wno-old-style-declaration \ -Wno-missing-braces \ -Wno-unused-variable \ -Wno-unused-but-set-variable \ -Wno-unused-parameter \ -Wno-overlength-strings \ -O3 \ -fsanitize=undefined,address,leak -mshstk \ -lX11 -lm \ -o $BIN $SRC && \ ./$BIN $@ && rm $BIN exit $? # */ #endif #include "../graphics.c" i32 main(i32 argc, c8 **argv) { (void) argc; (void) argv; platform = (Platform) { .title = "Graph", .frame_width = 960, .frame_height = 720, }; u32 WHITE = u32_from_rgb(1.f, 1.f, 1.f); u32 BLACK = u32_from_rgb(0.f, 0.f, 0.f); u32 RED = u32_from_rgb(1.f, 0.f, 0.f); u32 BLUE = u32_from_rgb(0.f, 0.f, 1.f); p_init(); while (!platform.done) { p_wait_events(); i64 x = platform.frame_width / 2; i64 y = platform.frame_height / 2; fill_rectangle(OP_SET, WHITE, 0, 0, platform.frame_width, platform.frame_height); fill_triangle(OP_SET, RED, 100, 100, 200, 100, 150, 200); fill_line(OP_SET, BLUE, 100, 300, 300, 500, 30); fill_ellipse(OP_SET, BLACK, x - 140, y - 100, 280, 200); p_render_frame(); } p_cleanup(); return 0; }