I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting.
This commit is contained in:
parent
84a5f06dac
commit
7186c2ecb0
16 changed files with 54 additions and 38 deletions
|
@ -219,7 +219,7 @@ namespace guecs {
|
|||
});
|
||||
}
|
||||
|
||||
bool UI::mouse(float x, float y) {
|
||||
bool UI::mouse(float x, float y, bool hover) {
|
||||
int action_count = 0;
|
||||
|
||||
$world.query<lel::Cell, Clickable>([&](auto ent, auto& cell, auto &clicked) {
|
||||
|
@ -227,10 +227,13 @@ namespace guecs {
|
|||
(y >= cell.y && y <= cell.y + cell.h))
|
||||
{
|
||||
if($world.has<Effect>(ent)) {
|
||||
auto& shader = $world.get<Effect>(ent);
|
||||
shader.run();
|
||||
auto& effect = $world.get<Effect>(ent);
|
||||
effect.$shader->setUniform("hover", hover);
|
||||
effect.run();
|
||||
}
|
||||
|
||||
if(hover) return; // kinda gross
|
||||
|
||||
if(auto action_data = get_if<ActionData>(ent)) {
|
||||
clicked.action(ent, action_data->data);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue