Add: snake game! (basics)

This commit is contained in:
xamidev
2024-09-12 17:54:30 +02:00
parent 8093880eaa
commit 40561a6537
9 changed files with 206 additions and 6 deletions

View File

@@ -39,6 +39,25 @@ void draw_cursor(uint32_t color)
}
}
void draw_pixel(int x, int y, uint32_t color) //high level wrapper for putpixel
{
putpixel(framebuffer, scanline, 32, x, y, color);
}
void draw_square(int x, int y, uint32_t color, int size)
{
int startx = x*size;
int starty = y*size;
for (int i=0; i<size; i++)
{
for (int j=0; j<size; j++)
{
draw_pixel(startx+i, starty+j, color);
}
}
}
void erase_cursor()
{
draw_cursor(black);

View File

@@ -22,8 +22,10 @@
void draw_cursor(uint32_t color);
void erase_cursor();
void move_cursor(int x, int y);
void draw_pixel(int x, int y, uint32_t color);
void draw_square(int x, int y, uint32_t color, int size);
void putchar(unsigned short int c, int x, int y, uint32_t fg, uint32_t bg);
void puts(const char* str);
void clear(void);