Commit Graph

1048 Commits

Author SHA1 Message Date
Hajime Hoshi
7e4cdf5211 internal/ui: use a more precise timer for Windows
When SetScreenClearedEveryFalse(false) and SetVsyncEnabled(false),
Draw might not be called as often as expected on Windows due to its
timer precision. This change improves the situation.

Updates #2889
2024-01-28 14:15:20 +09:00
Hajime Hoshi
8551cd350f internal/ui: bug fix: need to sleep when swapping buffers is skipped
Closes #2890
2024-01-24 12:20:30 +09:00
Hajime Hoshi
7b3eae3dcb internal/ui: reland: move dotsBuffer from internal/ui.Image to internal/buffered.Image
This is a reland of fb426cd0dd.

This is a refactoring as 'caching' things should be in internal/buffered,
but also this is a performance optimization to make pixels and dotsBuffer
work well together.
2024-01-16 12:45:43 +09:00
Hajime Hoshi
b2759b66f9 Revert "internal/ui: move dotsBuffer from internal/ui.Image to internal/buffered.Image"
This reverts commit fb426cd0dd.

Reason: processtest (TestPrograms/issue2089) failed (flaky)
2024-01-16 02:56:24 +09:00
Hajime Hoshi
fb426cd0dd internal/ui: move dotsBuffer from internal/ui.Image to internal/buffered.Image
This is a refactoring as 'caching' things should be in internal/buffered,
but also this is a performance optimization to make pixels and dotsBuffer
work well together.
2024-01-16 02:08:41 +09:00
Hajime Hoshi
9539a87b17 all: drop the support of gomobile-build
Closes #2741
2024-01-08 00:43:26 +09:00
Hajime Hoshi
2da56c00c8 internal/ui: remove renderThread
Updates #2714
2024-01-02 17:14:38 +09:00
theinternetftw
5774cf808f
internal/ui: show window after first draw on glfw (#2875)
Fixes #2725 by avoiding the flash in the first place. Showing the
window this way was already default on macOS; This makes it default
for all glfw platforms.

Closes #2725
2023-12-29 14:16:54 +09:00
Hajime Hoshi
338b8957e8 internal/graphicscommand: add Terminate
This change reduces a render thread usage in internal/ui.

Updates #2714
2023-12-27 02:28:55 +09:00
Hajime Hoshi
4895ae7f93 internal/graphicsdriver/opengl: refactoring: move some functions from internal/ui
Updates #2714
2023-12-23 22:30:13 +09:00
Hajime Hoshi
b73d63da29 internal/glfw: change the default client API to No-API 2023-12-21 04:05:13 +09:00
Hajime Hoshi
4ef7b5c166 internal/graphicsdriver/opengl: refactoring: hide SetGLFWClientAPI
Updates #2714
2023-12-20 02:47:19 +09:00
Hajime Hoshi
f6f0cf05e6 internal/ui: refactoring: move updateVsyncOnRenderThread to the OpenGL driver
Updates #2714
2023-12-20 02:38:20 +09:00
Hajime Hoshi
6fd18150d8 internal/graphicsdriver/opengl: move egl to the package opengl
Updates #2714
2023-12-19 23:41:14 +09:00
bsski
b8df1217c3
all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi
d7ebc19d04 internal/ui: refactoring: reduce usages of renderThread
Updates #2714
2023-12-17 16:21:07 +09:00
Hajime Hoshi
3b1684978b internal/ui: typo 2023-12-06 23:00:58 +09:00
Hajime Hoshi
acd317bf91 internal/ui: bug fix: wrong for-loop condition
Closes #2847
2023-11-18 20:01:24 +09:00
Hajime Hoshi
3df2ffebd1 internal/ui: refactoring: integrate Run except for mobiles 2023-11-05 00:49:53 +09:00
Hajime Hoshi
563bbda615 internal/ui: bug fix: build failure on mobiles 2023-11-05 00:43:02 +09:00
Hajime Hoshi
2db10b1e9c ebiten: add RunGameOptions.SingleThread and deprecate ebitenginesinglethread build tag
Closes #2830
2023-11-05 00:01:44 +09:00
Hajime Hoshi
4e93efa5ac internal/graphicsdriver: reland: add FillRule and replace boolean values with this
Updates #2782
2023-11-04 19:09:50 +09:00
Hajime Hoshi
f695df5924 Revert "internal/graphicsdriver: add FillRule and replace boolean values with this"
This reverts commit 38cf964a3b.

Reason: build failure on Windows
2023-11-04 19:02:40 +09:00
Hajime Hoshi
38cf964a3b internal/graphicsdriver: add FillRule and replace boolean values with this
Updates #2782
2023-11-04 18:57:31 +09:00
Hajime Hoshi
1f95c98969 internal/graphics: reland: change the definition of MaxVerticesCount
Updates #2612
2023-11-04 16:02:22 +09:00
Hajime Hoshi
3a632be0c7 Revert "internal/graphics: change the definition of MaxVerticesCount"
This reverts commit 3047ad202a.

Reason: Failed to build for 32bit architectures

Updates #2612
2023-11-04 15:10:31 +09:00
Hajime Hoshi
3047ad202a internal/graphics: change the definition of MaxVerticesCount
Updates #2612
2023-11-04 14:38:34 +09:00
Hajime Hoshi
f2544a1bd9 internal/graphicsdriver: use []uint32 instead of []uint16 for indices
Updates #2612
2023-11-04 04:39:17 +09:00
Hajime Hoshi
c01ceeaa6a ebiten: replace (*Image).Dispose with Deallocate
Closes #2808
2023-11-03 17:45:39 +09:00
Hajime Hoshi
bdd8916bb1 ebiten: replace (*ebiten.Shader).Dispose with Deallocate
Updates #2808
2023-11-03 16:25:18 +09:00
Hajime Hoshi
5da80ef3a7 internal/graphicsdriver: add playstation5
Updates #2799
2023-10-29 22:16:58 +09:00
Hajime Hoshi
27bc3e2487 internal/ui: refactoring: remove duplicated member variables 2023-10-29 19:25:02 +09:00
Hajime Hoshi
accb777f51 internal/ui: refactoring: remove unused functions 2023-10-29 19:16:11 +09:00
Hajime Hoshi
ae1ea3ba05 internal/ui: bug fix: compile failure 2023-10-29 19:14:24 +09:00
Hajime Hoshi
c4ce1b3503 internal/ui: start implementing UserInterface for PS5
Updates #2799
2023-10-29 19:13:08 +09:00
Hajime Hoshi
5fe8c29b4c internal/ui: refactoring: integrate (*UserInterface).run 2023-10-29 18:57:10 +09:00
Hajime Hoshi
ea842495cf internal/ui: refactoring 2023-10-29 18:29:41 +09:00
Hajime Hoshi
6339872da8 internal/graphicscommand: disable asynchronous rendering when vsync is on
Asynchronouse rendering was introduced at #2664, but apparently this
caused a delay between a game's update and its rendering.

Disable this when vsync is on. When vsync is off, we should not have
to care the delay since new renderings keep to come. Rather,
asynchronous renderings improves FPS.

Updates #2664
Updates #2822
2023-10-28 14:59:25 +09:00
Hajime Hoshi
98f2798b07 internal/ui: call a graphics driver's SetFPSMode only when necessary
It was odd to call this in the swapBufferForGL function.
2023-10-28 14:50:40 +09:00
Hajime Hoshi
457f6bb964 Revert "internal/ui: bug fix: panic at ReadPixels before running"
This reverts commit 2f6df3d4d6.

Reason: regression by calling (*ebiten.Image).At from a different goroutine

Updates #2820
2023-10-27 14:29:41 +09:00
Hajime Hoshi
2f6df3d4d6 internal/ui: bug fix: panic at ReadPixels before running
Closes #2820
2023-10-27 12:18:34 +09:00
Hajime Hoshi
4eb9b3a152 internal/ui: remove unused members 2023-10-27 10:49:45 +09:00
Hajime Hoshi
55702a7c28 internal/atlas: refactoring: ensure ReadPixels to be processed in a frame
This enables to call (*Image).At from HandleInput, which might be
called outside of a frame.

Updates #1704
2023-10-25 00:48:09 +09:00
Hajime Hoshi
a3ba83c5da internal/ui: bug fix: an error was ignored 2023-10-24 14:44:53 +09:00
Hajime Hoshi
f2acc3d9f7 internal/ui: refactoring 2023-10-24 14:38:23 +09:00
Hajime Hoshi
2eca476054 internal/ui: bug fix: EndFrame was not called when layoutGame returned 0s 2023-10-24 02:31:05 +09:00
Hajime Hoshi
b94c3fa9bb internal/atlas: split EndFrame into EndFrame and SwapBuffers
This enables to do something asynchronously while executing SwapBuffers
in a different goroutine.

This is a preparation for HandleInput.

Updates #1704
2023-10-24 00:22:04 +09:00
Hajime Hoshi
c2ad36bdce internal/ui: use BlendSourceOver at Fill when possible
Closes #2817
2023-10-21 01:24:49 +09:00
Hajime Hoshi
39688dd27d internal/processtest: improve test issue2815
WritePixels for 1x1 image is optimized at internal/ui, and Ebitengine
doesn't read pixels from GPU in this case. Enlarge the tested image,
and use DrawImage to ensure to invalidate the internal cache.

Updates #2815
2023-10-20 02:48:21 +09:00
Hajime Hoshi
e80e981bf5 internal/atlas: let callers retry ReadPixels instead of blocking
This is a preparation to implement HandleInput, which might call
(*Image).At in its callback.

Updates #1704
2023-10-20 02:30:32 +09:00
Hajime Hoshi
da979a3ab2 internal/buffer, internal/mipmap: remove Shader 2023-10-19 00:52:32 +09:00
Hajime Hoshi
630789757f all: add files for PlayStation 5
The implementation is WIP.

Updates #2799
2023-10-16 00:54:08 +09:00
Hajime Hoshi
bdd68ca01a internal/ui: reland: use errors.New instead of fmt.Errorf 2023-10-16 00:25:51 +09:00
Hajime Hoshi
565e944691 Revert "internal/ui: use errors.New instead of fmt.Errorf"
This reverts commit ed49d8cc9a.

Reason: compile error
2023-10-16 00:24:41 +09:00
Hajime Hoshi
ed49d8cc9a internal/ui: use errors.New instead of fmt.Errorf 2023-10-16 00:23:37 +09:00
Hajime Hoshi
e1f18b53f5 internal/ui: refactoring 2023-10-16 00:02:25 +09:00
Hajime Hoshi
47e70f2544 internal/ui: use errors.New instead of fmt.Errorf 2023-10-15 23:27:04 +09:00
Hajime Hoshi
742f3a6dac internal/ui: refactoring: reduce functions 2023-10-15 20:14:23 +09:00
Hajime Hoshi
18714e22a1 internal/ui: reland: return errors when getting a graphics driver fails 2023-10-15 18:34:08 +09:00
Hajime Hoshi
bd10f19567 Revert "internal/ui: return errors when getting a graphics driver fails"
This reverts commit d4e31aedd6.

Reason: compile error with -tags=nintendosdk
2023-10-15 18:32:47 +09:00
Hajime Hoshi
d4e31aedd6 internal/ui: return errors when getting a graphics driver fails 2023-10-15 18:26:13 +09:00
Hajime Hoshi
8274b32301 internal/graphicslibrary: refactoring: remove IsGL and IsDirectX 2023-10-15 17:30:16 +09:00
Hajime Hoshi
0378230b3e internal/ui: refactoring: reduce theUI 2023-10-15 17:02:15 +09:00
Hajime Hoshi
83a4133577 internal/ui: refactoring: remove globalState 2023-10-15 16:51:16 +09:00
Hajime Hoshi
a16a03c9db internal/ui: refactoring 2023-10-15 16:38:05 +09:00
Hajime Hoshi
a89aaa0756 internal/ui: refactoring: remove fpsMode from globalState 2023-10-15 16:19:41 +09:00
Hajime Hoshi
beabe9c6ee internal/ui: bug fix: compile failure with -tags=nintendosdk 2023-10-15 03:58:29 +09:00
Hajime Hoshi
27fd10595b internal/ui: refactoring: reduce global functions and prefer Get() 2023-10-15 03:40:48 +09:00
Hajime Hoshi
69f1fa5f29 internal/ui: unify the receivers for UI 2023-10-15 02:51:23 +09:00
Hajime Hoshi
77bdbac244 Revert "internal/ui: remove an unused function"
This reverts commit df3a1c3cdd.

Reason: compile failure: UpdateInputFromEvent was used from textinput
2023-10-15 02:23:27 +09:00
Hajime Hoshi
df3a1c3cdd internal/ui: remove an unused function 2023-10-15 01:32:39 +09:00
Hajime Hoshi
2a8d8d71fc internal/ui: merge init functions
The Go specification doesn't determine the order of init functions.
In order to reduce unexpected behavior, merge some init functions.
2023-10-15 00:17:09 +09:00
Hajime Hoshi
7018e7dfb1 internal/ui: rename files 2023-10-11 02:03:58 +09:00
Hajime Hoshi
738f13f73f internal/ui: remove unnecessary build tags 2023-10-09 23:39:06 +09:00
Hajime Hoshi
cede5027d3 internal/glfw: merge internal/cglfw into internal/glfw
Closes #2703
2023-10-07 23:59:55 +09:00
Hajime Hoshi
98dc59c89f internal/cglfw: let functions return errors
Updates #2703
2023-10-07 20:28:03 +09:00
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