Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store all input Events between updates so that they can be inspected by Widgets #569

Closed
mitchmindtree opened this issue Sep 29, 2015 · 13 comments

Comments

@mitchmindtree
Copy link
Contributor

Right now, Widgets can only check the present state of the Mouse. It would probably be more useful to store each of the input events that have occurred between each update in a single buffer along with methods for quickly filtering through it in useful ways.

This would also allow for fixing #384 .

@bvssvni
Copy link
Member

bvssvni commented Sep 29, 2015

Is it possible to store E: GenericEvent?

I guess this will be a problem if people are calling Conrod with two different types of events.

@bvssvni
Copy link
Member

bvssvni commented Oct 30, 2015

We could map events back to Input and store them in a Vec<Input>.

@mitchmindtree
Copy link
Contributor Author

@bvssvni yeah I was imagining a Vec<Input> :)

Perhaps in a wrapper type that offers a collection of methods yielding different useful iterators over the kinds of input events?

@bvssvni
Copy link
Member

bvssvni commented Oct 31, 2015

Can we do this in a loop in set_widget? It seems possible to call Widget::update multiple times.

@mitchmindtree
Copy link
Contributor Author

@bvssvni hmm I'm not sure what you mean?

I think it might be a bit too expensive to call Widget::update multiple times in a loop, as some widgets might have complex updates. Then again, I guess it would hardly ever get called more than once as it would be rare to have more than one or two Input events between updates.

I imagined the Ui would store the Vec<Input> and each time Ui::handle_event is called with an Input, it would add the event to the stack. The Vec<Input> would be reset between updates.

The widgets would receive a view of this Vec<Input> (perhaps via the wrapper type providing helper methods as described in my previous comment) within the UserInput type that is given via the UpdateArgs when Widget::update is called. That way each time a widget's update is called, it just handles the events that happened since its last update.

@bvssvni
Copy link
Member

bvssvni commented Oct 31, 2015

The behavior of a widget should not depend on which partition of events it received. For example, if the widget capturing the mouse is determined in set_widget, then it can't change in Widget::update.

@mitchmindtree
Copy link
Contributor Author

hmm I'm still not following? The widget that's capturing the mouse is currently determined within the Widget::update, i.e. here.

@bvssvni
Copy link
Member

bvssvni commented Oct 31, 2015

Ok.

@bvssvni
Copy link
Member

bvssvni commented Nov 1, 2015

@mitchmindtree I am trying to get up to speed on the source. Are you on IRC?

@mitchmindtree
Copy link
Contributor Author

@bvssvni sorry I missed you! I've been busy with work as well as a masters proposal :) I'll try and hang about IRC tonight in case you still want to discuss 👍

@bvssvni
Copy link
Member

bvssvni commented Nov 2, 2015

@mitchmindtree Thanks! Of course you should prioritize your master degree...

@bvssvni
Copy link
Member

bvssvni commented Nov 2, 2015

@mitchmindtree The thing I want to talk about is the details around the event logic. I understand what is happening but not enough to plan changes.

@mitchmindtree
Copy link
Contributor Author

Closed by #684.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants