Commit Graph

2988 Commits

Author SHA1 Message Date
Hajime Hoshi
da6b75bc6d internal/uidriver/glfw: Bug fix: Adjust the window size along with the device scale
After this change, UserInterface's windowWidth and windowHeight are
now windowWidthInDP and windowHeightInDP in device-independent pixels.

Closes #1844
2021-10-10 14:29:34 +09:00
Hajime Hoshi
d4b5d17e75 internal/uidriver/glfw: Remove an unused function
Updates #1844
2021-10-09 21:11:44 +09:00
Hajime Hoshi
fcd8a6c653 internal/uidriver/glfw: Bug fix: Get the correct initial monitor and its scale
Before this fix, Win32API is used to get the current monitor. This
might not work and return an unexpected monitor on some machines after
the runloop starts.

Instead, use the current window to get the current monitor correctly
instead of the Win32APIs. To get the initial monitor, the API
ForegroundWindow is still used.

Updates #1584
Updates #1844
2021-10-09 18:18:22 +09:00
Hajime Hoshi
3f5d1762bb internal/graphicsdriver/opengl: Return an error when initializing OpenGL fails
Updates #1838
2021-10-06 00:38:47 +09:00
r3vit
57c45a13e4
Remove dot imports from tests - Remove dot imports (#1837)
Closes #1824
2021-10-02 19:58:48 +09:00
Hajime Hoshi
78cdb94552 internal/uidriver/glfw: Bug fix: Do not hide the window after its creation
Closes #1829
2021-09-29 01:00:17 +09:00
Hajime Hoshi
56c5bec908 internal/gamepaddb: Do not fetch the database file on go:generate
This is too aggressive and sometimes risky to update the database
file always when go-generate is executed.
2021-09-25 04:03:19 +09:00
Hajime Hoshi
9ab6758b7a internal/gamepaddb: Remove some hacks for wrong formats 2021-09-25 03:56:06 +09:00
Hajime Hoshi
52d917eff0 go generate 2021-09-25 03:45:17 +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
23566a7d2e internal/uidriver/glfw: Refactoring 2021-09-25 02:14:14 +09:00
Hajime Hoshi
a0be4a302c internal/gamepaddb: Bug fix: A mapping for an axis/button might be missing
Closes #1825
2021-09-25 00:58:06 +09:00
Hajime Hoshi
a7b5db6f65 internal/uidriver/glfw: Use GLFW's fullscreen when the window is transparent on macOS
Closes #1822
2021-09-24 03:22:09 +09:00
Hajime Hoshi
f64a946052 internal/gamepaddb: Use XInput's trigger threshold 2021-09-23 15:25:27 +09:00
Hajime Hoshi
226378da88 internal/gamepaddb: Bug fix: ButtonValue must return [0, 1] 2021-09-23 15:18:16 +09:00
Hajime Hoshi
263276c5ab internal/uidriver/glfw: Refactoring 2021-09-23 02:48:22 +09:00
Hajime Hoshi
422387c7cd internal/uidriver/glfw: Refactoring 2021-09-23 02:03:37 +09:00
Hajime Hoshi
4b64eadfe5 internal/mipmap, internal/atlas: Integrate for-loops for color scaling 2021-09-23 00:28:20 +09:00
Hajime Hoshi
8063f2050c internal/graphicscommand: Optimize flush 2021-09-23 00:03:41 +09:00
Hajime Hoshi
7675e2735b internal/graphicscommand: Refactoring: Do not you 'int' as a variable name 2021-09-22 23:39:56 +09:00
Hajime Hoshi
f79acf9569 internal/mipmap: Bug fix: nil should be meaningful for a mipmap map 2021-09-21 00:46:11 +09:00
Hajime Hoshi
81fd7ab8f6 internal/mipmap: Create a mipmap map lazily 2021-09-20 23:27:14 +09:00
Hajime Hoshi
9dbff2cddd internal/uidriver/glfw: Make SetFullscreen more responsive on macOS 2021-09-20 21:01:17 +09:00
Hajime Hoshi
0ac4c7323f internal/uidriver/glfw: Bug fix: Potential crash when xgb.NewConn fails 2021-09-19 18:23:51 +09:00
Hajime Hoshi
8ed55ef42d internal/uidriver/glfw: Use the window size on a native fullscreen
Updates #1745
2021-09-19 00:35:18 +09:00
Hajime Hoshi
f0395dd329 internal/uidriver/glfw: Skip adjusting the view size with OpenGL 2021-09-18 23:59:37 +09:00
Hajime Hoshi
188e80d2f7 internal/uidriver/glfw: Bug fix: FPS is dropped when pressing the green button
Updates #1745
2021-09-18 22:16:21 +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
7be00d79e8 internal/uidriver/glfw: Fix unstable FPS on fullscreen on macOS
FPS was unstable on fullscreen mode i.e., when the view size is the
same as the monitor size.

By using a little different size view, FPS becomes stable.

Updates #1745
2021-09-18 19:22:09 +09:00
Hajime Hoshi
11b9a4b161 internal/graphicsdriver/metal: Refactoring 2021-09-18 17:24:03 +09:00
Hajime Hoshi
e98e371bb4 internal/uidriver: Bug fix: Compile error on Linux/UNIX 2021-09-18 16:58:30 +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
Hajime Hoshi
ec2f823420 internal/uidriver/glfw: Clear the device scale cache when monitors are changed 2021-09-15 13:04:38 +09:00
divVerent
5bc7b93e6f
Move VideoModeScaleAt into internal/uidriver/glfw. (#1812)
It's only used by GLFW, and has been in devicescale only to ease migration
to separate video mode vs content scaling.

Updates #1774
2021-09-15 12:47:04 +09:00
divVerent
923c84a3d6
Split the concept of device scale and screen scale (#1811)
We now set deviceScale to always the mapping from logical window system pixels
to device independent pixels (which is what Ebiten API users expect), and
introduce a new concept of videoModeScale that maps from video mode to logical
window system pixels.

videoModeScale is now only used for computing full-screen resolutions, while
deviceScale is used for any other conversion.

Fixes window sizes on X11, should be a NOP otherwise.

Closes #1774.
2021-09-15 01:03: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
cc1ac47387 internal/uidriver: Fix comments 2021-09-13 21:53:02 +09:00
Hajime Hoshi
64a0577c26 internal/affine: Optimize Scale and Translate 2021-09-13 02:18:07 +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
dbe101a8ef internal/restorable: Remove draw-triangles-history items explicitly
Updates #1803
2021-09-09 12:57:50 +09:00
Hajime Hoshi
106ff7a84b internal/ui: Reduce calls of glfw.GetMonitors
Updates #1803
2021-09-09 11:14:08 +09:00
Hajime Hoshi
5ac357959c internal/graphicscommand: Bug fix: memory leak at q.commands
Apparently, the part of a slice between len and cap-1 still holds
references. Release them explicitly.

Closes #1803
2021-09-09 04:28:31 +09:00
Hajime Hoshi
8f857daf3e internal/restorable: Bug fix: Forbid NewImage before the graphics driver is ready 2021-09-09 03:58:58 +09:00
Hajime Hoshi
a3570331dd internal/restorable: Delay initializing emptyImage
Now NeedsRestorable can always return a correct value.
2021-09-09 03:27:22 +09:00
Hajime Hoshi
65943d4bad internal/graphicsdriver/metal: Disable presentsWithTransaction on iOS
Closes #1799
2021-09-07 00:02:58 +09:00
Hajime Hoshi
f7738b812b internal/mipmap: Skip color scaling when possible 2021-09-06 12:11:52 +09:00
Hajime Hoshi
7f3bd1bbd5 internal/jsutil: Remove unused functions 2021-09-04 21:01:21 +09:00
Hajime Hoshi
64ec626ca6 internal/uidriver/js: Optimize isFocused() by using bind 2021-09-04 19:20:24 +09:00
Hajime Hoshi
58ea710a84 internal/affine: Rename UnsafeElements -> Elements as this is no longer unsafe 2021-09-04 18:08:27 +09:00
Hajime Hoshi
8c9ec8fc9f interna/affine: Avoid UnsafeElements at At
Updates #1796
2021-09-04 17:55:51 +09:00
Hajime Hoshi
df710a5c63 internal/affine: Change UnsafeElements to take arguments
This will enable to suppress unnecessary array allocations in the
future.

Updates #1796
2021-09-04 17:38:30 +09:00
Hajime Hoshi
65e148700f internal/jsutil: Optimize byteLength calls by using bind 2021-09-04 16:51:35 +09:00
Hajime Hoshi
e5c051a437 internal/affine: Refactoring: UnsafeScaleElements -> scaleElements 2021-09-03 23:56:55 +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
fa0efea4a4 internal/png: Regenerate 2021-08-28 03:14:54 +09:00
Hajime Hoshi
91a7288027 internal/atlas: Better pixel allocations
Updates #1681
Updates #1788
2021-08-26 03:35:21 +09:00
Hajime Hoshi
40d2dd3ba7 internal/uidriver/glfw: Update comments
Updates #1787
2021-08-26 02:05:30 +09:00
Hajime Hoshi
9c321375c9 internal/atlas: Bug fix: pix was reset at a wrong timing
Closes #1788
2021-08-25 22:10:57 +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
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
35deb53624 internal/graphicsdriver/metal: Rename files to remove +build comments 2021-08-23 02:06:09 +09:00
Hajime Hoshi
aec74aa39b Remove flock from the tests 2021-08-22 18:34:35 +09:00
Hajime Hoshi
d5150a194c internal/shaderir/glfw: Insert a dummy function to touch uniform array variables
Closes #1754
2021-08-15 18:06:41 +09:00
Hajime Hoshi
6c8a7d1079 internal/graphicsdriver/opengl: Bug fix: A location cache map must be reset when a program is deleted
Closes #1753
2021-08-15 04:54:20 +09:00
Hajime Hoshi
7586f1ca5e internal/atlas: Bug fix: Disable a test resetting the backend
Closes #1756
2021-08-15 00:02:59 +09:00
Hajime Hoshi
1e062a4245 internal/atlas: Bug fix: Fix test 2021-08-14 23:07:27 +09:00
Hajime Hoshi
8a6302f9dc internal/atlas: Add tests to call DrawTriangles twice
Updates #1755
2021-08-14 21:42:07 +09:00
Hajime Hoshi
da08577095 internal/graphicsdriver/opengl: Refactoring 2021-08-14 04:05:18 +09:00
Hajime Hoshi
ce8fc39451 internal/graphicsdriver/opengl: Bug fix: the current program must be reset
Updates #1751
2021-08-13 23:44:30 +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
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
ec26b1a43b internal/graphicsdriver/metal: Refactoring: Remove vsyncInited 2021-08-08 15:30:13 +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
60b8f82bfd graphicscommand: Dump internal image info on the debug mode
Closes #1714
2021-08-05 01:16:42 +09:00
Hajime Hoshi
8967384dac internal/graphicsdriver: Bug fix: getting a WebGL2 context might fail even though WebGL2RenderingContext exists
Closes #1738
2021-08-01 22:00:47 +09:00
Hajime Hoshi
4e6a5a9fa2 internal/atlas: Bug fix: Wrong screenshot size
Updates #1736
2021-07-29 16:33:54 +09:00
Hajime Hoshi
18903db1c6 internal/atlas: Bug fix: Unexpected padding in screenshots
Closes #1736
2021-07-29 16:09:29 +09:00
Hajime Hoshi
59aa41a3c2 internal/affine: Improve ColorM Scale's performance
The benchmark result comparing the previous commit and this commit is this:

```
name           old time/op    new time/op    delta
ColorMScale-8    9.75µs ± 6%    1.30µs ±22%  -86.67%  (p=0.000 n=10+9)

name           old alloc/op   new alloc/op   delta
ColorMScale-8   1.34kB ±100%    1.19kB ±19%     ~     (p=0.421 n=10+8)

name           old allocs/op  new allocs/op  delta
ColorMScale-8      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=10+10)
```

Updates #1658
2021-07-27 13:45:09 +09:00
Hajime Hoshi
bcb30f8595 Update go-gl/glfw for GLFW 3.3.4 2021-07-27 12:54:11 +09:00
Hajime Hoshi
e4329d0349 internal/driver: Refactoring: Reduce dependencies on affine 2021-07-27 12:19:50 +09:00
Hajime Hoshi
21aa96f9f5 internal/affine: Refactoring: Make ColorM interface 2021-07-27 12:10:22 +09:00
Hajime Hoshi
5f03f4f195 internal/affine: Add coloMImpl interface and colorMImplScale
Closes #1658
2021-07-26 22:18:10 +09:00
Hajime Hoshi
7e5b259dd2 internal/affine: Use a pointer of an array for UnsafeElements 2021-07-26 21:19:53 +09:00
Hajime Hoshi
2c26e85183 internal/affine: Replace isInited with isIdentity 2021-07-26 21:07:51 +09:00
Hajime Hoshi
d0ae73084b internal/affine: Separate ColorM implementation
Updates #1658
2021-07-26 15:21:12 +09:00
Hajime Hoshi
e84506dfc3 internal/affine: Add String 2021-07-26 14:26:59 +09:00
Hajime Hoshi
18757cff16 internal/affine: Refactoring 2021-07-25 22:10:38 +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