Hajime Hoshi
82bceba847
internal/cglfw: let functions return errors in native_darwin.go and glfw_unix.go
...
Updates #2703
2023-10-07 18:37:06 +09:00
Hajime Hoshi
82f2319020
internal/hook: rename hooks -> hook
2023-10-06 13:58:00 +09:00
Hajime Hoshi
e7ad5c52fe
internal/glfw: merge internal/goglfw into internal/glfw
...
This also changes APIs in internal/glfw to return errors.
Updates #2703
2023-10-05 03:09:51 +09:00
Hajime Hoshi
aa55953c11
internal/ui: replace (*userInterface).err with (*globalState).err
2023-10-05 00:45:04 +09:00
Hajime Hoshi
0e722669ef
internal/glfw: add const definitions
...
This is one of the steps to merge internal/glfw and internal/goglfw.
Updates #2703
2023-10-04 03:04:47 +09:00
Hajime Hoshi
84030a3f77
internal/ui: refactoring: remove unused functions
2023-10-04 02:54:55 +09:00
Hajime Hoshi
491b578866
ebiten: add KeyF13 to KeyF24
...
Closes #2801
2023-10-04 00:45:49 +09:00
Hajime Hoshi
95b4eeafce
all: remove unnecessary build tag restrictions
2023-10-01 23:27:57 +09:00
Hajime Hoshi
8c7eb70635
internal/ui: bug fix: wrong monitor was detected on fullscreen
...
Updates #2225
Updates #2794
2023-09-30 13:41:12 +09:00
Hajime Hoshi
22118ba962
internal/ui: add a comment
...
Updates #2796
2023-09-30 02:55:04 +09:00
Hajime Hoshi
dce18d7c23
internal/ui: bug fix: SetWindowIcon(nil) didn't reset the window icon
...
Closes #2796
2023-09-30 02:46:40 +09:00
Hajime Hoshi
13dfb28a98
internal/ui: copy a slice at SetIconImages
...
This changes makes ebiten.SetIconImages a little safer.
2023-09-30 01:46:01 +09:00
Hajime Hoshi
7204ca86e3
internal/ui: refactoring: remove an unused member
2023-09-30 01:39:34 +09:00
Hajime Hoshi
aab22f4c1e
internal/ui: bug fix: use correct regions at (*monitors).monitorFromPosition
...
Updates #2781
2023-09-30 00:30:06 +09:00
Hajime Hoshi
2fbef2106d
internal/ui: refactoring
...
Updates #2781
2023-09-30 00:11:15 +09:00
Hajime Hoshi
03d6811a65
internal/ui: bug fix: initialMonitorByOS could return nil on macOS
...
initialMonitorByOS could return nil when a cursor was at an extreme
position like the bottom of the display. Apparently, a cursor position
could take an inclusive range of the monitor size.
This change fixes this issue by fixing the comparison.
Even if initialMonitorByOS returns nil, a fallback primary monitor
should be used, so this is not a critical issue.
Updates #2794
2023-09-29 16:54:47 +09:00
Hajime Hoshi
14a2c703df
internal/ui: fix wrong panic messages
2023-09-29 15:36:43 +09:00
Hajime Hoshi
91abfe2c10
internal/ui: bug fix: compilie error on Windows
...
Updates #2794
2023-09-29 12:54:41 +09:00
Hajime Hoshi
0bcee31a6f
internal/ui: bug fix: wrong monitor initialization on macOS
...
This change fixes these issues:
* `currentMouseLocation()` returned a position in the macOS native
coordinate. This means the Y axis is upward, while the Y axis is
downward in the GLFW coordinate. This change adjusts the Y position.
* `(*monitors).monitorFromGLFWMonitor` always returned nil at least
on macOS. This change replaces this with a new method
`(*monitors).primaryMonitor`.
Updates #807
Closes #2794
2023-09-29 12:36:28 +09:00
Hajime Hoshi
4ca3fa5e57
internal/graphicsdriver: replace Region with image.Rectangle ( #2791 )
...
Closes #2790
2023-09-28 14:29:55 +09:00
Hajime Hoshi
7cb64ccffe
internal/ui: refactoring
2023-09-28 01:01:58 +09:00
Hajime Hoshi
a65a45586f
internal/ui: bug fix: need nil check at dipFromGLFWMonitorPixel
...
Updates #1878
2023-09-25 18:42:23 +09:00
Hajime Hoshi
58d3655597
internal/ui: remove unnecessary receivers from methods
2023-09-24 19:45:55 +09:00
Hajime Hoshi
b32575b7b2
internal/ui: refactoring: add (*Monitor).deviceScaleFactor
2023-09-24 19:41:37 +09:00
Hajime Hoshi
0e23045b90
internal/ui: refactoring: add (*monitors).monitorFromPosition
2023-09-24 19:41:28 +09:00
Hajime Hoshi
fab08bac92
internal/ui: use RLock/RUnlock whenever possible
2023-09-24 19:27:22 +09:00
Hajime Hoshi
4fb27adb9d
internal/ui: remove an old comment
...
Now Ebitengine allows to specify the initial monitor, having an
initial monitor is no longer a hack.
Updates #1575
Updates #1835
2023-09-24 19:24:23 +09:00
Hajime Hoshi
b5d0dc3686
internal/ui: change the initial window position adjustment
...
The window position should be posible if possible.
2023-09-24 19:07:21 +09:00
Hajime Hoshi
a23efac01c
internal/ui: refactoring: reduce member variables
2023-09-24 19:05:56 +09:00
Hajime Hoshi
c16bd1e249
internal/ui: refactoring: unify duplicated logics to initialize the window size and position
2023-09-24 18:55:45 +09:00
Hajime Hoshi
c7d1d28582
internal/ui: move impls for device scale to internal/ui for desktops
...
This enables to remove restrictions for some functions to be called
from the main thread.
Updates #2423
2023-09-24 15:44:41 +09:00
Hajime Hoshi
458a415131
internal/ui: move impls for device scale to internal/ui for mobiles
2023-09-24 15:29:14 +09:00
Hajime Hoshi
506a1de259
internal/ui: refactoring: move device-scale implementation to internal/ui for browsers
...
The returned value from internal/devicescale.At never changes for
browsers, so the detection of devicePixelRatio updates didn't work
in the first place. Also, there is not a good way to detect the
change [1].
This change moves the logic from internal/devicescale to internal/ui.
We aim to merge these packages as a device scale factor belongs to
a monitor and internal/ui manages monitors.
[1] https://crbug.com/123694
2023-09-24 03:19:31 +09:00
Hajime Hoshi
5d5e3c7c0b
internal/ui: refactoring: replace *glfw.Monitor with *Monitor
2023-09-24 02:39:53 +09:00
Hajime Hoshi
f72b8a4ced
internal/ui: refactoring: remove redundant Monitor members
2023-09-24 01:58:07 +09:00
Hajime Hoshi
121d6005cd
internal/ui: remove (*Monitor).Bounds
...
Updates #2780
2023-09-24 01:46:14 +09:00
Hajime Hoshi
01e2c92e56
internal/ui: remove unnecessary code
...
This was an old code when Ebitengine created a dummy invisible
window before creating the main window.
2023-09-24 01:42:39 +09:00
Hajime Hoshi
69e3a2b974
internal/ui: refactoring: (*monitors).update must be called from the main thread
...
In the current implementation, (*monitors).update is not called
from other threads, but the current code is fragile.
2023-09-24 01:37:11 +09:00
Hajime Hoshi
7664647ad1
internal/ui: bug fix: needed to wait before entering into fullscreen
...
Just after moving a window to another monitor, waiting a little while
was required before entering into fullscreen.
Closes #2778
2023-09-23 19:02:36 +09:00
Hajime Hoshi
4ef98b3ea9
internal/ui: bug fix: wrong calculation of the initial window position
...
Updates #2778
2023-09-23 18:51:58 +09:00
Hajime Hoshi
b3058b68a0
ebiten: change the unit of (*Monitor).Bounds
...
Monitors can have different device scale factors, and in this case,
it doesn't make sense to use device-independent pixels as unit for
monitor positions and sizes.
Updates #2778
2023-09-23 17:58:23 +09:00
Hajime Hoshi
d736a8cff7
internal/ui: bug fix: GetVideoMode must not be called from othere threads
...
Now setInitMonitor can be called from any other threads than the main
thread. Do not call this.
This change fixes the issue by using *Monitor instead of *glfw.Monitor.
2023-09-23 17:30:18 +09:00
Hajime Hoshi
e0cd031aea
internal/ui: bug fix: replace initWindowMonitor usages with initMonitor
...
There were two similar member variables internalWindowMonitor and
initMonitor, and when SetMonitor is called, probably there were
some inconsitency between them.
This change fixes the issue by not using initWindowMonitor.
Closes #2779
2023-09-23 17:17:38 +09:00
Hajime Hoshi
14f2ee198e
ebiten: add SetWindowMousePassthrough and IsWindowMousePassthrough
...
Closes #2511
2023-09-18 18:31:22 +09:00
Hajime Hoshi
8a0aba45f5
internal/ui: update touches after the layout is determined on mobiles
...
Closes #2763
2023-09-17 21:56:26 +09:00
Hajime Hoshi
02fd8cfb07
internal/ui: bug fix: preserve a captured cursor positions for toggling fullscreening for browsers
...
Closes #2475
2023-09-17 18:38:00 +09:00
Hajime Hoshi
a5aa721bda
internal/ui: update mouse and touch cursors after the layout is determined on browsers
...
Updates #2763
2023-09-17 16:30:47 +09:00
Hajime Hoshi
6ab509f221
internal/ui: reland: bug fix: preserve cursor positions for toggling fullscreening for desktops
...
Updates #2475
2023-09-17 15:54:39 +09:00
Hajime Hoshi
9d73e45677
Revert "internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops"
...
This reverts commit 7ed4db90be
.
Reason: compile error on Windows
2023-09-17 15:43:38 +09:00
Hajime Hoshi
7ed4db90be
internal/ui: bug fix: preserve cursor positions for toggling fullscreening for desktops
...
Updates #2475
2023-09-17 15:26:08 +09:00
Hajime Hoshi
7becaa19e6
internal/ui: bug fix: native APIs must be called from the main thread
...
Updates #2763
2023-09-17 15:14:57 +09:00
Hajime Hoshi
0475baf9e2
internal/ui: update comments
...
Updates #2763
2023-09-17 14:59:43 +09:00
Hajime Hoshi
8c25b07336
internal/ui: call updateInputState after layoutGame
...
The cursor position is affected by the current layout. Then, input
states should be updated after layoutGame is called.
Updates #2763
2023-09-17 14:58:32 +09:00
Hajime Hoshi
a62b8a00e7
internal/ui: use float64 for cursor positions internally
2023-09-17 03:43:18 +09:00
Hajime Hoshi
45acc2c5d8
internal/ui: reland: bug fix: disable window size limitation on fullscreen
...
Closes #2260
2023-09-16 16:49:49 +09:00
Hajime Hoshi
40fc96d78c
internal/ui: forbid a green button when a max window size limit is specified
...
Updates #2260
2023-09-16 16:40:03 +09:00
Hajime Hoshi
128215eedd
Revert "internal/ui: bug fix: disable window size limitation on fullscreen"
...
This reverts commit 9a5ef1b553
.
Reason: we should disable the green button instead
Updates #2260
2023-09-16 03:23:34 +09:00
Hajime Hoshi
657e4c2541
internal/ui: update a comment
...
Closes #2240
2023-09-16 03:12:37 +09:00
Hajime Hoshi
619436a47b
internal/ui: refactoring: add monitor_glfw.go
2023-09-16 00:16:00 +09:00
Hajime Hoshi
dd2768d5f3
internal/ui: bug fix: introduce locks for monitors
...
Updates #1853
2023-09-15 03:59:13 +09:00
Hajime Hoshi
32bd565df9
internal/ui: bug fix: setWindowMonitor was processed even when the same monitor was specified
...
Updates #1835
2023-09-15 03:30:15 +09:00
Hajime Hoshi
b710ff17c8
internal/ui: bug fix: wait for a while after exiting fullscreen on macOS
...
Closes #2758
2023-09-15 03:19:37 +09:00
Hajime Hoshi
90accfba1e
internal/ui: bug fix: do not call PollEvents on Windows and Linux
...
Updates #2296
2023-09-15 03:11:58 +09:00
Hajime Hoshi
568e98ef1c
internal/ui: bug fix: call setOrigWindowPos on entering fullscreen
...
Closes #2757
2023-09-15 02:53:38 +09:00
Hajime Hoshi
f7a801d591
internal/ui: refactoring
2023-09-15 02:45:31 +09:00
Hajime Hoshi
9a5ef1b553
internal/ui: bug fix: disable window size limitation on fullscreen
...
Closes #2260
2023-09-15 02:19:20 +09:00
Hajime Hoshi
41c7852c7d
internal/ui: sort selectors in alphabetical order
2023-09-11 02:15:42 +09:00
TotallyGamerJet
5dc293fe4f
internal/ui: use new OBJC API ( #2750 )
...
Updates #1162
2023-09-11 02:05:42 +09:00
Hajime Hoshi
f30a58a393
internal/ui: bug fix: disable global functions after the game termination
...
Closes #2743
2023-09-02 15:38:41 +09:00
Hajime Hoshi
6e968558b1
internal/ui: bug fix: setRunning(true) must be called after the main thread is set
...
Some functions like ebiten.SetCursorMode use `running` to detect
whether the game starts or not. If the game starts, the main thread
must exist, but there was a timing when `running` was true but the
main thread didn't exist.
This change fixes this issue by changing the timing to call
`setRunning(true)` after the main thread initialization and before
`initOnMainThread`. `initOnMainThread` assumes that `running` is
true.
Closes #2742
2023-09-02 04:24:51 +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
Hajime Hoshi
534370f7b1
internal/graphics: enable to specify regions for each source image
...
This is a preparation to specify different sizes of source images.
Updates #1870
2023-08-27 21:15:01 +09:00
Hajime Hoshi
a9b2f5f9ca
Revert "ebiten: panic if a non-existent uniform variable name is given"
...
This reverts commit 1b8580fab7
.
Reason: some existing applications don't work with this fix.
Updates #2710
2023-08-24 14:15:19 +09:00
Hajime Hoshi
f81dbd9288
internal/graphicsdriver: flush commands asynchronously whenever possible
...
Closes #2664
2023-07-30 22:44:13 +09:00
Hajime Hoshi
5a64f8299e
internal/thread: refactoring: add a common interface Thread
2023-07-30 22:42:24 +09:00
Hajime Hoshi
d13bea29dc
internal/ui: refactoring
2023-07-30 03:52:54 +09:00
Hajime Hoshi
3869e2e4f6
internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
...
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
1b8580fab7
ebiten: panic if a non-existent uniform variable name is given
...
Closes #2710
2023-07-29 20:24:42 +09:00
Hajime Hoshi
0b1c7404d5
ebiten: use zero values for an unspecified uniform variable
...
Closes #2709
2023-07-29 19:11:49 +09:00
Hajime Hoshi
d0e4023d88
internal/ui: add a length check for uniform variables
2023-07-29 18:59:36 +09:00
Hajime Hoshi
8b4c744ca8
internal/ui: rename a file
...
Use `_linbsd.go` suffix for Linux and BSDs.
2023-07-23 02:29:57 +09:00
Hajime Hoshi
91e1c0ea29
ebiten: add more cursor shapes
...
This change adds these new cursor shapes:
* CursorShapeNESWResize
* CursorShapeNWSEResize
* CursorShapeMove
* CursorShapeNotAllowed
Closes #2476
2023-07-23 00:49:45 +09:00
Hajime Hoshi
7a7d4fd91f
internal/ui: bug fix: need to delay to capture a cursor
...
From the spec https://w3c.github.io/pointerlock/#extensions-to-the-element-interface ,
capturing a cursor might require a cooltime. This change adds a delay
to capture a cursor just after escaping from a capture.
Closes #2693
2023-07-07 01:24:02 +09:00
Hajime Hoshi
eb5c1ee818
internal/ui: bug fix: the original cursor position was not scaled correctly
...
Updates #2690
2023-07-05 09:24:29 +09:00
Hajime Hoshi
929539b66e
add exp/textinput package
...
This works only for macOS and browsers so far.
Updates #1029
2023-07-05 02:09:04 +09:00
Hajime Hoshi
1d02d20879
internal/ui: fix comments
2023-07-04 23:34:00 +09:00
divVerent
b96aea70f1
internal/ui: compute antialias region size correctly. ( #2681 )
...
Closes #2679
2023-06-24 02:25:19 +09:00
Hajime Hoshi
0785502be3
internal/ui: refactoring
2023-05-09 00:35:54 +09:00
Hajime Hoshi
d2c991b774
all: refactoring: use image.Rectangle
2023-04-28 01:03:38 +09:00
Hajime Hoshi
00e45affe9
all: update OpenGL version from 2.1 to 3.2
...
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.
Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
b40c5b1e99
internal/ui: catch an error at At at updateIconIfNeeded
...
Closes #2647
2023-04-20 00:59:14 +09:00
Hajime Hoshi
c00579509a
internal/ui: bug fix: wrong mouse cursor movement calculation
...
Closes #2634
2023-04-10 15:25:04 +09:00
Hajime Hoshi
09d2459f1c
internal/ui: a more robust fix for the unfocused-window loop
...
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.
Updates #2620
2023-04-01 03:36:51 +09:00
Hajime Hoshi
db7c99fde8
internal/ui: bug fix: an unfocused window should not wait until buffers are swapped once
...
On macOS, a window is hidden until buffers are swapped once. If a game is
not runnable on unfocused, as the window is hidden and unfocused, the
waiting loop for a window never ends.
This change fixes the issue by changing the loop condition.
Closes #2620
2023-04-01 03:01:59 +09:00
Hajime Hoshi
14b34a7b0a
internal/ui: typo
2023-03-31 03:21:48 +09:00
Hajime Hoshi
1999f8a024
internal/ui: use DirectX as a fallback for old Windows
...
Initializing OpenGL can fail [1], though this is pretty rare. For such
this case, try DirectX as a fallback.
[1] https://answers.microsoft.com/en-us/windows/forum/all/my-drivers-dont-support-opengl/a1ee0267-4dc8-4385-a185-6ed322d78329
Updates #2613
2023-03-31 03:15:52 +09:00
Hajime Hoshi
370b7599bc
internal/graphicsdriver/directx: use OpenGL as the default on old Windows
...
On old machines, CreateSwapChain might fail without a specific reasons.
Probably this is due to an issue in drivers, and if so, there is nothing
we can do. When choosing a graphics library, prefer OpenGL on such old
machines.
Updates #2613
2023-03-31 02:21:11 +09:00
Hajime Hoshi
31273c875f
internal/graphics: rename constants
2023-03-23 20:48:39 +09:00
Hajime Hoshi
c7214ef6fb
internal/ui: use MaxVertexCount instead of IndicesCount
...
Updates #2460
2023-03-23 19:44:00 +09:00
Hajime Hoshi
1656c47abf
internal/ui: bug fix: hiding a window decoration at initialization doesn't work on macOS
...
Closes #2600
2023-03-14 00:27:57 +09:00
Hajime Hoshi
e93bcd9e55
internal/ui: bug fix: needed to wait for swapping buffers before entering fullscreen
...
Closes #2599
2023-03-13 21:40:40 +09:00
Hajime Hoshi
051b0c7238
internal/ui: bug fix: a big-offscreen size could be 0
...
Closes #2589
2023-03-03 22:34:43 +09:00
Hajime Hoshi
ea7d007df9
internal/ui: bug fix: dstRegion should not exceed the image region
...
Closes #2577
2023-02-21 14:15:39 +09:00
Hajime Hoshi
d91b8cae88
internal/ui: reland: refactoring: improve anti-alias logic
...
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.
Updates #2399
2023-02-19 23:49:32 +09:00
Hajime Hoshi
3aa8448511
Revert "internal/ui: refactoring: improve anti-alias logic"
...
This reverts commit 41f8295611
.
Reason: test failures: https://github.com/hajimehoshi/ebiten/actions/runs/4216421788/jobs/7318236488
2023-02-19 22:46:37 +09:00
Hajime Hoshi
41f8295611
internal/ui: refactoring: improve anti-alias logic
...
* Remove the image extension. The image is always flushed when necessary.
* Use a small offscreen image whichever the blend is.
Closes #2399
2023-02-19 22:14:23 +09:00
Hajime Hoshi
961c34efb5
internal/ui: use a small buffer image for anti-alias
...
Closes #2399
2023-02-19 17:35:43 +09:00
Hajime Hoshi
8479fee606
internal/ui: refactoring
2023-02-18 18:23:57 +09:00
Hajime Hoshi
56597800dd
internal/ui: refactoring: add bigOffscreenImage
...
Updates #2399
2023-02-18 02:32:41 +09:00
Hajime Hoshi
7315044dcf
internal/ui: remove a redundant call to close a window
...
glfw.Terminate should close the window too. This might fix the issue
so let's wait and see.
Updates #2551
2023-02-15 14:36:28 +09:00
Hajime Hoshi
8864ce1291
all: update comments
2023-02-07 12:05:43 +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
f009dd8dd2
ebiten: implement DroppedFiles to replace AppendDroppedFiles
...
Closes #2552
2023-01-25 14:27:11 +09:00
Hajime Hoshi
16e49e0499
internal/ui: fix a potential out-of-range error
2023-01-24 00:32:08 +09:00
Hajime Hoshi
84e32c2e4e
internal/ui: more precise detection of directory on browsers
...
Updates #1868
2023-01-22 18:28:34 +09:00
Hajime Hoshi
8c25fac860
ebiten: add AppendDroppedFiles
...
Closes #1868
2023-01-22 17:22:25 +09:00
Hajime Hoshi
b79f0394cc
internal/ui: refactoring: allow slices in InputState
2023-01-22 01:28:57 +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
08fba564f8
internal/ui: refactoring: define global sel_ objects
2023-01-09 01:41:13 +09:00
Hajime Hoshi
95f1ef0fb9
internal/ui: bug fix: recover the cursor shape when the cursor is visible
...
Closes #2527
2023-01-07 20:03:21 +09:00
Hajime Hoshi
86fa9366f7
internal/ui: use 'set' instead of 'push' for cursors
...
We don't need to use a cursor stack.
2023-01-07 19:16:41 +09:00
Hajime Hoshi
7418576c16
internal/ui: re-enable skipping to render the final screen when possible
...
With Metal, nextDrawable could return immediately when a command buffer
is empty. To avoid high CPU usage, this change adds a slight sleep in
this case.
With DirectX, Present waits for a while even though nothing is updated,
then that's fine.
Updates #2341
Updates #2342
Updates #2520
2023-01-03 23:09:28 +09:00
Hajime Hoshi
365740aca9
internal/ui: update comments
...
Updates #2521
2023-01-03 21:39:34 +09:00
Hajime Hoshi
67c9d65d82
internal/ui: refactoring
2023-01-03 21:17:47 +09:00
Hajime Hoshi
0bdfeec610
internal/ui: use a separate render thread for Nintendo Switch
...
Updates #2512
2023-01-03 21:12:18 +09:00
Hajime Hoshi
312dce950c
internal/ui: bug fix: compile failures with -tags=nintendosdk
...
Needed to use NativeDisplayType for eglGetDisplay.
2023-01-03 20:38:45 +09:00
Hajime Hoshi
6344273b7c
internal/ui: bug fix: compile failures with -tags=nintendosdk
2023-01-03 20:29:05 +09:00
Hajime Hoshi
73985c6c96
internal/ui: bug fix: compile failures with -tags=nintendosdk
2023-01-03 20:12:36 +09:00
Hajime Hoshi
723a44a822
internal/ui: rename ebitengine_Init -> ebitengine_Initialize
2023-01-03 19:23:38 +09:00
Hajime Hoshi
0e0205b2d0
internal/ui: use -overlay to provide the implementation for Nintendo Switch
...
Closes #2372
2023-01-03 19:10:15 +09:00
Hajime Hoshi
da97657afb
Revert "internal/ui: refactoring: remove unnecessary hack for unfocusing"
...
This reverts commit 3f753b7086
.
Reason: this was actually necessary.
Updates #982
Updates #987
Closes #2521
2023-01-03 02:06:55 +09:00
Hajime Hoshi
70bcec189d
internal/ui: refactoring
2023-01-03 01:43:55 +09:00
Hajime Hoshi
e4b15faefe
internal/ui: bug fix: wrong condition
2023-01-03 01:28:51 +09:00
Hajime Hoshi
bbc82ef2db
internal/ui: skip rendering onto the final framebuffer only for OpenGL
...
This was reverted at a049acd94e
but now
I've confirmed this is not problematic only with OpenGL.
Updates #2341
Updates #2342
2023-01-03 01:24:53 +09:00
Hajime Hoshi
a049acd94e
internal/ui: disable the optimization to skip rendering offscreen
...
This caused some issues in various environments. Until we find a good
solution, let's disable this.
Updates #2341
Updates #2342
Closes #2518
2023-01-02 23:14:03 +09:00
Hajime Hoshi
471237b701
internal/ui: bug fix: ignore ERROR_BUSY when deleting a GL context
...
Closes #2518
2023-01-02 15:05:16 +09:00
Hajime Hoshi
7018318546
internal/ui: bug fix: compile error on the testing CI
2023-01-01 18:01:14 +09:00
Hajime Hoshi
bba32bc06e
internal/ui: refactoring
2023-01-01 17:45:20 +09:00
Hajime Hoshi
afbd1aebf1
internal/ui: use -overlay to provide the implementation for Nintendo Switch
...
Updates #2372
2023-01-01 01:35:05 +09:00
Hajime Hoshi
34941ca083
all: separate the rendering thread from the main thread
...
Updates #1704
Closes #2512
2022-12-30 22:57:34 +09:00
Hajime Hoshi
0fc21470e2
internal/ui: move some context-dependent processes to updateFrameImpl
...
This is a preparation to introduce an independent thread for rendering.
Updates #2512
2022-12-30 22:06:36 +09:00
Hajime Hoshi
b9fb4e9f50
internal/ui: remove an unnecessary hack for macOS
...
Now macOS always uses the native fullscreen even for a transparent
window, we no longer need a hack to call SwapBuffers explicitly.
Updates #1004
2022-12-30 16:25:05 +09:00
Hajime Hoshi
0a03df297b
internal/ui: make it explicit to call swapBuffers only w/ OpenGL
2022-12-30 15:44:01 +09:00
Hajime Hoshi
0e137e8dd7
internal/ui: bug fix: compile error on mobiles
2022-12-30 15:44:01 +09:00
Hajime Hoshi
8902d95b2d
internal/ui: remove unused function runOnAnotherThreadFromMainThread
2022-12-30 13:52:05 +09:00
Hajime Hoshi
e1992347b7
internal/graphicscommand: rename SetRenderingThread -> SetRenderThread
2022-12-30 13:51:32 +09:00
Hajime Hoshi
fa4916d063
internal/ui: refactoring
2022-12-30 13:28:00 +09:00
Hajime Hoshi
3f753b7086
internal/ui: refactoring: remove unnecessary hack for unfocusing
...
The sleeping for an unfocused state also happens in (*userInterfaceImpl).update().
Updates #982
Updates #987
2022-12-30 00:41:46 +09:00
Hajime Hoshi
7e7deeab22
internal/ui: bug fix: SetWindowIcon crashed in the single-thread mode
...
Updates #1468
Closes #2513
2022-12-30 00:01:11 +09:00
Hajime Hoshi
b597ed1e27
internal/ui: remove unnecessary swapBuffer call
...
This was introduced at 9e161864f6
, the
background is now unclear. Things work even without this hack.
Updates #157
Updates #158
2022-12-29 21:48:37 +09:00
Hajime Hoshi
42c08698fb
internal/ui: give up re-rendering on resizing the window
...
It seems difficult to implement this correctly as long as the rendering
thread is the same as the main thread.
Closes #2144
Updates #2512
2022-12-29 21:27:44 +09:00
Hajime Hoshi
dd853050e9
internal/ui: refactoring
2022-12-29 21:09:30 +09:00
Hajime Hoshi
4d89b5de07
internal/ui: refactoring
2022-12-29 20:47:32 +09:00
Hajime Hoshi
e5b9569142
internal/ui: bug fix: the env variable should be used only when the library is not specified
...
Updates #2378
2022-12-29 15:44:55 +09:00
Hajime Hoshi
5e17791e4e
internal/ui: bug fix: an offscreen was broken with SetScreenClearedEveryFrame(false)
...
Updates #2500
Closes #2510
2022-12-29 14:57:07 +09:00
Hajime Hoshi
c638727759
internal/thread: remove Stop and use context.Context instead
2022-12-28 17:11:55 +09:00
Hajime Hoshi
01eb1a0bca
internal/ui: refactoring
2022-12-28 16:44:22 +09:00
Hajime Hoshi
e9248c6f33
internal/ui: rename t -> mainThread
2022-12-28 15:59:53 +09:00
Hajime Hoshi
ece60af1b7
internal/graphicsdriver/metal: stop using presentsWithTransaction
...
presentsWithTransaction caused many troubles. The critical thing was
that nextDrawable sometimes took more than one second when a user
inputs with NSTextView.
Fortunately, applications work well even without presentsWithTransaction.
Updates #1029
Updates #1196
Updates #1745
Updates #1974
2022-12-27 19:00:56 +09:00
Hajime Hoshi
5e7ec81f5c
internal/ui: rename functions
2022-12-27 12:54:01 +09:00
Hajime Hoshi
41a68bf17b
internal/ui: remove unused functions
2022-12-26 22:43:20 +09:00
Hajime Hoshi
dd7e125d9c
ebiten: add KeyName for desktops and browsers
...
Updates #1904
2022-12-25 03:37:29 +09:00
Hajime Hoshi
e6346c01d2
internal/ui: stop panicking at Key.String
2022-12-25 00:33:08 +09:00
Hajime Hoshi
d3655940bd
internal/ui: bug fix: input states must be updated before the hook
...
Closes #2502
2022-12-21 11:46:58 +09:00
Hajime Hoshi
a5b6f39ed7
internal/ui: bug fix: reset the input state immediately after reading
...
Before this change, the input state was reset at the end of a tick.
This means that wheel deltas or input chars in a tick might be reset
unexpectedly.
This change fixes the issue by reseting the input state immediately
when reading, so that wheel events and input-char events are preserved.
Updates #2496
Updates #2501
2022-12-21 00:27:28 +09:00
Hajime Hoshi
38f802cb40
internal/ui: simplify the logic of skipping rendering
2022-12-20 11:34:47 +09:00
Hajime Hoshi
59295cc85f
internal/ui: bug fix: input state should be reset for each tick, not frame
...
Before this change, input states were reset for each frame. When FPS
is bigger than TPS, the input state was reset more often than expected
and then some inputs were missing.
This change fixes the issue by resetting input states not for each frame
but for each tick.
This change also updates some comments of the input API.
Updates #2496
Closes #2501
2022-12-20 10:07:19 +09:00
Hajime Hoshi
3eb2b480be
internal/ui: bug fix: adjust the max skip count for fullscreening
...
Closes #2500
2022-12-20 02:46:45 +09:00
Hajime Hoshi
d1b9a0a9a1
internal/ui: freeze the input state for each frame
...
After this change, the input APIs will return more consistent results
for one frame.
Closes #2496
2022-12-18 23:54:43 +09:00
Hajime Hoshi
3152d88477
internal/ui: remove old Edge browser support
...
Closes #1059
2022-12-16 22:56:36 +09:00
Hajime Hoshi
9ad7a55db2
internal/ui: remove unused functions
2022-12-16 15:17:59 +09:00
Hajime Hoshi
61a009e508
internal/ui: bug fix: FPS drop on fullscreen on macOS 13
...
Updates #1745
Closes #2495
2022-12-16 02:59:06 +09:00
Hajime Hoshi
72dc730b42
internal/ui: bug fix: care the case when CoInitializeEx returns S_FALSE
2022-12-13 13:01:32 +09:00
Hajime Hoshi
8ab220df7f
internal/ui: bug fix: compile error
2022-12-13 02:38:45 +09:00
Hajime Hoshi
b022f6d86a
internal/ui: bug fix: error check at syscall
2022-12-13 02:26:07 +09:00
Hajime Hoshi
0bec1e65fa
ebiten: add RunGameOptions.SkipTaskbar
...
Closes #1518
2022-12-13 02:00:44 +09:00
Hajime Hoshi
3024e07ecc
ebiten: add RunGameOptions.ScreenTransparent
...
Closes #2378
2022-12-09 22:50:57 +09:00
Hajime Hoshi
d31b0189a2
ebiten: add RunGameOptions.InitUnfocused
...
Updates #2378
2022-12-09 21:27:32 +09:00
Hajime Hoshi
bb68ebfcad
ebiten: add RunGameWithOptions to specify graphics library
...
This also adds mobile.SetGameWithOptions.
Updates #2378
2022-12-09 21:27:31 +09:00
Hajime Hoshi
015ce2b262
internal/ui: refactoring: reduce APIs
2022-12-09 00:05:22 +09:00
Hajime Hoshi
14688348a8
internal/ui: bug fix: wrong calculation of wheel scrolling
...
Closes #2487
2022-12-08 02:10:01 +09:00
Hajime Hoshi
89c64f83e3
ebiten: performance improvement by reducing allocations of []float32
2022-12-03 21:53:56 +09:00
Hajime Hoshi
6a72b1e10d
internal/ui: refactoring
2022-12-03 21:25:28 +09:00
Hajime Hoshi
0a6813c17f
internal/graphics: use flatten []float32 slice instead of [][]float32
...
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
9d74784723
internal/ui: refactoring: simplify ConvertUniforms
2022-12-03 18:26:30 +09:00
Hajime Hoshi
61f1d8b69f
internal/graphics: remove the common vertices backend
...
It was actually impossible to use the common vertices backend in a
thread-safe manner, and actually this caused race conditions.
This changes fixes the issue by giving up a central backend, and
letting images have their own vertices buffer.
Closes #2473
2022-12-03 01:02:23 +09:00
Hajime Hoshi
3386908902
ebiten: swap the definition MouseButtonMiddle and MouseButtonRight
...
This follows the Web standard.
Closes #2468
2022-11-27 13:51:09 +09:00
Hajime Hoshi
e98661c1d3
internal/ui: forbid fullscreen on Xbox
2022-11-25 00:59:15 +09:00
Hajime Hoshi
9e9cec249a
ebiten: make some MouseButton definitions explicit
...
This change redefines named mouse button consts like MouseButtonLeft
to use MouseButton0, so that users can know which enums are the same
and different.
Updates #2445
2022-11-23 04:41:11 +09:00
Kacper Drobny
6e12fd13e4
ebiten: add additional MouseButtons ( #2467 )
...
Closes #2445
2022-11-23 04:28:34 +09:00
Hajime Hoshi
bba196d1ec
ebiten: allow array types for uniform variables
...
Closes #2448
2022-11-18 14:08:31 +09:00
Hajime Hoshi
7d146fb70b
internal/ui: bug fix: IsGL / SetUIView can be called before initialization is done
...
The functions in the package `mobile/ebitenmobileview` could be invoked
from EbitenViewController even before the graphics driver initialization
is done in theory.
This change fixes this issue by waiting the initialization by
channels. Also, this change adds error handlings at these functions.
Closes #2455
2022-11-15 01:53:20 +09:00
Hajime Hoshi
1e86e7fa18
internal/ui: refactoring: reduce opengles build tags
...
Updates #292
2022-11-14 02:46:34 +09:00
Hajime Hoshi
d09fd90963
internal/ui: use EGL for OpenGL ES
...
Updates #292
2022-11-13 06:23:30 -08:00
Hajime Hoshi
8c49c88b08
internal/graphicsdriver/opengl: refactoring
2022-11-13 15:27:37 +09:00
Hajime Hoshi
42566c6c9a
internal/graphicsdriver/opengl: refactoring: remove SetCanvas
2022-11-13 15:18:44 +09:00
Hajime Hoshi
a0a5f2b301
internal/graphicsdriver/opengl: remove SetGomobileGLContext
...
This change is needed to initialize the context at opengl.NewGraphics.
Updates #2451
2022-11-13 15:07:14 +09:00
Hajime Hoshi
1ecac8d834
all: allow integer uniform variables for Kage shaders
...
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
419bb4c1e9
all: use uint32 instead of float32 for uniform values
...
This is a preparation for other types of uniform values.
Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
0d6b42fedd
internal/ui: refactoring: keep screen/offscreen sizes as float64
...
Updates #2285
2022-11-09 01:18:41 +09:00