Commit Graph

17 Commits

Author SHA1 Message Date
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
99437944bc internal/ui: remove graphicsDrivre() calls from image.go 2022-03-21 22:49:47 +09:00
Hajime Hoshi
81b9f91f86 internal/graphicscommand: compile shaders lazily
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.

This change delays compiling shaders until the graphics commands
are actually executed in the main loop.

Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
b5bb576a58 internal/ui: refactoring: unexport ConvertUniforms 2022-03-21 17:05:50 +09:00
Hajime Hoshi
c316aaae72 internal/buffered: simplify the API 2022-03-21 15:19:06 +09:00
Hajime Hoshi
29f7a45ccc internal/buffer: remove the graphics-driver argument from ReplacePartialRegionPixels
This is necessary to remove the graphics driver usage from
(*ebiten.Image).At. And this is necessary to determine the graphics
driver after the window becomes transparent or not.

Unfortunately, it is not obvious to make a transparent window with
DirectX. Then, the determination of a graphics driver should be delayed.

Updates #1007
2022-03-21 05:59:43 +09:00
Hajime Hoshi
14c327c89b internal/atlas: replace Pixels with At to reduce unnecessary slice allocations 2022-03-20 18:39:17 +09:00
Hajime Hoshi
11ff0ab48c internal/atlas: refactoring: remove arguments from Pixels 2022-03-20 18:28:57 +09:00
Hajime Hoshi
54b4e87506 internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.

Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
696bbc088f internal/ui: rename variables 2022-03-20 16:51:23 +09:00
Hajime Hoshi
c3e855ab02 internal/buffered: refactoring 2022-03-20 16:44:11 +09:00
Hajime Hoshi
673556d03f internal/ui: move the error handlings to the ui package 2022-03-20 16:26:26 +09:00
Hajime Hoshi
cc574ad67e internal/atlas: rename functions: Area -> Region 2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239 internal/buffered: separate ReplacePixels with the large-area and small-area versions
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
4cbce71b2b internal/graphicscommand: move the choice of graphics drivers to internal/ui 2022-03-20 02:51:31 +09:00
Hajime Hoshi
1d9982ee6d internal/ui: move the dependency on graphicscommand from ebiten to ui 2022-03-20 02:00:44 +09:00
Hajime Hoshi
e78f34aa26 internal/ui: add Image
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00