more demo stuff

This commit is contained in:
2022-12-28 23:04:59 +01:00
parent ab4119a1a9
commit 21a04135b6
3 changed files with 150 additions and 21 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ void fb_invert()
void fb_px(fbpos_t x, fbpos_t y, fbcolor_t color)
{
if (x >= FBW || y >= FBH) { return; }
if (x >= FBW || y >= FBH || x < 0 || y < 0) { return; }
const fbpos_t row = y / 8;
const fbpos_t rowrem = y % 8;
const fbsize_t cell = (fbsize_t) x + (fbsize_t) row * FBW;
+6 -6
View File
@@ -16,9 +16,9 @@
/// Width/height type
typedef uint16_t fbsize_t;
/// Position type (X/Y)
typedef uint8_t fbpos_t;
typedef int16_t fbpos_t;
/// Color type
typedef uint8_t fbcolor_t;
typedef uint8_t fbcolor_t;
/// Bitmap struct
typedef struct {
@@ -88,12 +88,12 @@ void fb_frame(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, fbpos_t thickness, fbc
/// Draw a bitmap using the bitmap struct
#if IS_AVR
static inline void fb_bitmap_P(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap) {
fb_bitmap_ex_P(x, y, bitmap->width, bitmap->height, bitmap->data, 1);
static inline void fb_bitmap_P(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap, fbcolor_t color) {
fb_bitmap_ex_P(x, y, bitmap->width, bitmap->height, bitmap->data, color);
}
#else
static inline void fb_bitmap(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap) {
fb_bitmap_ex(x, y, bitmap->width, bitmap->height, bitmap->data, 1);
static inline void fb_bitmap(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap, fbcolor_t color) {
fb_bitmap_ex(x, y, bitmap->width, bitmap->height, bitmap->data, color);
}
#endif