Commit Graph

885 Commits

Author SHA1 Message Date
Hajime Hoshi
69e3a2b974 internal/ui: refactoring: (*monitors).update must be called from the main thread
In the current implementation, (*monitors).update is not called
from other threads, but the current code is fragile.
2023-09-24 01:37:11 +09:00
Hajime Hoshi
7664647ad1 internal/ui: bug fix: needed to wait before entering into fullscreen
Just after moving a window to another monitor, waiting a little while
was required before entering into fullscreen.

Closes #2778
2023-09-23 19:02:36 +09:00
Hajime Hoshi
4ef98b3ea9 internal/ui: bug fix: wrong calculation of the initial window position
Updates #2778
2023-09-23 18:51:58 +09:00
Hajime Hoshi
b3058b68a0 ebiten: change the unit of (*Monitor).Bounds
Monitors can have different device scale factors, and in this case,
it doesn't make sense to use device-independent pixels as unit for
monitor positions and sizes.

Updates #2778
2023-09-23 17:58:23 +09:00
Hajime Hoshi
d736a8cff7 internal/ui: bug fix: GetVideoMode must not be called from othere threads
Now setInitMonitor can be called from any other threads than the main
thread. Do not call this.

This change fixes the issue by using *Monitor instead of *glfw.Monitor.
2023-09-23 17:30:18 +09:00
Hajime Hoshi
e0cd031aea internal/ui: bug fix: replace initWindowMonitor usages with initMonitor
There were two similar member variables internalWindowMonitor and
initMonitor, and when SetMonitor is called, probably there were
some inconsitency between them.

This change fixes the issue by not using initWindowMonitor.

Closes #2779
2023-09-23 17:17:38 +09:00
Hajime Hoshi
14f2ee198e ebiten: add SetWindowMousePassthrough and IsWindowMousePassthrough
Closes #2511
2023-09-18 18:31:22 +09:00
Hajime Hoshi
8a0aba45f5 internal/ui: update touches after the layout is determined on mobiles
Closes #2763
2023-09-17 21:56:26 +09:00
Hajime Hoshi
02fd8cfb07 internal/ui: bug fix: preserve a captured cursor positions for toggling fullscreening for browsers
Closes #2475
2023-09-17 18:38:00 +09:00
Hajime Hoshi
a5aa721bda internal/ui: update mouse and touch cursors after the layout is determined on browsers
Updates #2763
2023-09-17 16:30:47 +09:00
Hajime Hoshi
6ab509f221 internal/ui: reland: bug fix: preserve cursor positions for toggling fullscreening for desktops
Updates #2475
2023-09-17 15:54:39 +09:00
Hajime Hoshi
9d73e45677 Revert "internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops"
This reverts commit 7ed4db90be.

Reason: compile error on Windows
2023-09-17 15:43:38 +09:00
Hajime Hoshi
7ed4db90be internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops
Updates #2475
2023-09-17 15:26:08 +09:00
Hajime Hoshi
7becaa19e6 internal/ui: bug fix: native APIs must be called from the main thread
Updates #2763
2023-09-17 15:14:57 +09:00
Hajime Hoshi
0475baf9e2 internal/ui: update comments
Updates #2763
2023-09-17 14:59:43 +09:00
Hajime Hoshi
8c25b07336 internal/ui: call updateInputState after layoutGame
The cursor position is affected by the current layout. Then, input
states should be updated after layoutGame is called.

Updates #2763
2023-09-17 14:58:32 +09:00
Hajime Hoshi
a62b8a00e7 internal/ui: use float64 for cursor positions internally 2023-09-17 03:43:18 +09:00
Hajime Hoshi
45acc2c5d8 internal/ui: reland: bug fix: disable window size limitation on fullscreen
Closes #2260
2023-09-16 16:49:49 +09:00
Hajime Hoshi
40fc96d78c internal/ui: forbid a green button when a max window size limit is specified
Updates #2260
2023-09-16 16:40:03 +09:00
Hajime Hoshi
128215eedd Revert "internal/ui: bug fix: disable window size limitation on fullscreen"
This reverts commit 9a5ef1b553.

Reason: we should disable the green button instead

Updates #2260
2023-09-16 03:23:34 +09:00
Hajime Hoshi
657e4c2541 internal/ui: update a comment
Closes #2240
2023-09-16 03:12:37 +09:00
Hajime Hoshi
619436a47b internal/ui: refactoring: add monitor_glfw.go 2023-09-16 00:16:00 +09:00
Hajime Hoshi
dd2768d5f3 internal/ui: bug fix: introduce locks for monitors
Updates #1853
2023-09-15 03:59:13 +09:00
Hajime Hoshi
32bd565df9 internal/ui: bug fix: setWindowMonitor was processed even when the same monitor was specified
Updates #1835
2023-09-15 03:30:15 +09:00
Hajime Hoshi
b710ff17c8 internal/ui: bug fix: wait for a while after exiting fullscreen on macOS
Closes #2758
2023-09-15 03:19:37 +09:00
Hajime Hoshi
90accfba1e internal/ui: bug fix: do not call PollEvents on Windows and Linux
Updates #2296
2023-09-15 03:11:58 +09:00
Hajime Hoshi
568e98ef1c internal/ui: bug fix: call setOrigWindowPos on entering fullscreen
Closes #2757
2023-09-15 02:53:38 +09:00
Hajime Hoshi
f7a801d591 internal/ui: refactoring 2023-09-15 02:45:31 +09:00
Hajime Hoshi
9a5ef1b553 internal/ui: bug fix: disable window size limitation on fullscreen
Closes #2260
2023-09-15 02:19:20 +09:00
Hajime Hoshi
41c7852c7d internal/ui: sort selectors in alphabetical order 2023-09-11 02:15:42 +09:00
TotallyGamerJet
5dc293fe4f
internal/ui: use new OBJC API (#2750)
Updates #1162
2023-09-11 02:05:42 +09:00
Hajime Hoshi
f30a58a393 internal/ui: bug fix: disable global functions after the game termination
Closes #2743
2023-09-02 15:38:41 +09:00
Hajime Hoshi
6e968558b1 internal/ui: bug fix: setRunning(true) must be called after the main thread is set
Some functions like ebiten.SetCursorMode use `running` to detect
whether the game starts or not. If the game starts, the main thread
must exist, but there was a timing when `running` was true but the
main thread didn't exist.

This change fixes this issue by changing the timing to call
`setRunning(true)` after the main thread initialization and before
`initOnMainThread`. `initOnMainThread` assumes that `running` is
true.

Closes #2742
2023-09-02 04:24:51 +09:00
Ketchetwahmeegwun T. Southall
60b7de6a3c
ebiten: add APIs to treat monitors (#2597)
This change adds these APIs:

* `type MonitorType`
* `func (*MonitorType) Bounds() image.Rectangle`
* `func (*MonitorType) Name() string`
* `func Monitor() *MonitorType`
* `func SetMonitor(*MonitorType)`
* `func AppendMonitors([]*MonitorType) []*MonitorType`

Closes #1835
2023-08-30 21:02:04 +09:00
Hajime Hoshi
534370f7b1 internal/graphics: enable to specify regions for each source image
This is a preparation to specify different sizes of source images.

Updates #1870
2023-08-27 21:15:01 +09:00
Hajime Hoshi
a9b2f5f9ca Revert "ebiten: panic if a non-existent uniform variable name is given"
This reverts commit 1b8580fab7.

Reason: some existing applications don't work with this fix.

Updates #2710
2023-08-24 14:15:19 +09:00
Hajime Hoshi
f81dbd9288 internal/graphicsdriver: flush commands asynchronously whenever possible
Closes #2664
2023-07-30 22:44:13 +09:00
Hajime Hoshi
5a64f8299e internal/thread: refactoring: add a common interface Thread 2023-07-30 22:42:24 +09:00
Hajime Hoshi
d13bea29dc internal/ui: refactoring 2023-07-30 03:52:54 +09:00
Hajime Hoshi
3869e2e4f6 internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
1b8580fab7 ebiten: panic if a non-existent uniform variable name is given
Closes #2710
2023-07-29 20:24:42 +09:00
Hajime Hoshi
0b1c7404d5 ebiten: use zero values for an unspecified uniform variable
Closes #2709
2023-07-29 19:11:49 +09:00
Hajime Hoshi
d0e4023d88 internal/ui: add a length check for uniform variables 2023-07-29 18:59:36 +09:00
Hajime Hoshi
8b4c744ca8 internal/ui: rename a file
Use `_linbsd.go` suffix for Linux and BSDs.
2023-07-23 02:29:57 +09:00
Hajime Hoshi
91e1c0ea29 ebiten: add more cursor shapes
This change adds these new cursor shapes:

* CursorShapeNESWResize
* CursorShapeNWSEResize
* CursorShapeMove
* CursorShapeNotAllowed

Closes #2476
2023-07-23 00:49:45 +09:00
Hajime Hoshi
7a7d4fd91f internal/ui: bug fix: need to delay to capture a cursor
From the spec https://w3c.github.io/pointerlock/#extensions-to-the-element-interface,
capturing a cursor might require a cooltime. This change adds a delay
to capture a cursor just after escaping from a capture.

Closes #2693
2023-07-07 01:24:02 +09:00
Hajime Hoshi
eb5c1ee818 internal/ui: bug fix: the original cursor position was not scaled correctly
Updates #2690
2023-07-05 09:24:29 +09:00
Hajime Hoshi
929539b66e add exp/textinput package
This works only for macOS and browsers so far.

Updates #1029
2023-07-05 02:09:04 +09:00
Hajime Hoshi
1d02d20879 internal/ui: fix comments 2023-07-04 23:34:00 +09:00
divVerent
b96aea70f1
internal/ui: compute antialias region size correctly. (#2681)
Closes #2679
2023-06-24 02:25:19 +09:00