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

main
Zed A. Shaw 2 weeks 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) { [&](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;
}
} }
}); });
} }

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

Loading…
Cancel
Save