mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 19:49:58 +02:00
[kandinsky] KDContext::drawString can take a max length
Change-Id: I59cf0c1fbfb2288ab54905a4fd2558885c279814
This commit is contained in:
@@ -27,11 +27,13 @@ void KDContext::drawChar(char character, KDPoint p, KDText::FontSize size, KDCol
|
||||
characterBuffer);
|
||||
}
|
||||
|
||||
void KDContext::drawString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor) {
|
||||
void KDContext::drawString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, int maxLength) {
|
||||
KDPoint position = p;
|
||||
int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH;
|
||||
KDPoint characterSize(characterWidth, 0);
|
||||
while(*text != 0) {
|
||||
|
||||
const char * end = text+maxLength;
|
||||
while(*text != 0 && text != end) {
|
||||
drawChar(*text, position, size, textColor, backgroundColor);
|
||||
text++;
|
||||
position = position.translatedBy(characterSize);
|
||||
|
||||
Reference in New Issue
Block a user