Commit Graph

783 Commits

Author SHA1 Message Date
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