Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Plan: how to implement input processing #11

Open
keesvandieren opened this issue Nov 16, 2020 · 2 comments
Open

Plan: how to implement input processing #11

keesvandieren opened this issue Nov 16, 2020 · 2 comments
Assignees

Comments

@keesvandieren
Copy link
Collaborator

keesvandieren commented Nov 16, 2020

How can we implement input?

  • can we reuse GWT implementation?
  • what are bytecoder specifics we need to take care of?
  • how much work is the minimal implementation?
  • Focus first on mouse clicks / tabs, keyboard input lower prio for us
@yuripourre
Copy link
Contributor

yuripourre commented Jun 26, 2021

I think GWT can be used as a basis. It can copy the hookEvents method from DefaultGwtInput

 val w = Window.window()
 val d = w.document()
 d.addEventListener("mousemove", this);
 d.addEventListener("mousedown", this);
 d.addEventListener("mouseup", this);
 d.addEventListener("keyup", this);
//...

The BytecoderInput class should implement EventListener<Event> and inside the run method, check the type of the event and cast them for specific usage (just like gwt implementation is doing).

The steps would be:

  • Add type to event (Merged)
  • Add button to MouseEvent (Merged)
  • Add key and code to KeyboardEvent (Merged)
  • Create MouseWheel event (Merged)
  • Update BytecoderInput adding hookEvents method
  • Think about how to handle events outside the canvas element (calculate relative positions, handle focus, etc).

@yuripourre
Copy link
Contributor

@keesvandieren @CoenRijsdijk I updated my comment to reflect the current state of Bytecoder. I added a task list that can work as a plan.

What do you think?

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

No branches or pull requests

3 participants