tophat2d / tophat

:tophat: a 2d game library for Umka
https://tophat2d.dev
BSD 3-Clause "New" or "Revised" License
72 stars 5 forks source link

Playground: Incorrect focus logic #146

Open vtereshkov opened 7 months ago

vtereshkov commented 7 months ago

Despite the fact that https://github.com/floooh/sokol/issues/822 is now closed, it has not resolved our problems with the moving rectangle example in the web playground:

  1. When I build tophat with the official Sokol, the text area doesn't receive any keystrokes at all -- they are all caught by the example window.

  2. When I return false from _sapp_emsc_key_cb(), all keys are caught by both the text area and the example window

Built with Emscripten 3.1.10.

skejeton commented 7 months ago

When we were having issues with SAVESCUM de-focusing I applied quick fix so that every time you resize and click the window, it will focus on the canvas.

If you use the shell.html from tophat - that is the reason.

vtereshkov commented 7 months ago

@skejeton Do you mean we need to implement switching the input focus between the text area and the example window? Are you sure this is possible with the official Sokol? Great if it is. But your SaveScum build was using a customized Sokol fork.

marekmaskarinec commented 7 months ago

I did some changes to the playground and I can now finally recreate your issue.

marekmaskarinec commented 7 months ago

I found the issue: the newly added event bubble up options were not enabled by tophat. I fixed this in the recent commit. Now it is possible to use the text box. However the issue with both the text box and the game catching the inputs is still there. This issue will require some more work.

marekmaskarinec commented 7 months ago

The new playground is now uploaded to the website.

vtereshkov commented 7 months ago

I tested the moving rectangle example with the latest version. The only problem is that the WASD keys, when entered in the text area, are also caught by the example window. This is a slightly annoying bug, but not a release blocker,