add ui, change project struct

This commit is contained in:
Sheikah
2023-01-23 16:39:02 +08:00
parent 5f59f9412a
commit df4db6d8c4
150 changed files with 931 additions and 741 deletions

View File

@@ -0,0 +1,19 @@
#pragma once
#include <stdint.h>
typedef void (*mimg_FunctionSetPixel)(uint16_t x, uint16_t y, uint16_t color);
typedef struct mimg_Area
{
uint8_t x;
uint8_t y;
uint8_t w;
uint8_t h;
} mimg_Area;
/** get a pixel from img, return 1 or 0 */
uint8_t mimg_get_pixel(const uint8_t *img, uint16_t x, uint16_t y);
/** draw a part of img {ix, iy, iw, ih} , at (x, y) with color */
void mimg_draw(mimg_FunctionSetPixel set_pixel, uint16_t x, uint16_t y, uint16_t color, const uint8_t *img, mimg_Area area);
/** calc tile area */
mimg_Area mimg_get_tile_area(const uint8_t *img, uint8_t cols, uint8_t rows, uint8_t index);