From 5625a8626fe303748b205c80f87035593cf2f561 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Fri, 8 May 2026 19:30:44 -0400 Subject: Initial commit --- dc/dc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 dc/dc.c (limited to 'dc/dc.c') diff --git a/dc/dc.c b/dc/dc.c new file mode 100644 index 0000000..5b4b435 --- /dev/null +++ b/dc/dc.c @@ -0,0 +1,99 @@ +#include + +#include +#include +#include + +#define SCREEN_WIDTH 256 +#define SCREEN_HEIGHT 256 + +#define TILE_SIZE 16 + +int main(void) +{ + struct ty_creation_hints hints = { + .win_width = SCREEN_WIDTH, + .win_height = SCREEN_HEIGHT, + .win_title = "Demonchime", + .ticrate = 30, + }; + ty_init(hints); + +#define Y TY_COLOR_YELLOW +#define B TY_COLOR_BLACK +#define M TY_COLOR_MAGENTA + struct ty_color img_data[] = { + M, Y, Y, Y, Y, M, + Y, Y, Y, Y, Y, Y, + Y, B, Y, Y, B, Y, + Y, Y, Y, Y, Y, Y, + Y, B, B, B, B, Y, + M, Y, Y, Y, Y, M, + }; +#undef Y +#undef B +#undef M + + struct ty_image img = ty_create_image(6, 6, img_data); + + while (ty_is_game_running()) { + ty_draw_clear(TY_COLOR_BLACK); + + ty_draw_image(img, ty_vec2i(200, 200)); + + ty_draw_image_ex( + img, + (struct ty_recti){ + 0, 0, + 6, 6, + }, + (struct ty_recti){ + 100, 200, + img.width*12, img.height*6, + } + ); + + ty_draw_rect( + (struct ty_recti){ + SCREEN_WIDTH*0.5 + sin(ty_get_time() * 10) * 50 - 25, + SCREEN_HEIGHT*0.5-25, + 50, 50, + }, + TY_COLOR_RED + ); + + ty_draw_line( + ty_vec2i(0, 0), + ty_vec2i(100, 100), + ty_color(0xFF, 0xF0, 0x80) + ); + + ty_draw_line( + ty_vec2i(100, 0), + ty_vec2i(0, 100), + ty_color(0x80, 0xF0, 0xFF) + ); + + ty_draw_line( + ty_vec2i(150, 0), + ty_vec2i(150, 100), + ty_color(0x80, 0xF0, 0xFF) + ); + + ty_draw_line( + ty_vec2i(100, 50), + ty_vec2i(200, 50), + ty_color(0xFF, 0xF0, 0x80) + ); + + ty_draw_end(); + ty_tick(); + + usleep(1000000 / (hints.ticrate * 2)); + } + + ty_free_image(img); + + ty_deinit(); + return 0; +} -- cgit v1.3-2-g0d8e