Commit Graph

329 Commits

Author SHA1 Message Date
Hajime Hoshi
2eb4ef1a94 internal/gamepad: give a window from another package instead of GetActiveWindow
GetActiveWindow doesn't work on Xbox.

Updates #2084
2022-06-03 18:42:54 +09:00
Hajime Hoshi
9c15bda275 internal/ui: return a null Window on Xbox
Updates #2084
2022-06-01 01:26:31 +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
2a5b5b4823 internal/ui: avoid a busy loop in restoreWindow
Updates #1826
2022-04-10 17:55:39 +09:00
Hajime Hoshi
3fe1df8b3b internal/ui: bug fix: ebiten.WindowSize() returned (1,1) when iconified 2022-04-10 16:50:47 +09:00
Hajime Hoshi
aae866350a internal/ui: bug fix: (*glfw.Window).GetSize() returns (0,0) when iconified
Closes #2066
2022-04-10 16:43:03 +09:00
Hajime Hoshi
90070c09fe internal/ui: rename origPos -> origWindowPos 2022-04-08 15:59:16 +09:00
Hajime Hoshi
352d332097 internal/ui: remove redundant comments 2022-04-08 15:51:56 +09:00
Hajime Hoshi
ee124baf60 internal/ui: bug fix: WindowSize returned a wrong value on fullscreen on macOS
Closes #2062
2022-04-08 14:57:51 +09:00
Hajime Hoshi
4b0967be42 internal/ui: gofmt 2022-04-04 01:48:15 +09:00
Hajime Hoshi
f1f9f74e5c internal/ui: bug fix: force to refresh the framebuffer by resizing the window very quickly
Closes #2050
2022-04-03 18:43:22 +09:00
Hajime Hoshi
ea1c18d124 internal/ui: rename contextImpl -> context 2022-04-01 17:59:44 +09:00
Hajime Hoshi
09a548e055 internal/ui: consider the case when currentMonitor() returns nil
Closes #1887
2022-04-01 03:51:28 +09:00
Hajime Hoshi
b5a9ff007c internal/ui: bug fix: WindowPosition/SetWindowPosition didn't work on macOS fullscreen
Updates #1590
Closes #2043
2022-03-30 12:10:48 +09:00
Hajime Hoshi
172da82aa7 internal/ui: optimization: reduce u.t.Call 2022-03-30 03:28:18 +09:00
Hajime Hoshi
f2860bebed internal/ui: remove an unnecessary hack to resize the window
The bug (#1606) is no longer reproducible even without the hack.

Updates #1606
Updates #1609
2022-03-30 02:48:39 +09:00
Hajime Hoshi
feb70963c6 internal/ui: force to put the window in the initial monitor
To make things simple, let's not put the window outside the initial
monitor.

Updates #1351
Closes #1575
2022-03-30 01:56:35 +09:00
Hajime Hoshi
07d6419dc6 internal/ui: bug fix: DeviceScaleFactor was not concurrent-safe before the main loop
Updates #1575
Closes #2042
2022-03-29 00:27:44 +09:00
Hajime Hoshi
79e93d3b12 internal/graphicsdriver: introduce the DirectX driver
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
3074dca670 internal/ui: add the EBITEN_GRAPHICS_LIBRARY environment variable
The `ebitengl` build tag is gone instead.

Closes #2007
2022-03-24 02:23:37 +09:00
Hajime Hoshi
15548b4c74 internal/ui: add userInterfaceImpl.graphicsDriver 2022-03-22 00:13:22 +09:00
Hajime Hoshi
be1836339b internal/ui: define the common struct UserInterface for all the environments
The existing UserInterface structs became userInterfaceImpl structs.
2022-03-21 23:10:27 +09:00
Hajime Hoshi
12ce5ae83a internal/ui: remove the call of graphicsDriver() from the context 2022-03-21 16:48:33 +09:00
Hajime Hoshi
4cbce71b2b internal/graphicscommand: move the choice of graphics drivers to internal/ui 2022-03-20 02:51:31 +09:00
Hajime Hoshi
dd8900ea48 internal/graphicsdriver: refactoring: choose the graphics driver at this package 2022-02-27 23:51:19 +09:00
Hajime Hoshi
871121abe3 internal/ui: refactoring: remove (*contextImpl).layout 2022-02-14 02:59:02 +09:00
Hajime Hoshi
e09c1bf8f1 internal/ui: refactoring: remove an error value from runOnAnotherThreadFromMainThread 2022-02-14 00:55:58 +09:00
Hajime Hoshi
b695cb928a internal/ui: remove RunWithoutMainLoop in non-mobile environments 2022-02-13 22:31:48 +09:00
Hajime Hoshi
0c1c40995c internal/ui: rename types and members: uiContext -> gameForUI 2022-02-13 20:20:46 +09:00
Hajime Hoshi
08defeeded internal/ui: move more logics to internal/ui 2022-02-13 20:02:49 +09:00
Hajime Hoshi
9b2f0b6c56 internal/ui: rename ResetForFrame -> ResetForTick
Resetting happens every tick, not every frame.
2022-02-13 19:54:40 +09:00
Hajime Hoshi
6a8e45e6c1 internal/ui: refactoring: simplify ResetForFrame
Updating the layout is already done every frame, so doing this in
ResetForFrame is not needed.

Updates #490
2022-02-13 19:31:35 +09:00
Hajime Hoshi
7b164882fc internal/ui: refactoring: move AdjustPosition to the package internal/ui 2022-02-13 19:14:29 +09:00
Hajime Hoshi
2609d73a1a internal/ui: refactoring: move some logics to internal/ui 2022-02-13 18:01:18 +09:00
Hajime Hoshi
b282b1805b internal/ui: refactoring: add ui.SetError
This is a preparation to move uiContext to the package internal/ui.
2022-02-13 17:17:08 +09:00
Hajime Hoshi
e9cfbc1630 internal/ui: refactoring: remove Graphics() 2022-02-13 04:17:39 +09:00
Hajime Hoshi
2c2c4bc428 ebiten: add WindowResizingModeType and its constants and functions
This allows a new state to disallow resizing the window but allow
making the window fullscreen on macOS by a user.

This change adds the new type WindowResizingModeType. There are
these constants of this type:

 * WindowResizingModeDisabled
 * WindowResizingModeOnlyFullscreenEnabled
 * WindowResizingModeEnabled

Closes #1819
2022-02-11 04:59:04 +09:00
Hajime Hoshi
35b9dd0846 internal/ui: give up SetWindowAspectRatioFixed
Unfortunately, it is almost impossible to provide a consistent behavior
to keep the aspect ratio of the window on Windows. Instead of having an
incomplete API, let's remove this.

Closes #1988
2022-02-10 18:35:00 +09:00
Hajime Hoshi
0291986658 internal/ui: bug fix: make the window resizable after the window is created
Making the window resizable BEFORE the window is created doesn't
work correctly, especially when switching to enable resizing later.

Closes #1987
2022-02-10 00:53:22 +09:00
Hajime Hoshi
5899470511 internal/ui: enable vsync even when resizing the window
Now I couldn't see the issue. Probably the implementation of
internal/graphicsdriver/metal has changed since the last fix, but
I am not sure.

Updates #1740
Closes #1954
2022-02-09 23:59:38 +09:00
Hajime Hoshi
edca32e520 internal/ui: bug fix: do not set the minimum window width for macOS
Shrinking a window size by a cursor sometimes makes a smaller window
than 126px. To avoid such flaky behavior, do not set the limitation of
the minimum window width.

On Linux/UNIX, there should not be reasons to limit the window width.

Updates #165
2022-02-09 23:30:26 +09:00
Hajime Hoshi
ad675640b1 internal/ui: bug fix: the aspect ratio should update the window size limits
Updates #1804
2022-02-09 23:18:41 +09:00
Hajime Hoshi
f2da62a175 internal/ui: refactoring 2022-02-09 22:22:14 +09:00
Hajime Hoshi
57c123a412 internal/ui: add comments
Updates #1804
2022-02-09 22:16:31 +09:00
Hajime Hoshi
7482cae978 internal/ui: bug fix: the aspect ratio must be updated whenever the window size is forcibly updated
This also adds a new flag -aspectratiofixed to examples/windowsize

Updates #1804
2022-02-09 19:56:50 +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