Fixed two bugs in Effect. 1. The shaders weren't being applied to everything, only shapes. 2. The Textual components were getting a not-shape shader but should be shapes.

main
Zed A. Shaw 12 hours ago
parent adc192c6dc
commit cf3da32681
  1. 2
      demos/calc.cpp
  2. 2
      include/guecs/ui.hpp
  3. 2
      src/guecs/ui.cpp

@ -157,13 +157,13 @@ struct CalculatorUI {
auto& label = LABELS.at(name);
$gui.set<guecs::Rectangle>(id, {});
$gui.set<guecs::Effect>(id, {});
if(name == "readout") {
$gui.set<guecs::Textual>(id, {L"", 40});
} else if(name == "stack") {
$gui.set<guecs::Textual>(id, {L"", 20});
} else {
$gui.set<guecs::Effect>(id, {});
$gui.set<guecs::Label>(id, { label });
wchar_t op = label[0];
$gui.set<guecs::Clickable>(id, {

@ -213,7 +213,7 @@ namespace guecs {
sf::Shader *shader_ptr = nullptr;
if(auto shader = get_if<Effect>(ent)) {
if(shader->$active && !is_shape) {
if(shader->$active) {
auto ptr = shader->checkout_ptr();
ptr->setUniform("is_shape", is_shape);
// NOTE: this is needed because SFML doesn't handle shared_ptr

@ -124,7 +124,7 @@ namespace guecs {
});
query<Textual>([&](auto ent, auto& text) {
render_helper(window, ent, true, text.text);
render_helper(window, ent, false, text.text);
});
}

Loading…
Cancel
Save