mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
text-wrapping + fix
This commit is contained in:
parent
37e089169e
commit
56a8226028
9 changed files with 135 additions and 54 deletions
|
|
@ -34,8 +34,12 @@ bool Font::isPrintableChar(uint codepoint) const {
|
|||
}
|
||||
}
|
||||
|
||||
int Font::calcWidth(std::wstring text, size_t length) {
|
||||
return std::min(text.length(), length) * 8;
|
||||
int Font::calcWidth(const std::wstring& text, size_t length) {
|
||||
return calcWidth(text, 0, length);
|
||||
}
|
||||
|
||||
int Font::calcWidth(const std::wstring& text, size_t offset, size_t length) {
|
||||
return std::min(text.length()-offset, length) * 8;
|
||||
}
|
||||
|
||||
void Font::draw(Batch2D* batch, std::wstring text, int x, int y) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue