Conversation
…t, and PWA support (Closes Bitcoindefi#21) Signed-off-by: waterWang <water.wang@users.noreply.github.com>
6 tasks
leocagli
requested changes
Sep 16, 2026
leocagli
left a comment
Collaborator
There was a problem hiding this comment.
Gracias, la decision central esta bien: el joystick entra por movementPressCountsRef / movementKeyPriorityRef con los mismos keycodes que usa el teclado, sin KeyboardEvent sinteticos, asi que no lo bloquea el chequeo de isTrusted. Pero todavia no cumple los criterios de aceptacion de #21 y hay bugs concretos:
- El aviso de rotar nunca se muestra.
LandscapePrompttienedisplay: "none"inline, y un estilo inline le gana a la regla deglobals.css. Ademas la regla es.game-shell .mobile-landscape-overlay, pero el componente se renderiza enplay/page.tsxfuera de.game-shell, asi que el selector tampoco matchea. - El layout no se adapto. El problema principal del issue (el layout exige unos 1050 px) sigue igual:
.game-shell canvas { width: auto; max-width: 100vw }no reorganiza el HUD ni el panel derecho. En un telefono de 390 px el contenido sigue recortado. - El joystick no es flotante. Queda fijo abajo a la izquierda. El issue pide que aparezca donde se apoya el dedo.
- La perilla arranca descentrada. Combina
translate(-50%, -50%)conmarginLeft/marginTop: -20, se desplaza dos veces y salta al primer toque. - Falta alcance: botones tactiles de ataque y hechizos, long press como click derecho, y la prueba en un telefono real (Android e iOS), que es el primer criterio.
maximumScale: 1yuserScalable: falseen ellayout.tsxraiz afectan a todo el sitio, incluida la landing. Mejor limitarlo a/play.
Pedido: corregir 1, 3 y 4, resolver el layout (2) y sumar lo que falta del punto 5, con capturas o video desde un telefono real en el PR. Si preferis entregar por partes, decilo en el issue y lo dividimos, pero este PR no puede cerrar #21 tal como esta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds mobile support so the game can be played from a phone (Closes #21).
What's included
Joystick.tsx): bottom-left virtual stick that reports angle + force via touch events.useTouchGameplay.ts): converts joystick angle into the engine's KEY_CODES and updatesmovementPressCountsRef/movementKeyPriorityRefdirectly — the same refs the keyboard hook uses — sosyncMovementStateworks correctly. This deliberately bypasses the synthetic-keyboard-event path which the client rejects viaisTrusted(documented in the issue).max-width: 100vw / max-height: 100vhon screens ≤768px, keeping aspect ratio (canvas scales via CSS exactly like fullscreen mode already does; no camera/culling changes needed).LandscapePrompt.tsx): overlay shows when the device is in portrait orientation (≤768px), prompting the user to rotate to landscape.viewportexport inlayout.tsx(viewport-fit: cover,user-scalable: no) andorientation: "landscape"added to the existing manifest.@media (pointer: coarse)), so desktop is completely unchanged.Files changed
frontend/components/game/input/Joystick.tsx(new)frontend/components/game/input/LandscapePrompt.tsx(new)frontend/components/game/core/useTouchGameplay.ts(new)frontend/components/game/core/MapRendererCore.tsx(wire joystick + hook)frontend/app/layout.tsx(viewport export)frontend/app/manifest.ts(orientation: landscape)frontend/app/globals.css(mobile media queries)frontend/app/play/page.tsx(landscape prompt)Acceptance criteria addressed
pointer: finehides the joystick; no key handling touched)Notes
syncMovementState→ enginemoveTo()→ server. No synthetic KeyboardEvents are created, so the anti-botisTrustedcheck is never triggered.