Commit Graph

88 Commits

Author SHA1 Message Date
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
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
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
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
Zachary Burkett
ed19d6fae9 Add cursor capture functionality (#1016)
Fixes #1016
2019-12-14 12:30:03 +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