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

Add a way to inject events into the stream. #650

Open
bwinton opened this issue Aug 23, 2020 · 3 comments
Open

Add a way to inject events into the stream. #650

bwinton opened this issue Aug 23, 2020 · 3 comments
Labels
enhance-feature Create a new user-facing feature subsystem-input

Comments

@bwinton
Copy link

bwinton commented Aug 23, 2020

Describe the problem you want to solve
So, using stdweb, I have some controls outside of the canvas, and I would like my app to respond to them when they change. I started by trying to keep circular references between the desktop or web config objects and the main game object, but of course they can't both own each other, so that didn't work out so well. My next thought was to add event listeners in Rust, and try and send a keyboard event to the canvas which I could respond to in my app, but that also didn't work (it couldn't seem to make it all the way from webstd through winit through blinds through quicksilver to my function. I'm not sure why).

I ended up just checking the state of the controls every time through the loop, but that feels less elegant than reacting when they change.

Describe the solution you'd like
Some way to create and push events into the Input passed to the async function would have made this a little easier.

Are you interested in contributing?
I think I have a workaround, and I still don't have a ton of time, so I don't think I'll be able to fix this myself.

@ryanisaacg
Copy link
Owner

You should be able to create a queue of your own events and check that in your loop somewhere, no?
My instinct is to keep the Input event source solely focused on events that come into your code from system input, both for simplicity and correctness's sake.

@ryanisaacg ryanisaacg added enhance-feature Create a new user-facing feature subsystem-input labels Aug 26, 2020
@bwinton
Copy link
Author

bwinton commented Aug 26, 2020

In theory, yes. In practice, I fought the borrow checker for half an hour or so trying to get that working before giving up and filing a bug report. 😉 (Also, it's admittedly a little uglier to have to check two separate queues for events. I suppose I could filter all the Input events into my queue, and only check the one, but that also feels a little weird…)

Having said that, if you wanted to resolve this "WONTFIX", I would totally understand. 🙂

@ryanisaacg
Copy link
Owner

I'm not morally opposed to it, but my first instinct is to push people towards solutions that don't involve threading their events through Quicksilver's internals. I will be thinking about a design that allows for passing user events without adding complexity, and I'll see what I come up with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhance-feature Create a new user-facing feature subsystem-input
Projects
None yet
Development

No branches or pull requests

2 participants