151 Commits

Author SHA1 Message Date
Hajime Hoshi efab369512 all: go fix 2026-03-15 17:46:48 +09:00
Hajime Hoshi f0d5e9a26f cmd/ebitenmobile: add ConfigChooserWithFallback
Closes #2740
2026-01-18 19:01:04 +09:00
Hajime Hoshi c9dcb04d44 cmd/ebitenmobile: fix unnecesasry syntax errors in Java and Objective-C files 2026-01-18 17:49:20 +09:00
Hajime Hoshi 21391b08bd cmd/ebitenmobile: add EbitenView.saveGPUResources and areGPUResourcesSaved
Closes #3372
2026-01-14 22:35:22 +09:00
Hajime Hoshi f2ee34c8eb ebiten: remove RunOptions.StrictContextRestoration
Updates #3090
2025-11-23 16:22:29 +09:00
Hajime Hoshi 2ce2a82c14 cmd/ebitenmobile: add an option to save GPU resources at suspendGame
This is a kind of partial revert of suspendGame, as now saving GPU
resources at suspendGame is not done by default. It's because saving
GPU resouces could cause ANRs. A developer can do saving by passing
true at suspendGame explicitly.

Updates #3334
2025-11-12 17:43:19 +09:00
Hajime Hoshi 990db0b609 cmd/ebitenmobile: bug fix: compilation failure EbitenSurfaceView.java 2025-11-02 15:53:35 +09:00
Hajime Hoshi 90856311d2 cmd/ebitenmobile: do not call saveGPUResources when onPause is already called
Updates #3334
2025-11-02 15:02:20 +09:00
Hajime Hoshi 371607544a cmd/ebitenmobile: save GPU resources at onPause and restore GPU resources on context lost
This change adds a logic to save GPU resources at GLSurfaceView.onPause
as a precaution, and restore GPU resources from it when a context lost
happens. This can fix issues where a context lost often occurs when an
interstitial ad is shown.

This change doesn't add any new APIs and do this resource reservation
automatically.

Closes #3215
2025-10-10 16:26:56 +09:00
Hajime Hoshi 55bb572a27 inpututil: bug fix: {Key,MousePress}KeyDuration returned a wrong value on browsers and mobiles
Closes #3322
2025-09-26 22:33:54 +09:00
Hajime Hoshi 20872c1bd0 cmd/ebitenmobile: fix comments 2025-08-17 12:58:04 +09:00
Jordan Philyaw 2bde67558e cmd/ebitenmobile: delete unused goEnv func (#3281)
Updates #2436
2025-07-29 12:53:01 +09:00
corfe83 d1ee7797c7 cmd/ebitenmobile: fix gomobile toolchain bug (#3129)
Closes #3128
2024-10-15 04:01:07 +09:00
Hajime Hoshi f63a757b1e cmd/ebitenmobile: bug fix: need toolchain for the temporary go.mod
Updates #3086
2024-09-14 01:01:01 +09:00
Hajime Hoshi c077ad70fd cmd/ebitenmobile: bug fix: graceful shutdown on context lost
Closes #3097
2024-09-13 12:06:25 +09:00
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 c658a25171 all: replace execabs with os/exec
os/exec no longer searches executablse in the current directory as of
Go 1.19. See https://go.dev/blog/path-security and https://go.dev/issue/43724.
2024-05-03 23:39:38 +09:00
Hajime Hoshi 013e235628 cmd/ebitenmobile, exp/textinput: typo 2024-03-27 15:40:37 +09:00
Hajime Hoshi 5c0c084b6e cmd/ebitenmobile: update the default Android SDK version to 21 2024-03-27 14:23:00 +09:00
Hajime Hoshi 25a814d561 cmd/ebitenmobile: bug fix: wrong path was used
Updates #2937
2024-03-27 12:30:12 +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 732eedf2e0 all: use github.com/ebitengine/gomobile instead of golang.org/x/mobile
Closes #2748
Closes #2899
2024-02-24 22:07:27 +09:00
Hajime Hoshi cf393fc56e cmd/ebitenmobile: update comments 2024-01-28 16:06:02 +09:00
Hajime Hoshi 5f7c7dbac6 cmd/ebitenmobile: check the Java package before an execution
Closes #2894
2024-01-28 15:52:16 +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 d6439c9e6c cmd/ebitenmobile: bug fix: failed to resolve dependencies
Something was changed by updating gomobile (76ac6878050a2eef81867f2c6c21108e59919e8f),
and an additional go-mod-tidy is now required.
2023-12-16 19:52:00 +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
(https://github.com/libsdl-org/SDL/commit/6f1f586086a18ab32ddccc05e4616aac02774a1b).

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
Pierre Curto 4de807cc44 all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +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
Artem Yadelskyi 5b53cef59e all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi 8aacf067dd all: use x/sys/execabs instead of os/exec
Closes #2418
2022-11-01 23:36:57 +09:00
Hajime Hoshi 62cbe99a27 cmd/ebitenmobile: bug fix: dead lock due to @synchronized
Closes #2407
2022-10-25 13:37:34 +09:00
Hajime Hoshi 4864814d78 cmd/ebitenmobile: get the gomobile version dynamically
Closes #2356
2022-09-29 02:23:21 +09:00
Hajime Hoshi ebbf0fbc08 cmd/ebitenmobile: update gomobile 2022-09-28 14:23:48 +09:00
Hajime Hoshi 284c9fcc7f update URLs in comments 2022-09-23 19:09:25 +09:00
Hajime Hoshi 5404e4d68a all: replace io/ioutil with io and os
Closes #1770
2022-09-15 02:54:25 +09:00
Hajime Hoshi 655cd4bf68 all: remove the build tag
Updates #1415
2022-09-15 00:23:40 +09:00
Hajime Hoshi 35259fe09e cmd/ebitenmobile: use go:embed
Updates #1258
2022-09-14 23:46:11 +09:00
Hajime Hoshi f1040d0507 cmd/ebitenmobile: remove GO111MODULE usage
GO111MODULE is on by default as of Go 1.16.

Closes #2276
2022-09-14 02:41:47 +09:00