Commit Graph

197 Commits

Author SHA1 Message Date
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
4ec49dd4cf mobile/ebitenmobileview: Implement Android gamepad axes
Updates #1083
2020-03-25 01:15:43 +09:00
Hajime Hoshi
8fcee54849 mobile/ebitenmobileview: Implement Android gamepad buttons
This is still work in progress.

Updates #1083
2020-03-23 01:30:17 +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
3af869732c uidriver/mobile: Implement InputChars for gomobile-build
This change also fixes InputChars to return only printable Unicode
chars on Android.

Updates #237
2020-02-23 01:01:40 +09:00
Hajime Hoshi
de52eb75e4 mobile/ebitenmobileview: Implement InputChars on Android / ebitenmobile
Updates #237
2020-02-23 00:51:49 +09:00
Hajime Hoshi
a208a026f6 uidriver/mobile: Implement keyboard key inputs for gomobile-build
Updates #237
2020-02-22 23:57:16 +09:00
Hajime Hoshi
5b7151595b mobile/ebitenmobileview: Handle keyboard keys on Android (ebitenmobile)
Updates #237
2020-02-20 01:53:51 +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
883b25f257 uidriver/mobile: Refactoring 2020-02-12 00:36:34 +09:00
Hajime Hoshi
d59aea1db1 driver: Remove the return value from RunWithoutMainLoop 2020-02-11 23:56:53 +09:00
Hajime Hoshi
aef4b4ba53 uidriver/mobile: Refactoring: Give a default outside size 2020-02-11 23:29:52 +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
a303487328 uidriver/mobile: Add comments 2020-02-11 14:45:50 +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
Hajime Hoshi
32471af18f uidriver/js: Ensure that the checking-audio loop is finished when the game is finished
After the game loop is finished, any goroutines should not exist.
Otherwise, 'Go program has already exited' error can happen on
Wasm.

This change ensures that the goroutines are finished when the game
is finished. Note that time.Sleep was required to ensure that the
(*time.Ticker) ends.

Fixes #1027
2020-02-09 03:39:08 +09:00
Hajime Hoshi
d6d17a7e85 uidriver/js: Implement GamepadSDLID
Fixes #1053
2020-02-05 00:00:00 +09:00
Hajime Hoshi
802693fa20 uidriver/mobile: Implement IsForeground
This adds hooks on resuming/suspending the application, and
switches the foreground state there. This change also updates
the logic to suspend the game loop to be clearer.

Fixes #1037
2020-01-23 02:08:31 +09:00
Hajime Hoshi
38f49c3768 uidriver/js: Implement IsForeground
Updates #1037
2020-01-21 23:56:57 +09:00
Hajime Hoshi
5c285de3db uidriver/mobile: Prevent non-mobile environments from compiling 2020-01-18 21:15:56 +09:00
Hajime Hoshi
2b9cd5aed6 uidriver/mobile: Bug fix: Compile error
TravisCI doesn't compile for mobiles, so we missed this error.

Updates #1037
2020-01-18 17:39:36 +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
hiroebe
6ee587301c Fix multiple close for channel (#1047) 2020-01-08 12:50:57 +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
Hajime Hoshi
7d56e4335e ui: Add RunGame, WindowSize and SetWindowSize
This change introduces the new APIs RunGame, WindowSize and
SetWindowSize. These new APIs hides the notion of 'scale', and is
more flexible with the outside size change. This means that we can
introduce a resizable window.

This change also adds -legacy flag to examples/windowsize. If the
flag is off, the new APIs are used.

This change deprecates these functions since the notion of 'scale'
is deprecated:

  * ScreenScale
  * ScreenSizeInFullscreen
  * SetScreenScale
  * SetScreenSize

Fixes #943, #571
Updates #320
2019-12-22 03:35:31 +09:00
Hajime Hoshi
57d527bea2 driver: Remove 'title' argument from UI.Run 2019-12-22 01:41:51 +09:00
Hajime Hoshi
8b995b086b driver: Remove some arguments from UI.Run 2019-12-21 22:52:23 +09:00
Hajime Hoshi
8013fef9ea uidriver: Bug fix: Needed to implement MonitorPosition 2019-12-21 21:15:58 +09:00
Hajime Hoshi
dabaf66b81 uidriver: Remove width/height/scale arguments from run
The initial window position is determined on ebiten package side.

Updates #943
2019-12-21 20:10:58 +09:00
Hajime Hoshi
d07028735f uidriver/glfw: Refactoring 2019-12-21 19:52:07 +09:00
Hajime Hoshi
987f333d95 uidriver/glfw: Rename variables 2019-12-21 17:34:58 +09:00
Hajime Hoshi
2e8358529c uidriver/glfw: Bug fix: WindowPos/SetWindowPos should convert pixels
This change also enables these functions even on fullscreen mode.

Fixes #1010
2019-12-21 17:03:19 +09:00
Hajime Hoshi
85cbc7e56b Enable to compile Ebiten on js/wasm with Go 1.14
Fixes #1024
2019-12-19 00:45:53 +09:00
Hajime Hoshi
9486defdae uidriver/mobile: Rely on uiContext's Layout function to determine the screen size 2019-12-17 02:16:45 +09:00
Hajime Hoshi
6a8013ed37 ui: Reduce arguments from newUIContext 2019-12-16 11:12:38 +09:00
Hajime Hoshi
bda11b0e17 driver: Add UI.SetWindowSize and UIContext.Layout
This is a preparation to introduce RunGame function.

Updates # 943 (Fix this line before committing)
2019-12-15 02:29:43 +09:00
Hajime Hoshi
d8f02cf03e uidriver/js: Bug fix: Compile error on CursorMode 2019-12-14 12:54:21 +09:00
Zachary Burkett
ed19d6fae9 Add cursor capture functionality (#1016)
Fixes #1016
2019-12-14 12:30:03 +09:00
Hajime Hoshi
ba0e8ef13f uidriver/mobile: Refactoring: Rename variables 2019-12-13 02:50:57 +09:00
Hajime Hoshi
2871795895 uidriver/glfw: Refactoring: Remove mutex from Input
Mixing a thread and a mutex is risky. Use a thread if possible.
2019-12-12 03:20:24 +09:00
Hajime Hoshi
00fb4cd2f9 uidriver/glfw: Refactoring: Remove windowWidthInDP 2019-12-09 01:39:42 +09:00
Hajime Hoshi
190feb6ecd uidriver/glfw: Rename variables
DP represents a device independent pixel.
2019-12-09 00:19:38 +09:00
Hajime Hoshi
7d403930af uidriver/glfw: Bug fix: Compile errors on Windows and Linux 2019-12-08 23:20:09 +09:00
Hajime Hoshi
c243bfcdd8 uidriver/glfw: Fix comments 2019-12-08 23:03:13 +09:00
Hajime Hoshi
3e89e7e561 uidriver/glfw: Bug fix: Show the window at last on initialization 2019-12-08 23:00:10 +09:00
Hajime Hoshi
e00a190f22 uidriver/glfw: Refactoring: Add toDeviceIndependentPixel / toDeviceDependentPixel 2019-12-08 22:09:12 +09:00
Hajime Hoshi
a0cf8bac21 uidriver/glfw: Refactoring: Limit the calls of devicescale.GetAt 2019-12-08 20:55:40 +09:00
Hajime Hoshi
8e9f5b9535 driver: Remove Suspend/ResumeAudio from UIContext 2019-12-08 16:17:02 +09:00
Hajime Hoshi
63fbffa9f6 uidriver/glfw: Fix thread issues at reqWidth/reqHeight 2019-12-08 02:44:14 +09:00
Hajime Hoshi
22e3db6814 uidriver/glfw: Add comments
Updates #1004
2019-12-08 02:04:04 +09:00
Hajime Hoshi
80fbc9701c uidriver/glfw: Force to swap buffer or recreate an window after toggling fullscreen
This change resolves a bug that an image lag remains after
toggling fullscreen.

On OpenGL, swapping buffer is necessary after toggling fullscreen.

On Metal, recreating a window works after toggling fullscreen.

Fixes #1004
2019-12-08 01:47:32 +09:00
Hajime Hoshi
2180613e2a uidriver/glfw: Refactoring: Add createWindow 2019-12-07 19:56:56 +09:00
Hajime Hoshi
67ee0ff5d4 uidriver/glfw: Refactoring: Remove forceSetScreenSize 2019-12-07 17:35:57 +09:00
Hajime Hoshi
b35ffa57b3 Revert "uidriver/glfw: Remove the dirty hack for GLFW 3.2"
This reverts commit d1da5b4920.

Reason: The dirty hack might still be needed.
2019-12-02 01:06:55 +09:00
Hajime Hoshi
d1da5b4920 uidriver/glfw: Remove the dirty hack for GLFW 3.2
See also https://github.com/glfw/glfw/issues/1334.

Updates #703
2019-12-02 01:04:28 +09:00
Hajime Hoshi
5153713469 uidriver/glfw: Make the panic messages more consistent 2019-12-01 03:34:09 +09:00
Hajime Hoshi
0ec447e0d0 ui: Add SetScreenTransparent / IsScreenTransparent
Fixes #1001
2019-12-01 03:31:32 +09:00
Hajime Hoshi
b8a099e354 ui: Bug fix: (Set)WindowPosition didn't work well with fullscreen mode 2019-12-01 00:39:04 +09:00
Hajime Hoshi
6cd0b44baa uidriver/glfw: Use invalidPos instead of pointers 2019-12-01 00:21:11 +09:00
Hajime Hoshi
e463f9e611 ui: Make (Set)WindowPosition concurrent safe 2019-12-01 00:11:46 +09:00
Hajime Hoshi
9b2f864fc8 ui: Add SetWindowPosition(x, y int)
Fixes #936
2019-11-30 23:22:39 +09:00
Hajime Hoshi
c021d6be6a ui: Add WindowPosition()
Fixes #936
2019-11-30 22:37:56 +09:00
Hajime Hoshi
e0d780b029 uidriver/glfw: Enable to call SetWindowDecorated after Run
Fixes #556
2019-11-26 11:46:18 +09:00
Hajime Hoshi
a040aae83b glfw: Update to GLFW 3.3
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
725cc22200 uidriver/mobile: Rename Render -> Update 2019-11-17 21:52:06 +09:00
Hajime Hoshi
92e056c508 uidriver/glfw: Bug fix: an unexpected window at launching
Fixes #986
2019-11-17 19:58:44 +09:00
Hajime Hoshi
800b98a0c6 ui: Bug fix: a window was alwasy 'unfocused' on Windows
There is an issue in GLFW that a window was recognized as unfoces
on Windows (glfw/glfw#1573). As a workaround, skip the logic for
an unfocused window on Windows. On Windows, even if a window is in
another workspace, vsync works. Then there seems no problem.

Fixes #987
2019-11-17 14:10:38 +09:00
Hajime Hoshi
bfd5774faf graphicsdriver/glfw: Bug fix: CPU was busy when the window is hidden
Fixes #982
2019-11-14 23:11:36 +09:00
Hajime Hoshi
a1a294df72 uidriver/glfw: Bug fix: Freeze on Wayland
Fixes #974
2019-11-10 19:26:49 +09:00
Hajime Hoshi
572780ed6d uidriver/glfw: Bug fix: errors are ignored at (*UserInterface).run
Updates #978
2019-11-10 19:09:41 +09:00
Hajime Hoshi
d43e203ccf uidriver/glfw: Remove a redundant 'if' branch 2019-11-10 17:34:14 +09:00
Hajime Hoshi
49a5a2bf4e uidriver/js: Bug fix: Needed to initialize pseudoScale with the given scale
Updates #960, #973
2019-10-27 17:16:49 +09:00