Commit Graph

447 Commits

Author SHA1 Message Date
Hajime Hoshi
0bcee31a6f internal/ui: bug fix: wrong monitor initialization on macOS
This change fixes these issues:

* `currentMouseLocation()` returned a position in the macOS native
coordinate. This means the Y axis is upward, while the Y axis is
downward in the GLFW coordinate. This change adjusts the Y position.
* `(*monitors).monitorFromGLFWMonitor` always returned nil at least
on macOS. This change replaces this with a new method
`(*monitors).primaryMonitor`.

Updates #807
Closes #2794
2023-09-29 12:36:28 +09:00
Hajime Hoshi
7cb64ccffe internal/ui: refactoring 2023-09-28 01:01:58 +09:00
Hajime Hoshi
58d3655597 internal/ui: remove unnecessary receivers from methods 2023-09-24 19:45:55 +09:00
Hajime Hoshi
b32575b7b2 internal/ui: refactoring: add (*Monitor).deviceScaleFactor 2023-09-24 19:41:37 +09:00
Hajime Hoshi
0e23045b90 internal/ui: refactoring: add (*monitors).monitorFromPosition 2023-09-24 19:41:28 +09:00
Hajime Hoshi
fab08bac92 internal/ui: use RLock/RUnlock whenever possible 2023-09-24 19:27:22 +09:00
Hajime Hoshi
4fb27adb9d internal/ui: remove an old comment
Now Ebitengine allows to specify the initial monitor, having an
initial monitor is no longer a hack.

Updates #1575
Updates #1835
2023-09-24 19:24:23 +09:00
Hajime Hoshi
b5d0dc3686 internal/ui: change the initial window position adjustment
The window position should be posible if possible.
2023-09-24 19:07:21 +09:00
Hajime Hoshi
a23efac01c internal/ui: refactoring: reduce member variables 2023-09-24 19:05:56 +09:00
Hajime Hoshi
c16bd1e249 internal/ui: refactoring: unify duplicated logics to initialize the window size and position 2023-09-24 18:55:45 +09:00
Hajime Hoshi
c7d1d28582 internal/ui: move impls for device scale to internal/ui for desktops
This enables to remove restrictions for some functions to be called
from the main thread.

Updates #2423
2023-09-24 15:44:41 +09:00
Hajime Hoshi
5d5e3c7c0b internal/ui: refactoring: replace *glfw.Monitor with *Monitor 2023-09-24 02:39:53 +09:00
Hajime Hoshi
f72b8a4ced internal/ui: refactoring: remove redundant Monitor members 2023-09-24 01:58:07 +09:00
Hajime Hoshi
01e2c92e56 internal/ui: remove unnecessary code
This was an old code when Ebitengine created a dummy invisible
window before creating the main window.
2023-09-24 01:42:39 +09:00
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
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
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
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
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
f30a58a393 internal/ui: bug fix: disable global functions after the game termination
Closes #2743
2023-09-02 15:38:41 +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
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
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
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
0785502be3 internal/ui: refactoring 2023-05-09 00:35:54 +09:00
Hajime Hoshi
b40c5b1e99 internal/ui: catch an error at At at updateIconIfNeeded
Closes #2647
2023-04-20 00:59:14 +09:00
Hajime Hoshi
09d2459f1c internal/ui: a more robust fix for the unfocused-window loop
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.

Updates #2620
2023-04-01 03:36:51 +09:00
Hajime Hoshi
db7c99fde8 internal/ui: bug fix: an unfocused window should not wait until buffers are swapped once
On macOS, a window is hidden until buffers are swapped once. If a game is
not runnable on unfocused, as the window is hidden and unfocused, the
waiting loop for a window never ends.

This change fixes the issue by changing the loop condition.

Closes #2620
2023-04-01 03:01:59 +09:00
Hajime Hoshi
1656c47abf internal/ui: bug fix: hiding a window decoration at initialization doesn't work on macOS
Closes #2600
2023-03-14 00:27:57 +09:00
Hajime Hoshi
e93bcd9e55 internal/ui: bug fix: needed to wait for swapping buffers before entering fullscreen
Closes #2599
2023-03-13 21:40:40 +09:00