Can now copy character codes.

main
Zed A. Shaw 1 month ago
parent ffc787df64
commit e863bfa2fe
  1. 9
      tools/designer.cpp

@ -186,12 +186,12 @@ class GUI {
$bg_color.v_slider = Slider("BG V:", &$bg_color.v, 0, 255, 1); $bg_color.v_slider = Slider("BG V:", &$bg_color.v, 0, 255, 1);
$status_ui.set_renderer(Renderer([&]{ $status_ui.set_renderer(Renderer([&]{
wchar_t fill_char = $font_grid.as_wchar($fill_char); wchar_t selected_char = $font_grid.as_wchar($fill_char);
return hbox({ return hbox({
hflow( hflow(
vbox( vbox(
text(format("\\u{:x} {} IDX: {}, MIN: {}, MAX: {}", int(fill_char), int(fill_char), $fill_char, WCHAR_MIN, WCHAR_MAX)) | border, text(format("\\u{:x} {} IDX: {}, MIN: {}, MAX: {}", int(selected_char), int(selected_char), $fill_char, WCHAR_MIN, WCHAR_MAX)) | border,
separator(), separator(),
text(format("FG H: {}, S: {}, V: {}", text(format("FG H: {}, S: {}, V: {}",
$fg_color.h, $fg_color.s, $fg_color.v)) | border, $fg_color.h, $fg_color.s, $fg_color.v)) | border,
@ -254,6 +254,11 @@ class GUI {
render_grid($start_char, false); render_grid($start_char, false);
event_happened = true; event_happened = true;
$renderer.clear_cache(); $renderer.clear_cache();
} else if(event.key.code == KB::C && event.key.control) {
wchar_t selected_char = $font_grid.as_wchar($fill_char);
string out = format("\\u{:x}", int(selected_char));
println("COPIED {}", out);
sf::Clipboard::setString(out);
} else if(KB::isKeyPressed(KB::Down)) { } else if(KB::isKeyPressed(KB::Down)) {
$start_char = std::min($font_grid.max_chars() - page_size, $start_char + page_size); $start_char = std::min($font_grid.max_chars() - page_size, $start_char + page_size);
render_grid($start_char, false); render_grid($start_char, false);

Loading…
Cancel
Save