Commit Graph

41 Commits

Author SHA1 Message Date
Hajime Hoshi
8c25fac860 ebiten: add AppendDroppedFiles
Closes #1868
2023-01-22 17:22:25 +09:00
Hajime Hoshi
35e25a3636 rename internal/glfwwin -> internal/goglfw
Updates #2546
2023-01-21 22:09:21 +09:00
Hajime Hoshi
dd7e125d9c ebiten: add KeyName for desktops and browsers
Updates #1904
2022-12-25 03:37:29 +09:00
Hajime Hoshi
1f741fa007 internal/glfw: do not panic for an error at Monitor.GetContentScale
Updates #2488
2022-12-08 13:39:19 +09:00
Hajime Hoshi
bc8e2fe6ac internal/glfw: bug fix: the window should be focused when closing is handled
Closes #2165
2022-08-12 22:34:19 +09:00
Hajime Hoshi
f67b4cc1d6 internal/glfw: use a pure Go implementation of GLFW
This change removes internal/glfw/glfw, that is a DLL loader, and
replaces the usages with internal/glfwwin, that is a pure Go
implementation of GLFW for Windows.

The build tag `ebitenexternaldll` is also removed.

Closes #1764
2022-05-20 22:10:00 +09:00
Hajime Hoshi
eec5ea00ec internal/glfw: refactoring: use pointers or functions for callbacks 2022-05-20 17:49:46 +09:00
Hajime Hoshi
8d2b08dd14 internal/glfw: refactoring: make callback handlers consistent 2022-05-19 01:49:21 +09:00
Hajime Hoshi
7189c7f649 internal/glfw: refactoring: remove unused APIs
Ebiten doesn't rely on GLFW for gamepads.
2022-05-19 01:04:23 +09:00
Hajime Hoshi
740dfd5aed internal/glfw: refactoring: keep the original API when possible
Updates #1804
2022-02-09 19:36:47 +09:00
Hajime Hoshi
623c050537 ebiten: rename SetKeepWindowAspectRatio -> SetWindowAspectRatioFixed
Updates #1804
2022-02-09 19:29:55 +09:00
Tom Lister
18659ef4ab
internal/ui: add SetWindowKeepAspectRatio (#1985)
Updates #1804
2022-02-09 19:11:25 +09:00
Hajime Hoshi
77664ff057 internal/uidriver/glfw: Use the correct initial monitor on Linux/UNIX
Closes #1827
2021-09-25 02:48:13 +09:00
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
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
d1c764640d internal/glfw, internal/graphicsdriver/opengl/gl: Use the last byte to detect a bool
When a C function returns a bool value, only the first byte of a
uintptr value matters. When we want to get a bool value from a C
function, filter this for sefety.
2021-08-25 02:09:55 +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
50320eeb5b internal/glfw: Bug fix: Crash after disconnecting a gamepad on Windows (Wine) 2021-07-21 17:50:47 +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
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
342bf6ae7e Update GLFW: suppress joystick issue at PollEvents
Updates #1229
2021-07-15 11:19:39 +09:00
Hajime Hoshi
ec5b034cbf Update GLFW: suppress joystick issue (again)
Updates #1229
2021-07-15 01:02:57 +09:00
Hajime Hoshi
66dbca7fdd Update GLFW: suppress joystick issue
Updates #1229
2021-07-14 23:54:48 +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
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
0cea5f2f1a internal/glfw: Remove one of go-vet warnings 2021-06-13 14:41:39 +09:00
Hajime Hoshi
99b2b5c1ee internal/glfw: Bug fix: compile error on Windows
Updates #1385
2021-04-17 04:24:19 +09:00
Hajime Hoshi
d00d0c8556 ebiten: Add CursorShape/SetCursorShape/CursorShapeType
This change adds APIs to enable to use system cursor shapes other
than the default shape (an arrow).

This change doesn't add these cursors since they seem a little
different on macOS from the other platforms.

 * GLFW_HRESIZE_CURSOR
 * GLFW_VRESIZE_CURSOR

Closes #995
2021-04-16 01:09:19 +09:00
Hajime Hoshi
18d526c2d3 internal/uidriver/glfw: Bug fix: Crash when returning from fullscreen
ForceUpdate was called unexpectedly inside Update. This caused the
race condition.

Closes #1505
2021-02-23 16:52:12 +09:00
Hajime Hoshi
760225df75 glfw: Replace the pointer size calc with bits.UintSize / 8
Updates #1306
2020-09-04 01:18:42 +09:00
Hajime Hoshi
ee15e06c50 glfw: Remove some suspicious codes depending on the memory layout 2020-09-04 01:10:39 +09:00
Hajime Hoshi
63caca720b ui: Bug fix: Compile error on Windows 2020-03-21 22:16:23 +09:00
Hajime Hoshi
f317f3b5fd ui: Add fuctions to maximize or minimize the window
This change adds these functions:

  * MaximizeWindow
  * IsWindowMaximized
  * MinimizeWIndow
  * IsWindowMinimized
  * RestoreWindow

Fixes #994
2020-03-21 22:13:58 +09:00
Jake Bentvelzen
c17946bb82 ui: Add GamepadGUID and GamepadName functions (#1035)
Fixes #1034
2020-01-09 22:11:32 +09:00
Hajime Hoshi
e0d780b029 uidriver/glfw: Enable to call SetWindowDecorated after Run
Fixes #556
2019-11-26 11:46:18 +09:00
Hajime Hoshi
a040aae83b glfw: Update to GLFW 3.3
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
9a0cefedce glfw: Bug fix: Missed to initialize a member of VidMode on Windows 2019-06-27 03:38:14 +09:00
Hajime Hoshi
d4a522d9da glfw: Bug fix: Do not pass Go's int pointer
Go's int can be 64bit or 32bit, while C's int is always 32bit on
Windows in Ebiten usage. For C's int argument, do not pass Go's
int pointer or broken values are set.

Related to #829
2019-02-24 23:10:18 +09:00
Hajime Hoshi
28665cfc4b glfw: Bug fix: Compilation error on Windows 2019-01-09 10:34:54 +09:00
Hajime Hoshi
947fbe0a2e glwf: Implement SetIcon 2018-12-31 15:49:45 +09:00
Hajime Hoshi
a21a4c75b0 glfw: Implement DLL version of the binding 2018-12-31 15:48:34 +09:00