62 Commits

Author SHA1 Message Date
Hajime Hoshi 3e3b8b1662 internal/ui: defer GLFW initialization to RunGame
Move initializePlatform(), initializeGLFW(), and the monitor callback
registration from UserInterface.init() (called at package init time)
to initOnMainThread() (called only when RunGame() is invoked).

This prevents go test from hanging for packages that transitively
import Ebitengine, since GLFW initialization requires a display and
blocks in headless environments.

Also move initializeWindowPositionIfNeeded logic into initOnMainThread
since it depends on the monitor being available, which requires GLFW.
The window size and position-set flag are now passed through RunOptions.

Closes #3430

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 18:05:57 +09:00
Hajime Hoshi 9e6f06191e ebiten: update comments
Updates #3387
2026-02-28 23:09:17 +09:00
Hajime Hoshi 585a70934a ebiten: bug fix: typo in API WindowColorMode
Updates #3387
2026-02-28 22:23:13 +09:00
Hajime Hoshi 1629157ad6 ebiten: add SetWindowColorMode
Closes #3387
2026-02-28 21:45:22 +09:00
Hajime Hoshi 6aa208e15e ebiten: refactoring: add internal/inputstate
internal/inputstate will be accessed from inpututil in the future.

Updates #3249
2025-09-21 18:37:27 +09:00
Arran Tate 68befe41db ebiten: fixed typo in comment (#3199)
Added a period to the function description, making it easier to read in the IDE hover tooptip.
2025-02-14 17:05:08 +09:00
Hajime Hoshi eb365c51d5 ebiten: add RequestAttention
Closes #2998
2024-09-22 00:05:00 +09:00
Hajime Hoshi c23358ac95 Revert "internal/restorable: remove 'volatile' attribute when restorable is not used"
This reverts commit 9bdc89d40f.

Reason: Unexpected changes were included
2024-09-21 23:28:46 +09:00
Hajime Hoshi 9bdc89d40f internal/restorable: remove 'volatile' attribute when restorable is not used 2024-09-21 23:24:59 +09:00
Hajime Hoshi ab414558e8 ebiten: replace alias types with ints for better documentation 2024-09-15 17:22:20 +09:00
Hajime Hoshi f34932151d all: use atomic.Bool instead of atomic.Store/LoadUint32
Updates #2422
2024-04-29 21:16:01 +09:00
Hajime Hoshi f4029aaa77 ebiten: add (*Monitor).Size() to replace ScreenSizeInFullscreen()
Also, this change fixes redundant checks the case when a monitor
does not exist. Now Ebitengine checks a monitor existence at the
initialization.

Closes #2145
Closes #2795
2024-03-23 23:32:43 +09:00
bsski b8df1217c3 all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi 14f2ee198e ebiten: add SetWindowMousePassthrough and IsWindowMousePassthrough
Closes #2511
2023-09-18 18:31:22 +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
Pierre Curto 4de807cc44 all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi d53803615a internal/ui: merge a window-closing state into an input state 2023-01-21 23:42:48 +09:00
Hajime Hoshi c79b2c793a ebiten: update comments 2022-10-22 16:15:13 +09:00
Hajime Hoshi f7c44f086f replace Ebiten with Ebitengine in comments 2022-08-29 11:17:17 +09:00
Hajime Hoshi f923250a65 ebiten: typo 2022-08-21 20:02:53 +09:00
Hajime Hoshi 8f792fef45 ebiten: update comments
Updates #1590
Updates #1990
2022-08-10 22:42:15 +09:00
mattn 3cd0daac67 go generate ./... with Go 1.19 (#2228) 2022-08-03 20:48:02 +09:00
Hajime Hoshi 48ee30cf34 ebiten: fix a wrong comment at WindowResizingModeOnlyFullscreenEnabled 2022-04-15 14:27:21 +09:00
Hajime Hoshi 7b8ed506b2 ebiten: fix a wrong comment about deprecations 2022-02-11 05:21:58 +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 3804d4c92d ebiten: fix wrong old comments 2022-02-11 04:56:31 +09:00
Hajime Hoshi a35aa78bd2 ebiten: remove a wrong old comment 2022-02-11 00:57:13 +09:00
Hajime Hoshi 8246650c6f ebiten: remove unused constants 2022-02-10 21:12:30 +09:00
Hajime Hoshi f1987cae10 internal/ui: refactoring 2022-02-10 19:35:51 +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 891ca2a08d ebiten: add IsWindowAspectRatioFixed
This also updates examples/windowsize.

Closes #1804
2022-02-09 20:06:18 +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
Hajime Hoshi 0f09ddfbd2 internal/driver: remove Window
Closes #1983
2022-02-06 20:12:40 +09:00
Hajime Hoshi 149736c3cf internal/uidriver/*: integrate the packages into internal/ui
Updates #1983
2022-02-06 17:23:04 +09:00
Trevor Slocum 3406430956 Minor typo fixes (#1793) 2021-09-01 17:17:54 +09:00
Hajime Hoshi fb04b0d004 ebiten: Refactoring 2021-08-05 01:48:56 +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 c4c331b0d5 Fix misspellings 2021-04-21 22:50:00 +09:00
Hajime Hoshi 78732d93f6 internal/uidriver/glfw: Bug fix: Crash on some operations on native fullscreen mode (macOS)
This change forbids some operations when the wiindow is natively
fullscreened on macOS in order to avoid crashes.

Closes #1578
2021-04-18 18:11:33 +09:00
Hajime Hoshi 54ac6bed1e ebiten: Refactoring 2021-04-17 17:30:48 +09:00
Hajime Hoshi 161b1965ba ebiten: Refactoring: Call (*Window).SetPosition even before the run loop 2021-04-17 17:19:36 +09:00
Hajime Hoshi 9b6ba5ed2c ebiten: Add {Set,}WindowSizeLimits
Closes #1385
2021-04-17 03:58:06 +09:00
Hajime Hoshi 83ead375a4 ebiten: Update comments 2020-10-05 02:00:50 +09:00
Hajime Hoshi 161d8aae8f ui: Forbid RestoreWindow when the window is not maximized nor minimized
Fixes #1124
2020-03-31 02:48:22 +09:00
Hajime Hoshi 4fe5acd711 ui: Panic on MaximizeWindow when the window is not resizable
On Windows, the window could be maximized even when the window was
not resizable. This behavior is confusing. Forbid it so that the
behavior will be clearer.
2020-03-28 22:08:48 +09:00
Hajime Hoshi 7b5fb0a0d0 ui: Bug fix: The window was not shown on the secondary monitor on launching
This change changes the behavior of WindowPosition /
SetWindowPosition. The window position is now a relative position
and the origin position is the left-upper of the current monitor.

Fixes #1115
2020-03-28 19:51:47 +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 087f30b72d ui: Remove the unused function setWindowResizable
Updates #994
2020-02-12 20:58:25 +09:00