From 7c9b9780124fab940b35fd2acde86d6fe6f81104 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 20 Oct 2023 13:18:38 +0100 Subject: [PATCH] add Display::statusf() --- display.cpp | 10 ++++++++++ display.h | 1 + 2 files changed, 11 insertions(+) diff --git a/display.cpp b/display.cpp index 1d07b83..17c7f22 100644 --- a/display.cpp +++ b/display.cpp @@ -1,3 +1,4 @@ +#include #include #include "hardware.h" #include "memory.h" @@ -150,6 +151,15 @@ void Display::status(const char *s) { #endif } +void Display::statusf(const char *fmt, ...) { + va_list args; + char buf[80]; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + status(buf); +} + void Display::drawPixel(unsigned x, unsigned y, colour_t col) { x += _xoff; y += _yoff; diff --git a/display.h b/display.h index 02e52da..9fd37be 100644 --- a/display.h +++ b/display.h @@ -34,6 +34,7 @@ public: void clear(); void status(const char *s); + void statusf(const char *fmt, ...); void drawPixel(unsigned x, unsigned y, colour_t col); void drawString(const char *s, unsigned x, unsigned y);