Commit Graph

210 Commits

Author SHA1 Message Date
Hajime Hoshi
18d526c2d3 internal/uidriver/glfw: Bug fix: Crash when returning from fullscreen
ForceUpdate was called unexpectedly inside Update. This caused the
race condition.

Closes #1505
2021-02-23 16:52:12 +09:00
Hajime Hoshi
1517f80430 internal/uidriver/glfw: Refactoring 2021-02-11 04:02:18 +09:00
Hajime Hoshi
ec912e5cad internal/uidriver/glfw: Remove the dirty hack creating a temporary UI instance
Updates #1122
2021-02-11 03:45:39 +09:00
Hajime Hoshi
fea802b39d internal/uidriver: Replace mutex usages with atomic
Updates #1073
2021-02-11 02:38:15 +09:00
Hajime Hoshi
9400efa9a5 internal/uidriver/glfw: Update the screen on resizing
Closes #1204
2021-02-07 23:03:56 +09:00
Hajime Hoshi
d999b4dc8e internal/uidriver/glfw: Bug fix: Enable to specify ebiten.Image to SetWindowIcon
Closes #1468
2021-02-07 21:18:30 +09:00
Hajime Hoshi
2dadfdb88e internal/uidriver: Optimization 2021-01-26 01:02:24 +09:00
Hajime Hoshi
10e5e9e633 internal/uidriver: Prepare the slice capacities 2021-01-25 22:47:44 +09:00
Hajime Hoshi
8d2a4ac917 uidriver/glfw: Bug fix: OpenGL was adopted unexpectedly on macOS Big Sur
Fixes #1429
2020-12-09 10:21:26 +09:00
Hajime Hoshi
3101ffd082 uidriver/glfw: Bug fix: Add more mutex locks for callbacks
Updates #1358
2020-11-18 20:43:29 +09:00
Hajime Hoshi
91b01ff83d uidriver/glfw: Replace thread usages with mutex usages for performance
Updates #1358
2020-11-18 19:45:15 +09:00
Hajime Hoshi
14070ee153 uidriver: Copy the runes on the callee sides 2020-11-18 19:37:12 +09:00
Hajime Hoshi
61bf10e73e uidriver/glfw: Bug fix: Do not iconify the fullscreen window automatically
Fixes #1405
2020-10-27 03:14:55 +09:00
Jake Coffman
290f05060a
ebiten: Add ebitensinglethread build tag (#1396)
Updates #1367
2020-10-21 02:55:17 +09:00
Hajime Hoshi
f39f80c7c3 uidriver/glfw: Refactoring 2020-10-17 17:45:29 +09:00
Hajime Hoshi
974ec525fa uidriver/glfw: Refactoring 2020-10-17 15:09:12 +09:00
Hajime Hoshi
33fd7c935a uidriver/glfw: Avoid (*thread).Call when possible at (*UserInterface).loop
Updates #1367
2020-10-17 06:08:15 +09:00
Hajime Hoshi
cbb70d045c uidriver/glfw: Eliminate (*thread).Call at (*UserInterface).update
Updates #1367
2020-10-17 06:03:38 +09:00
Hajime Hoshi
ee50f611ee uidriver/glfw: Reduce (*thread).Call at (*UserInterface).updateSize
Updates #1367
2020-10-17 05:53:21 +09:00
Hajime Hoshi
d9906835ad uidriver/glfw: Reduce (*thread).Call at (*UserInterface).update
Updates #1367
2020-10-17 05:33:34 +09:00
Hajime Hoshi
1864c22ad6 uidriver/glfw: Reduce (*thread).Call at (*Input).update 2020-10-17 05:22:23 +09:00
Hajime Hoshi
495b2b722a uidriver/glfw: Reduce (*thread).Call at (*UserInterface).update 2020-10-17 04:38:15 +09:00
Hajime Hoshi
7762f5dcec uidriver/glfw: Reduce (*thread).Call 2020-10-17 04:33:34 +09:00
Hajime Hoshi
1db7bed2a7 uidriver/glfw: Refactoring 2020-10-17 02:57:03 +09:00
Hajime Hoshi
770661c609 driver: Refactoring: Remove (UIContext).Draw 2020-10-15 01:27:50 +09:00
Hajime Hoshi
eed619ad0f graphicsdriver/metal, graphicsdriver/opengl: Reland: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 02:46:31 +09:00
Hajime Hoshi
713eee1117 Revert "graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance"
This reverts commit 2942f10d9d.

Reason: Compile error on mobiles and runtime error on browsers
2020-10-13 02:12:02 +09:00
Hajime Hoshi
2942f10d9d graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 01:50:54 +09:00
Hajime Hoshi
5ee3fdf628 ebiten: Add KeySuper
Fixes #1382
2020-10-11 18:40:40 +09:00
Hajime Hoshi
b1c67c7661 ebiten: Introduce type TouchID
Fixes #604
2020-10-10 03:57:47 +09:00
Hajime Hoshi
809b7a3afa ebiten: Introduce type GamepadID
Updates #604
2020-10-08 01:57:08 +09:00
Hajime Hoshi
ee4ebaaa95 Clean up the 'js' build tags
Updates #1129
2020-10-07 02:07:03 +09:00
Hajime Hoshi
7a0e31a23a Clean up the 'js' build tags
Updates #1129
2020-10-07 01:33:10 +09:00
Hajime Hoshi
41cf90a321 ebiten: Change the default value of IsRunningOnUnfocused to be true
Fixes #1180
2020-10-07 00:30:49 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
9890dc51da uidriver/glfw: Bug fix: Need to call updateVsync after setWindowSize
Fixes #1363
2020-09-22 18:45:56 +09:00
Hajime Hoshi
ee52c88e98 uidriver/glfw: Bug fix: Set the correct window size when going back from fullscreen 2020-09-21 19:20:58 +09:00
Hajime Hoshi
3fc328db8d uidriver/glfw: Adjust monitor sizes with math.Ceil
deviceScaleFactor() sometimes returns an unnice value (e.g.,
1.502361). Add math.Ceil whenever the calculation involves the
device scale factor.
2020-09-21 18:52:27 +09:00
Hajime Hoshi
28ce1fc3fb uidriver/glfw: Bug fix: Compile failure 2020-09-19 01:32:33 +09:00
Hajime Hoshi
51f06139a6 uidriver/glfw: Bug fix: Treat X scale (HiDPI) correctly
Fixes #1350
2020-09-19 01:24:18 +09:00
Hajime Hoshi
40e35fa047 uidriver/glfw: Bug fix: Unscale the size for framebuffers on Linux/UNIX
Fixes #1307
2020-09-19 01:04:18 +09:00
Hajime Hoshi
97607f5779 graphicsdriver/glfw: Bug fix: Convert window size unit correctly on Linux/UNIX
Updates #1307
2020-09-19 00:31:34 +09:00
Hajime Hoshi
5278a7c6d6 uidriver/glfw: Bug fix: Use the correct scale for GLFW APIs on Linux/UNIX
Updates #1307
2020-09-19 00:21:10 +09:00
Hajime Hoshi
a3b41515a9 ui: Replace the native window's type (unsafe.Pointer) with uintptr
Updates #1306
2020-09-04 00:51:48 +09:00
Hajime Hoshi
349faa0f34 thread: Use an error value instead of context.Context 2020-08-30 02:18:12 +09:00
Hajime Hoshi
1ed2b09ba0 uidriver/glfw: Ensure that canceling happens after all the queued tasks are done 2020-08-29 23:27:20 +09:00
Hajime Hoshi
12e5617396 uidriver/glfw: Update comments 2020-08-24 04:07:08 +09:00
Hajime Hoshi
932d599c98 uidriver/glfw: Bug fix compilation failure on macOS and Windows 2020-08-24 03:31:46 +09:00
Hajime Hoshi
a7d234e3c8 uidriver/glfw: Refactoring: make currentMonitorByOS more explicit 2020-08-24 03:27:38 +09:00
Hajime Hoshi
9bff1c79be uidriver/glfw: Refactoring 2020-08-24 03:05:38 +09:00
Hajime Hoshi
af6961fc17 uidriver/glfw: Bug fix: isInitWindowMaximized didn't unlock the mutex 2020-08-24 02:55:31 +09:00
Hajime Hoshi
b1bc06935a uidriver/glfw: Update comments 2020-08-24 00:57:48 +09:00
Hajime Hoshi
ed3a4a734e uidriver/glfw: Refactoring 2020-08-24 00:34:57 +09:00
Hajime Hoshi
9f8054c2d5 uidriver/glfw: Misspelling 2020-08-24 00:10:43 +09:00
Hajime Hoshi
07480ed66d uidriver/glfw: Add better fallbacks for currentMonitorFromPosition
Updates #1119
2020-08-23 23:38:03 +09:00
Hajime Hoshi
10d6a3ad67 uidriver/glfw: Bug fix: Crash on Wine when getting a monitor 2020-08-23 02:31:52 +09:00
Hajime Hoshi
77fa0cb9ef ui: Add SetInitFocused
Fixes #769
2020-08-23 02:19:09 +09:00
Hajime Hoshi
3eaa7dd0e1 uidriver/glfw: Set No-API when creating a hidden window first
GLFW tries to create an OpenGL context by default when creating a
window. This is not necessary when OpenGL is not used. This is an
optimization by skipping to create an OpenGL context if possible.
2020-07-05 15:01:06 +09:00
Hajime Hoshi
d08f57e610 uidriver/glfw: Bug fix: Skip some special 'joysticks'
Apparently, there are some special devices that are recognized as
joysticks by GLFW, even though they are not. Such devices can have
too many 'buttons'. Skip them as a tentative solution.

Updates #1173
2020-07-03 22:58:49 +09:00
Hajime Hoshi
b7a1e85788 uidriver/glfw: Remove unused logics 2020-07-03 22:24:30 +09:00
Hajime Hoshi
d98713728a uidriver/glfw: Bug fix: SetVsyncEnabled(false) did not work before the main loop
Fixes #1197
2020-06-14 11:50:58 +09:00
Hajime Hoshi
7b960a2df4 uidriver/glfw: Use the actual window size for the offscreen
On Windows, a specified window size might not match with the
actual window size when the size is too big. In this case, Ebiten
could not render the offscreen well and the upper side was cropped.

To avoid this, use the actual window size for the offscreen.

Fixes #1163
2020-05-22 18:18:38 +09:00
Hajime Hoshi
8777140e91 driver: Simplify UIContext.Update 2020-04-03 00:18:27 +09:00
Hajime Hoshi
a718ddbf7e driver: Add UIDriver.Draw
This is a preparation for XNA.

Updates #1078
2020-04-01 02:55:50 +09:00
Hajime Hoshi
b09fe7157b uidriver/glfw: Update comments 2020-03-29 01:33:23 +09:00
Hajime Hoshi
e3def4ae50 uidriver/glfw: Update comments 2020-03-29 01:12:53 +09:00
Hajime Hoshi
9d5c35f029 uidriver/glfw: Bug fix: Initilizing the window position and the size in this order on Windows
It looks like the order is different on Windows from Linux. We
are not sure why.

Updates #1118
2020-03-29 00:50:19 +09:00
Hajime Hoshi
b7ab3d2df4 uidriver/glfw: Avoid using the window position before initializing
Especially in the initial phase before calling Run/RunGame, the
window position is not reliable and then getting the device scale
factor does not make sense based on the window position. Avoid
using the window position, and instead use the glfw.Monitor in
this situation.
2020-03-29 00:09:08 +09:00
Hajime Hoshi
14200eb42c uidriver/glfw: Add comments 2020-03-29 00:02:33 +09:00
Hajime Hoshi
8480f888dd Revert "uidriver/glfw: Bug fix: Do not use the window position for monitors"
Revert "uidriver/glfw: Bug fix: compile error on Linux"

This reverts commit 0a5126f776.
This reverts commit 3e244d7a7c.

Reason: GetMonitor is available only on fullscreen mode
2020-03-28 23:56:03 +09:00
Hajime Hoshi
e628350d4e uidriver/glfw: Bug fix: Initializing order mattered
Especially on Linux, the window size and the window position must
be initialized in this order.

Fixes #1118
2020-03-28 23:37:21 +09:00
Hajime Hoshi
34acf788d2 uidriver/glfw: Bug fix: Call Maximize explictly instead of the hint
Fixes #1117
2020-03-28 22:34:01 +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
3e244d7a7c uidriver/glfw: Bug fix: compile error on Linux 2020-03-28 21:29:24 +09:00
Hajime Hoshi
8cca713d74 uidriver/glfw: Bug fix: adjustWindowPosition should consider the monitor position 2020-03-28 21:26:57 +09:00
Hajime Hoshi
0a5126f776 uidriver/glfw: Bug fix: Do not use the window position for monitors
Especially in the initial phase before calling Run/RunGame, the
window position is not reliable and then getting the device scale
factor does not make sense based on the window position. Avoid
using the window position, and instead use the glfw.Monitor.
2020-03-28 21:13:30 +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
978ee26898 ui: Add function aliases *OnUnfocused for *InBackground
Now a window can be floating with SetWindowFloating, the functions
that have suffix 'IsBackground' seems misleading. However, we
cannot rename them due to backward compatibility. Then, let's add
aliases and revisit them when updating the major version of Ebiten.

Fixes #1102
2020-03-21 00:42:00 +09:00
Hajime Hoshi
56358fd0c4 ui: Rename IsForeground -> IsFocused
Updates #1102
2020-03-21 00:12:47 +09:00
Hajime Hoshi
4ef3b3e804 ui: Add SetWindowFloating / IsWindowFloating
Fixes #880
2020-03-20 22:16:27 +09:00
Hajime Hoshi
6bc62b8f17 uidriver/glfw: Update comments 2020-03-15 15:42:05 +09:00
Hajime Hoshi
682f454fc2 input: Refactoring: Rename variables 2020-02-19 10:52:58 +09:00
corfe83
61c2d7cfe8
Simple optimization in IsKeyPressed (#1080)
Simple optimization on IsKeyPressed to avoid iterating through whole map of possible keys.
2020-02-16 02:02:05 +09:00
Hajime Hoshi
d59aea1db1 driver: Remove the return value from RunWithoutMainLoop 2020-02-11 23:56:53 +09:00
Hajime Hoshi
c927d33457 mobile/ebitenmobileview: Use the common uiContext for layouting
This means that the whole offscreen is cleared correctly.

This change is a little breaking change: SetScreenSize or other
functions no longer works on ebitenmobile. Use Layout instead.

Fixes #1019
2020-02-11 19:40:47 +09:00
Hajime Hoshi
099ce1b3b4 Revert "ui: Add SetInitFocused"
This reverts commit bb04fc8a29.

Reason: glfw.Focused / glfw.FocusOnShow did not work

Updates #769
2020-02-10 01:10:40 +09:00
Hajime Hoshi
bb04fc8a29 ui: Add SetInitFocused
Updates #769
2020-02-09 23:45:59 +09:00
Zachary Burkett
6686044452 ui: Add IsForeground API to glfw driver (#1058)
Updates #1037
2020-01-16 10:47:23 +09:00
Hajime Hoshi
e797aed6c9 uidriver/glfw: Refactoring 2020-01-13 18:23:18 +09:00
Hajime Hoshi
c1adf60e69 uidriver/glfw: Rename files 2020-01-13 18:15:39 +09:00
Hajime Hoshi
b4819c4523
input: Rename GamepadGUID -> GamepadSDLID (#1049)
Gamepad GUID is a SDL specific notion and, strictly speaking,
they are not GUID (UUID) since they don't follow UUID's
specifications.

Renaming the function makes the situation clearer.

Updates #1048
2020-01-11 15:50:37 +09:00
Jake Bentvelzen
c17946bb82 ui: Add GamepadGUID and GamepadName functions (#1035)
Fixes #1034
2020-01-09 22:11:32 +09:00
Hajime Hoshi
9be3495077 driver: Remove Graphics.SetWindow
Fixes #1026
2020-01-03 19:04:48 +09:00
Hajime Hoshi
fa95275a02 uidriver/glfw: Bug fix: js should be excluded from compiling targets 2020-01-03 19:01:45 +09:00
Hajime Hoshi
982b7d6ddc driver: Let UI have Graphics
Now UIs own the implementation of Graphics.

Updates #1026
2020-01-03 18:32:27 +09:00
zamadatix
c4dfc69c81 Typo Corrections from https://goreportcard.com/ (#1042)
Correct typo found by https://goreportcard.com/
2020-01-01 23:59:56 +09:00
Hajime Hoshi
9ed8279fc8 driver: Add interface Window 2019-12-25 00:24:21 +09:00
Hajime Hoshi
049aa552d4 ui: Add SetWindowResizable
This change also fixes example/windowsize.

Fixes #320
2019-12-22 19:26:04 +09:00
Hajime Hoshi
c9863284cf uidriver/glfw: Set a default window size
Now RunGame can be called without SetWindowSize.
2019-12-22 12:51:36 +09:00