A bit more cleanup of render but kind of stuck on what to do further.

main
Zed A. Shaw 1 month ago
parent 7cb03594a3
commit c8fa68815b
  1. 45
      render.cpp
  2. 1
      status.txt

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

@ -1,6 +1,5 @@
TODAY'S GOAL:
* Clean up renderer.
* panels and everything except renderer should use character coodinates
* Image -> Text converter.

Loading…
Cancel
Save