fix bitmap drawing, align number picker screen to center

This commit is contained in:
2020-01-12 13:21:39 +01:00
parent 8a2fe2a18b
commit 9b604aab4e
3 changed files with 64 additions and 7 deletions
+4 -3
View File
@@ -1,9 +1,10 @@
#include <malloc.h>
#include <stdio.h>
#include "scenes.h"
#include "liquid.h"
#include "graphics/drawing.h"
#include "scene_number.h"
#include "graphics/display_spec.h"
struct NumberScene {
struct Scene base;
@@ -40,11 +41,11 @@ static void paint(struct NumberScene *self)
struct NumberSceneOpts *opts = self->opts;
LCD_clearDisplay(0);
LCD_setStrEx(opts->label, 1, 1, BLACK, (struct TextStyle) {.size = FONT_BOLD});
LCD_setStrEx(opts->label, LCD_WIDTH/2, 1, BLACK, (struct TextStyle) {.size = FONT_BOLD, .align=ALIGN_CENTER});
char buf[10];
snprintf(buf, 10, "%d%s", opts->value, opts->unit);
LCD_setStrEx(buf, 1, 9, BLACK, (struct TextStyle) {.size = FONT_DOUBLE});
LCD_setStrEx(buf, LCD_WIDTH/2, 14, BLACK, (struct TextStyle) {.size = FONT_DOUBLE, .align=ALIGN_CENTER});
}
static void deinit(struct NumberScene *self)