Commit Graph

16 Commits

Author SHA1 Message Date
Hajime Hoshi
a786f23e28 cmd/ebitenmobile: add comments 2024-09-09 20:55:03 +09:00
Hajime Hoshi
2a4374e012 cmd/ebitenmobile: remove setStrictContextRestoration from EbitenViewController 2024-09-09 18:05:18 +09:00
Hajime Hoshi
7cc2f8ffcd cmd/ebitenmobile: add comments 2024-09-09 17:41:17 +09:00
Hajime Hoshi
07d29fa729 cmd/ebitenmobile: bug fix: consider EbitenSurfaceView recreation
On Android Emulator (Small Desktop API 32), EbitenRenderer can be
easily recreated by resizing the window. Thus, EbitenRenderer should
not have any flags like strictContextRestoration. Also, the flag
onceSurfaceCreated_ doesn't work there.
2024-09-09 16:42:57 +09:00
Hajime Hoshi
fcef0a7c29 cmd/ebitenmobile: call setPreserveEGLContextOnPause(true) whatever the option is
We found that an app freezes for a little while when resuming it.
In order to improve user experience, always use
setPreserveEGLContextOnPause(true) whichever StrictContextRestoration is
true or false.
2024-09-09 15:20:04 +09:00
Hajime Hoshi
35f4884a74 ebiten: add RunGameOptions.StrictContextRestration
This reverts commit a30f075896.

This change adds a new option StrictContextRestration to make the
restoration optional.

Closes #3083
2024-09-07 18:36:04 +09:00
Hajime Hoshi
b7dd45c0e4 internal/gamepad: ignore the very first MotionEvent with 0 value for Android
On Android, MotionEvent with 0 values might come for axes when connecting
a gamepad, even though a user didn't touch any axes. This is problematic
especially for tirgger axes, where the default value should be -1.

This change fixes the issue by adding a new state `axesReady` to check
if an axis is really touched or not. If an axis is not touched yet,
a button value for a standard (trigger) button always returns 0.

This change also removes an old hack to initialize axis values for
triggers.

Closes #2598
2024-03-21 22:28:48 +09:00
Hajime Hoshi
a30f075896 cmd/ebitenmobile: use setPreserveEGLContextOnPause(true)
setPreserveEGLContextOnPause(true) suppresses context losts, and
basically we will no longer need our restoring logic.

Updates #805
2024-01-08 20:13:13 +09:00
bsski
b8df1217c3
all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi
a3ff5f283b cmd/ebitenmobile: bug fix: accessing a view property caused deadlock on iOS
This change delays the initialization of the view until viewDidLoad is
called AND mobile.SetGame is called.

Closes #2768
2023-09-21 19:18:01 +09:00
divVerent
1789f509e1
mobile/ebitenmobileview: add iOS Keyboard support. (#2678)
Closes #1090
2023-06-24 05:00:13 +09:00
Hajime Hoshi
dd393b6f21 cmd/ebitenmobile: update GLES version to 3.0
GLES 3.0 is required for GLSL ES 3.0

Updates #1431
2023-04-19 22:49:35 +09:00
divVerent
10c1b56e62
cmd/ebitenmobile: fix Xbox-ish gamepad axis assignment (#2596)
This commit mirrors https://github.com/libsdl-org/SDL/pull/7405
(6f1f586086).

Note that for SDL, this code is used a lot less than for Ebitengine, as SDL
mostly migrated to HIDAPI and direct USB device access rather than using
Android's APIs. For Bluetooth devices, however, the Java APIs are used the
same way.

This was the remaining problem to be solved to automatically support standard
layout on most standard gamepads (this should cover most Xbox-ish and PS-ish
gamepads on the market).

In particular this covers gamepads with the following assignment:

- Left stick = X/Y, right stick = Z/RZ, triggers = LEFTTRIGGER/RIGHTTRIGGER
  (which basically is what Android docs say and some PS gamepads do)

- Left stick = X/Y, right stick = RX/RY, triggers = Z/RZ
  (Xbox gamepad style, apparently)

- Left stick = X/Y, right stick = RX/RY, triggers = LEFTTRIGGER/RIGHTTRIGGER
  (Not sure if this exists, but it's conceivable)

As we found on the SDL pull request discussion, gamepads that offer flight
controls (e.g. THROTTLE and RUDDER) will likely not work well, before and
after this change.

Closes #2557
2023-03-12 22:32:30 +09:00
Hajime Hoshi
0756be0b68 cmd/ebitenmobile: use an independent thread for rendering on iOS
Closes #2508
2022-12-28 23:37:13 +09:00
Hajime Hoshi
7d146fb70b internal/ui: bug fix: IsGL / SetUIView can be called before initialization is done
The functions in the package `mobile/ebitenmobileview` could be invoked
from EbitenViewController even before the graphics driver initialization
is done in theory.

This change fixes this issue by waiting the initialization by
channels. Also, this change adds error handlings at these functions.

Closes #2455
2022-11-15 01:53:20 +09:00
Artem Yadelskyi
7bf822bdb1
cmd/ebitenmobile: use go:embed (#2435)
Closes #2410
2022-11-04 17:20:21 +09:00