add testblock
This commit is contained in:
24
TextBlock.cpp
Normal file
24
TextBlock.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "TextBlock.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <GUI_Paint.h>
|
||||
|
||||
|
||||
//namespace myink { namespace ui {
|
||||
|
||||
TextBlock::TextBlock(const char * t, const TextBlockStyleProperties & s): text(t), style(s)
|
||||
{
|
||||
}
|
||||
|
||||
TextBlock::~TextBlock()
|
||||
{
|
||||
}
|
||||
|
||||
PositionalProperties TextBlock::draw(const PositionalProperties & p)
|
||||
{
|
||||
auto font = style.font;
|
||||
Paint_DrawString_EN(p.left, p.top, text, &font, style.background_color, style.font_color);
|
||||
return { p.left, p.top, strlen(text) * font.Width, font.Height};
|
||||
}
|
||||
|
||||
//}}
|
||||
Reference in New Issue
Block a user