|
|
@ -122,29 +122,32 @@ void SFMLRender::render_grid(const std::wstring &text, float x, float y) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
[&](wchar_t tile) { |
|
|
|
[&](wchar_t tile) { |
|
|
|
if(tile == '\n') { |
|
|
|
switch(tile) { |
|
|
|
// don't bother processing newlines, just skip
|
|
|
|
case '\r': break; // ignore it
|
|
|
|
y += $line_spacing; |
|
|
|
case '\n': { |
|
|
|
x = start_x; |
|
|
|
// don't bother processing newlines, just skip
|
|
|
|
} else if(tile == L'\r') { |
|
|
|
y += $line_spacing; |
|
|
|
return; // skip these, just windows junk
|
|
|
|
x = start_x; |
|
|
|
} else { |
|
|
|
} |
|
|
|
$bg_sprite.setPosition({x, y}); |
|
|
|
break; |
|
|
|
|
|
|
|
default: { |
|
|
|
// only get a new sprite if the tile changed
|
|
|
|
$bg_sprite.setPosition({x, y}); |
|
|
|
if(last_tile != tile) { |
|
|
|
|
|
|
|
last_tile = tile; // update last tile seen
|
|
|
|
// only get a new sprite if the tile changed
|
|
|
|
sprite = get_text_sprite(tile); |
|
|
|
if(last_tile != tile) { |
|
|
|
configure_tile(sprite, sp_bounds, $bg_bounds, width_delta, height_delta); |
|
|
|
last_tile = tile; // update last tile seen
|
|
|
|
} |
|
|
|
sprite = get_text_sprite(tile); |
|
|
|
|
|
|
|
configure_tile(sprite, sp_bounds, $bg_bounds, width_delta, height_delta); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sprite.setPosition({x+width_delta, y+height_delta}); |
|
|
|
sprite.setPosition({x+width_delta, y+height_delta}); |
|
|
|
sprite.setColor(cur_fg); |
|
|
|
sprite.setColor(cur_fg); |
|
|
|
|
|
|
|
|
|
|
|
$window.draw($bg_sprite); |
|
|
|
$window.draw($bg_sprite); |
|
|
|
$window.draw(sprite); |
|
|
|
$window.draw(sprite); |
|
|
|
// next cell
|
|
|
|
// next cell
|
|
|
|
x += $base_glyph.advance; |
|
|
|
x += $base_glyph.advance; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|