Commit Graph

358 Commits

Author SHA1 Message Date
divVerent
60df512352
Switch out the devicescale implementation by one that relies on glfw/xrandr. (#1800)
This should fix fullscreen mode on Linux/X11 systems in general,
while not affecting other systems.

Note that this deletes a bunch of OS X specific and Windows specific code,
as GLFW already provides this functionality.

This change is not expected to cause regressions, however,
the current behavior is still wrong and leads to wrong/unintended window sizes.
To be fixed in further PRs.

Updates #1774
2021-09-14 12:35:02 +09:00
Hajime Hoshi
cc1ac47387 internal/uidriver: Fix comments 2021-09-13 21:53:02 +09:00
Hajime Hoshi
39e7f71ccb internal/uidriver/glfw: Bug fix: Forbide Maximize/MinimizeWindow on the native fullscreen on macOS
Closes #1810
2021-09-12 23:38:44 +09:00
Hajime Hoshi
ea12ede127 ebiten: Add StandardGamepadButtonValue
Closes #1721
2021-09-12 21:00:48 +09:00
Hajime Hoshi
f23dadb8ae
Add internal/gamepaddb (#1805)
This is basically a revert of 93a156a718.
This implements parsing the SDL gamepad mappings by Ebiten instead
of GLFW, so that Ebiten can handle parsing errors completely.

Closes #1802
2021-09-11 22:46:05 +09:00
Hajime Hoshi
28963a66ee internal/uidriver/glfw: Update the game controller DB 2021-09-11 19:12:48 +09:00
Hajime Hoshi
37771717cc internal/uidriver: Bug fix: Potential memory leak by [:0]
Updates #1803
2021-09-10 02:17:29 +09:00
Hajime Hoshi
106ff7a84b internal/ui: Reduce calls of glfw.GetMonitors
Updates #1803
2021-09-09 11:14:08 +09:00
Hajime Hoshi
64ec626ca6 internal/uidriver/js: Optimize isFocused() by using bind 2021-09-04 19:20:24 +09:00
Hajime Hoshi
d5ce0dbd90 internal/uidriver/glfw: Bug fix: Disable the sticky mode on FPSModeVsyncOffMinimum
Closes #1791
2021-08-31 11:43:11 +09:00
Hajime Hoshi
0e5dca9453 .github/workflows, internal/uidriver/glfw: Use curl's --remote-name 2021-08-28 16:37:10 +09:00
Hajime Hoshi
eae40c90bb internal/uidriver/glfw: Enable to update gamecontrollerdb.txt 2021-08-28 16:09:14 +09:00
Hajime Hoshi
40d2dd3ba7 internal/uidriver/glfw: Update comments
Updates #1787
2021-08-26 02:05:30 +09:00
divVerent
7b11377bce
ebiten: Support updating the gamepad mapping (#1775)
This is only supported on desktops yet (on mobile standard layout isn't
implemented yet, and on the web this is the browser's responsibility).

Closes #1723
2021-08-23 21:44:49 +09:00
Hajime Hoshi
4482301882 internal/uidriver/glfw: Better implementation of isNativeFullscreen
The old implementation can return false when the window is not active.
2021-08-08 17:45:48 +09:00
Hajime Hoshi
15ac69b8d5 internal/graphicsdriver/metal: Bug fix: Disable presentsWithTransaction on fullscreen
Closes #1745
2021-08-08 17:40:37 +09:00
Hajime Hoshi
cc1accc32a internal/uidriver/glfw: Bug fix: Disable vsync when resizing the window
Closes #1740
2021-08-06 03:08:04 +09:00
Hajime Hoshi
0bc5166a36 driver: Refactoring: Rename functions 2021-08-05 01:29:45 +09:00
Hajime Hoshi
1706d9436a ebiten: Add FPSModeType, FPSMode, SetFPSMode, and ScheduleFrame
This change adds these APIs:

  * type FPSModeType
  * func FPSMode
  * func SetFPSMode
  * func ScheduleFrame

and deprecates these APIs:

  * func SetVsyncEnabled
  * func IsVsyncEnabled

Closes #1556
2021-07-24 16:09:13 +09:00
Hajime Hoshi
fee004c28d internal/uidriver/js: Remove unnecessary event handlers 2021-07-23 11:23:01 +09:00
Hajime Hoshi
0ec5b7b857 internal/uidriver/js: Bug fix: Suppress warnings on SetFullscreen
Closes #1727
2021-07-23 02:15:46 +09:00
Hajime Hoshi
2503323557 internal/driver: Add FPSMode
Updates #1556
2021-07-23 00:47:09 +09:00
Hajime Hoshi
93a156a718 internal/uidriver/glfw: Use glfwGameGamepadState
This change replaces the usage of gamepaddb package with glfwGetGamepadState.

Updates #1557
2021-07-21 16:09:30 +09:00
Hajime Hoshi
1fce527414 internal/uidriver/js: Use the same gamepad API on go2cpp 2021-07-20 23:10:56 +09:00
Hajime Hoshi
8656786721 internal/uidriver/js: Refactoring: Detect the standard layout at update 2021-07-20 21:56:15 +09:00
Hajime Hoshi
f192971080 ebiten: Rename HasGamepadStandardLayoutMapping -> IsStandardGamepadLayoutAvailable
Updates #1557
2021-07-20 02:46:12 +09:00
Hajime Hoshi
aa694be6f6 ebiten: Add the standard gamepad layout
This change introduces the standard gamepad layout. This changes adds
these APIs:

  * func HasGamepadStandardLayoutMapping
  * func IsGamepadStandardButtonPressed
  * func GamepadStandardAxisValue
  * type StandardGamepadButton
  * type StandardGamepadAxis

The standard gamepad layout is based on the web standard. See
https://www.w3.org/TR/gamepad/#remapping.

On desktops, the SDL's gamecontrllerdb.txt is used. If the gamepad is
listed in the text file, the mapping works. GLFW's mapping featrue is
not used.

On browsers, the property of a gamepad 'mapping' is used. When the
mapping value is 'standard', the gamepad is recognized to have the
standard mapping.

On mobiles, the implementation is still WIP.

Updates #1557
2021-07-20 01:32:28 +09:00
Hajime Hoshi
fcfdf9b2ba Update URLs 2021-07-19 23:09:27 +09:00
Hajime Hoshi
a6fe7801ff internal/uidriver/glfw: Rename gamePad -> gamepad 2021-07-19 22:25:43 +09:00
Hajime Hoshi
dbcb220742 ebiten: Add GamepadAxisValue replacing GamepadAxis
Updates #1718
Closes #1719
2021-07-19 01:22:35 +09:00
Hajime Hoshi
99a6b1b03e internal/driver: Change some functions to Append*
Updates #1692
2021-07-10 01:52:21 +09:00
Hajime Hoshi
5d2c8ad9be internal/uidriver/mobile: Bug fix: Use mutex at RuneBuffers 2021-07-10 01:39:32 +09:00
Hajime Hoshi
519363930a internal/uidriver/glfw: Bug fix: Memory leak in Objective-C code
Use an autorelease pool block.

Closes #1698
2021-07-07 04:34:21 +09:00
Hajime Hoshi
b0b7a24f89 internal/uidriver: Remove invalid comments 2021-07-03 19:49:12 +09:00
Enrico
3ef1d04935
internal/uidriver/glfw: Bug fix: do not execute loop function if init failed (#1689)
In `internal/uidriver/glfw/run_notsinglethread.go`, if the `UserInterface.init()` function returns an error, the `loop` is
executed regardless and the error is discarded. This behavior will hide the error returned by `init()` and might trigger
some crashes (see #1688).

A partial fix was implemented in 6c4edf8 , however that commit alone is not enough: the code now is correctly returning
the error via the `ch` channel, but it still executes the `loop()` function. This merge request skips `loop()` call if `init()`
had an error.

Updates #1688
2021-06-29 23:51:25 +09:00
Hajime Hoshi
6c4edf8605 internal/uidriver/glfw: Bug fix: Abort the game immediately on error
Updates #1688
2021-06-29 02:23:17 +09:00
Hajime Hoshi
8ff42f55a1 internal/graphicsdriver/opengl: Give up restorign on browsers
Using restorable images is expensive as this sometimes requires to
load pixels from GPU. On browsers, just reloading the application
should be fine when the context lost happens.

Closes #1603
2021-06-26 16:54:21 +09:00
Hajime Hoshi
49c3c30c79 ebiten: Add IsWindowBeingClosed / SetWindowClosingHandled / IsWindowClosingHandled
IsWindowBeingClosed reports whether the window is being closed by
the user.

SetWindowClosingHandled sets whether the window closing is handled
or not. If the state is true, the window is not closed immediately
by the user and the game can handle the closing state. In this case,
the Update function should return an error in order to end the game.

This change also adds examples/windowclosing.

Closes #1574
2021-06-14 02:29:11 +09:00
Hajime Hoshi
f989ce4e64 internal/uidriver/glfw: Rename variables 2021-06-13 23:25:24 +09:00
Hajime Hoshi
3c2d562967 internal/glfw: Bug fix: NewCallbackCDecl objects were leaked
Callbacks created by NewCallbackCDecl were never released and then
they are leaked, especially when the window size was changed by
SetWindowSize on Windows.

This change defines new callback ID types with uintptr, and reuse
the callbacks.

Closes #1672
2021-06-13 22:23:01 +09:00
Hajime Hoshi
b54ad73a2b Add go:build comments with go1.17beta1 fmt 2021-06-11 01:11:46 +09:00
Hajime Hoshi
a627c41217 Remove support of Go 1.13 and Go 1.14
Updates #1258
Updates #1415
Updates #1462
2021-06-07 21:44:22 +09:00
Hajime Hoshi
58843b68f9 internal/hooks: Enable to return error at suspend/resume audio 2021-05-04 23:09:01 +09:00
Tom Lister
bea5ab3335
internal/uidriver/glfw: Native macOS implementation for setting cursor shape (#1624)
Updates #1624
2021-05-02 14:50:50 +09:00
Hajime Hoshi
b509ce523d internal/uidriver/js: Bug fix: SetFullscreen didn't work on Safari
Updates #1611
2021-04-28 23:28:58 +09:00
Tom Lister
5d3a76cbe6
internal/uidriver/js: Implement {Set,}Fullscreen for browsers (#1623)
Closes #1611
2021-04-27 23:58:32 +09:00
Hajime Hoshi
091e51ae4c internal/uidriver/glfw: Avoid allocating a new slice 2021-04-25 00:57:06 +09:00
Hajime Hoshi
e2ceb7b3a6 internal/uidriver/glfw: Call fromGLFWPixels from the main thread
fromGLFWPixels can invoke driverScaleFactor, and then using the main
thread is safer.
2021-04-24 23:30:51 +09:00
Hajime Hoshi
91f8347500 internal/uidriver/glfw: Avoid busy loop by sleeping
Updates #1580
2021-04-24 05:19:23 +09:00
Hajime Hoshi
3df31c0fce internal/uidriver/glfw: Bug fix: Deadlock at FramebufferSize callback
glfw.PollEvents might invoke multiple FramebufferSize callbacks in
theory, this is very rare though. In this case, the sending an object
to the channel never ends.

This change fixes this deadlock by using 'select'.

Closes #1618
2021-04-24 02:22:51 +09:00