Commit Graph

139 Commits

Author SHA1 Message Date
Hajime Hoshi
dd4d2f6aa0 internal/glfw/glfw: update for GLFW 3.3.6
Closes #1896
2021-12-27 01:57:55 +09:00
Hajime Hoshi
8b775cf0dd internal/glfw: Add a new build tag ebitenexternaldll to requrie external DLLs
Embedding a DLL file and extrating it on the fly can be problematic.
The application might be unexpectedly recognized as a virus by some
virus checkers.

To mitigate this issue, Ebiten adds a new build mode `ebitenexternaldll`
which prevents Ebiten from embedding DLL files. Instead, the application
will require DLL files for GLFW.

Closes #1832
2021-10-14 02:44:25 +09:00
Hajime Hoshi
bce2e83565 internal/glfw: Update Dockerfile 2021-10-14 00:03:43 +09:00
Hajime Hoshi
6f79185b2c internal/glfw/glfw: Update documents 2021-10-13 23:48:53 +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
Hajime Hoshi
1a7cf7b3b8 internal/glfw/glfw: Modify GLFW for Windows to make the window non-floating
Closes #1506
2021-09-18 20:47:26 +09:00
Hajime Hoshi
428c079e52 internal/uidriver/glfw: Make a 'native' fullscreen on macOS
This is a breaking change. On macOS, `SetFullscreen` creates a new
independent space and maximize the size of the window there.

Updates #1506
Closes #1579
2021-09-18 16:31:22 +09:00
Hajime Hoshi
2a390c18c1 internal/uidriver/glfw: Do not iconify the fullscreen window on Linux
Updates #1506
2021-09-18 00:52:04 +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
797f42b839 internal/glfw: Use a more stable version of MinGW
Closes #1750
2021-08-13 03:35:51 +09:00
Hajime Hoshi
c6dd349338 internal/glfw: Refactoring 2021-08-09 14:55:10 +09:00
Hajime Hoshi
bcb30f8595 Update go-gl/glfw for GLFW 3.3.4 2021-07-27 12:54:11 +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
bceb512e78 internal/glfw: Bug fix: build failure with GOOS=js
Updates #1672
2021-06-13 22:59:57 +09:00
Hajime Hoshi
ed6756662a internal/glfw: Clean up the code
Updates #1672
2021-06-13 22:48:27 +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
b54ad73a2b Add go:build comments with go1.17beta1 fmt 2021-06-11 01:11:46 +09:00
Hajime Hoshi
61c0908b13 internal/glfw: Refactoring 2021-04-18 03:33:01 +09:00
Hajime Hoshi
f62576d88d internal/glfw: Add tools.go to keep go.sum 2021-04-17 20:24:39 +09:00
Hajime Hoshi
855edcd2ff internal/glfw: Update Dockerfile and regenerate DLLs 2021-04-17 20:11:10 +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
9b6ba5ed2c ebiten: Add {Set,}WindowSizeLimits
Closes #1385
2021-04-17 03:58:06 +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
052947d7b7 internal/glfw: Update GLFW to 3.3.3 for Windows
Closes #1523
2021-03-09 02:19:34 +09:00
Hajime Hoshi
d913e66cd9 Revert "uidriver/glfw: Bug fix: Do not iconify the fullscreen window automatically"
This reverts commit 61bf10e73e.

Reason: This prevents the app from iconifying when toggling apps.

Updates #1405
Closes #1504
2021-02-23 20:13:21 +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
b9907c03fa glfw: Create a DLL file atomically by renaming the file
Fixes #1393
2020-11-02 22:55:08 +09:00
Hajime Hoshi
5b8370298a glfw: Use os.UserConfigDir for GLFW DLL instead of temporary directories
As of this change, Ebiten requries Go 1.13 due to os.UserConfigDir.

Fixes #1393
2020-11-01 17:51:44 +09:00
Hajime Hoshi
61bf10e73e uidriver/glfw: Bug fix: Do not iconify the fullscreen window automatically
Fixes #1405
2020-10-27 03:14:55 +09:00
Hajime Hoshi
dc288d37f8 Bug fix: Compile error for Wasm 2020-10-07 02:23:45 +09:00
Hajime Hoshi
ee4ebaaa95 Clean up the 'js' build tags
Updates #1129
2020-10-07 02:07:03 +09:00
Hajime Hoshi
51f06139a6 uidriver/glfw: Bug fix: Treat X scale (HiDPI) correctly
Fixes #1350
2020-09-19 01:24:18 +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
a3b41515a9 ui: Replace the native window's type (unsafe.Pointer) with uintptr
Updates #1306
2020-09-04 00:51:48 +09:00
Hajime Hoshi
77fa0cb9ef ui: Add SetInitFocused
Fixes #769
2020-08-23 02:19:09 +09:00
Hajime Hoshi
7307a148f5 glfw: Use Dockerfile for ease to generate the embedding files for Windows
As MinGW version is specified, the result should be more deterministic.

Fixes #1201
2020-08-14 01:34:58 +09:00
Hajime Hoshi
d73472f4f2 Use the library style of file2byteslice 2020-08-14 00:50:09 +09:00
Hajime Hoshi
3eaa7dd0e1 uidriver/glfw: Set No-API when creating a hidden window first
GLFW tries to create an OpenGL context by default when creating a
window. This is not necessary when OpenGL is not used. This is an
optimization by skipping to create an OpenGL context if possible.
2020-07-05 15:01:06 +09:00
Hajime Hoshi
7ac6b0bfa3 Update dependencies 2020-03-31 03:32:38 +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
Hajime Hoshi
4ef3b3e804 ui: Add SetWindowFloating / IsWindowFloating
Fixes #880
2020-03-20 22:16:27 +09:00
Hajime Hoshi
c166fe8eea Update GLFW to v3.3.2
Fixes #1086
2020-02-23 03:10:38 +09:00
Hajime Hoshi
099ce1b3b4 Revert "ui: Add SetInitFocused"
This reverts commit bb04fc8a29.

Reason: glfw.Focused / glfw.FocusOnShow did not work

Updates #769
2020-02-10 01:10:40 +09:00
Hajime Hoshi
bb04fc8a29 ui: Add SetInitFocused
Updates #769
2020-02-09 23:45:59 +09:00
Jake Bentvelzen
c17946bb82 ui: Add GamepadGUID and GamepadName functions (#1035)
Fixes #1034
2020-01-09 22:11:32 +09:00
Zachary Burkett
ed19d6fae9 Add cursor capture functionality (#1016)
Fixes #1016
2019-12-14 12:30:03 +09:00
Hajime Hoshi
0ec447e0d0 ui: Add SetScreenTransparent / IsScreenTransparent
Fixes #1001
2019-12-01 03:31: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
995ba3afcf glfw: Update GLFW 3.3 2019-11-26 11:21:07 +09:00
Hajime Hoshi
a040aae83b glfw: Update to GLFW 3.3
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
51951d6087 glfw: Take a byte pointer instead of a uintptr at the callback
Make 'go vet' happy on Windows.
2019-06-27 22:57:44 +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
a19bf4214b Improve testability on Wasm 2019-06-14 23:59:38 +09:00
Hajime Hoshi
da671a6d8c glfw: Better way to get C files 2019-05-20 03:48:58 +09:00
Hajime Hoshi
289fb77d20 glfw: Sort C files in alphabetical order 2019-05-20 03:48:49 +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
ae84e79d16 ui: Add IsWindowResizable and SetWindowResizable (again)
Fixes #320
2019-01-09 00:24:16 +09:00
Hajime Hoshi
0d4e903b7a Revert "ui: Add IsWindowResizable and SetWindowResizable"
This reverts commit f403e0716f.

Reason: Compilation error on browsers
2019-01-09 00:12:57 +09:00
Hajime Hoshi
f403e0716f ui: Add IsWindowResizable and SetWindowResizable
Fixes #320
2019-01-08 23:52:53 +09:00
Hajime Hoshi
947fbe0a2e glwf: Implement SetIcon 2018-12-31 15:49:45 +09:00
Hajime Hoshi
efc7225ee1 glfw: Skip error check at proc call 2018-12-31 15:48:37 +09:00
Hajime Hoshi
a21a4c75b0 glfw: Implement DLL version of the binding 2018-12-31 15:48:34 +09:00
Hajime Hoshi
a9455d1c32 glfw: Add loading DLL 2018-12-31 15:46:06 +09:00
Hajime Hoshi
ad285c2235 glfw: Add DLL build results
This also adds fixes for 32bit machines.
2018-12-31 15:46:01 +09:00
Hajime Hoshi
90f82de5ef glfw: Separate glfw-dependent part and the other part 2018-12-30 20:45:50 +09:00
Hajime Hoshi
55c2fa4de1 Use internal/glfw 2018-12-30 02:35:46 +09:00
Hajime Hoshi
1fd445b0e4 glfw: Start implementing glfw package (Key) 2018-12-30 01:11:49 +09:00
Hajime Hoshi
8319e0d41d Remove package glfw (once) 2014-12-14 17:00:11 +09:00
Hajime Hoshi
76b7da090c Remove dependencies on ebiten from opengl 2014-12-14 15:26:10 +09:00
Hajime Hoshi
d264d7a06b Remove dependencies on ebiten from shader 2014-12-13 14:53:54 +09:00
Hajime Hoshi
4addf8f9af Rename PushOffscreen -> PushRenderTarget 2014-12-13 14:53:53 +09:00
Hajime Hoshi
54509e42cf Add GraphicsContext.PushOffscreen / PopOffscreen (#21) 2014-12-11 03:50:35 +09:00
Hajime Hoshi
d5529d4351 Add ebitenutil/debugprint.go 2014-12-11 01:59:38 +09:00
Hajime Hoshi
a39f0e904d Remove some methods; Add Game.Initialize 2014-12-11 01:12:46 +09:00
Hajime Hoshi
343916ad29 Add GameContext; Remove Input and TextureFactory 2014-12-10 23:52:37 +09:00
Hajime Hoshi
b313578a24 Add ebiten/runner; Move glfw -> internal/glfw 2014-12-10 22:55:34 +09:00