Depend on graphics.h.

This commit is contained in:
Simon Forman 2023-02-26 13:24:34 -08:00
parent dbc2fe5854
commit d7db105bc8
2 changed files with 3 additions and 4 deletions

View File

@ -7,7 +7,7 @@ UVM_VM=$(UVM)/vm
run: $(UVM_NCC)/out.asm
cd $(UVM_VM) ; cargo run $(UVM_NCC)/out.asm
$(UVM_NCC)/out.asm: $(UVM_JOY)/xerblin.c $(UVM_JOY)/font/font.h
$(UVM_NCC)/out.asm: $(UVM_JOY)/xerblin.c $(UVM_JOY)/graphics.h $(UVM_JOY)/font/font.h
cd $(UVM_NCC) ; cargo run $(UVM_JOY)/xerblin.c
$(UVM_JOY)/font/font.h:

View File

@ -4,12 +4,11 @@ draw_background(u32* buffer, size_t w, size_t h)
{
for (size_t x = 0; x < w; ++x) {
for (size_t y = 0; y < h; ++y) {
u32* pix_ptr = frame_buffer + w * y + x;
u8 blue = x & 255;
u8 green = y & 255;
u8 red = (x + y + 128) & 255;
u8 alpha = 123;
*pix_ptr = (alpha << 24) | (red << 16) | (green << 8) | blue;
u32* pix_ptr = buffer + w * y + x;
*pix_ptr = (red << 16) | (green << 8) | blue;
}
}
}