Commit Graph

3892 Commits

Author SHA1 Message Date
Hajime Hoshi
9bf5f2188f internal/atlas: add an assertion at SetIsolated 2022-06-06 08:25:43 +09:00
Hajime Hoshi
86a0a4154d internal/atlas: rename SetIsolate -> SetIsolated 2022-06-06 07:17:45 +09:00
Hajime Hoshi
b9012fc6ed internal/atlas: unify the term 'isolate' and 'independent' to 'isolate' 2022-06-06 00:28:23 +09:00
Hajime Hoshi
6ce8f77c53 gofmt 2022-06-06 00:28:19 +09:00
Hajime Hoshi
0256b0cfbf internal/graphicsdriver/directx: bug fix: disable fullscreen by Alt+Enter
By default, DirectX 12 tries to make the window fullscreen by Alt+Enter.
This caused application crashes. Let's disable this feature.

Closes #2123
2022-06-05 16:16:09 +09:00
Hajime Hoshi
51fe48fb76 internal/gamepad: bug fix: wrong offset especially on 32bit Linux
Closes #2122
2022-06-05 12:48:47 +09:00
Hajime Hoshi
5cdd2f8bce internal/affine: further optimization to avoid heap allocation
Updates #2119
2022-06-04 15:13:30 +09:00
Hajime Hoshi
d518e64e22 Revert "internal/graphicsdriver/directx: refactoring: add syscallN"
This reverts commit 55a490736a.

Reason: This has a potential risk of stack overflow.

Closes #2120
2022-06-04 13:58:01 +09:00
Hajime Hoshi
ecaa25faba internal/affine: avoid heap allocations by casting a variable to a concrete type
This is a dirty hack but seems efficient.

Closes #2119
2022-06-04 13:18:14 +09:00
Hajime Hoshi
f69c550992 internal/graphicsdriver/directx: bug fix: go:nosplit was required for syscallN
Updates #2116
Closes #2117
2022-06-04 01:11:22 +09:00
Hajime Hoshi
55a490736a internal/graphicsdriver/directx: refactoring: add syscallN
syscall.SyscallN is available as of Go 1.18 so this change implemented
our original syscallN function.

syscallN also panics when a given function pointer is 0. This helps
debugging especially on Xbox.

Updates #2084
2022-06-03 21:56:34 +09:00
Hajime Hoshi
3e1b313221 internal/graphicsdriver/directx: bug fix: ID3D12Resource::Map sometimes retrying
Updates #2113
Closes #2116
2022-06-03 21:56:30 +09:00
Hajime Hoshi
8e4e3d67c4 internal/gamepad: refactoring 2022-06-03 19:00:21 +09:00
Hajime Hoshi
2eb4ef1a94 internal/gamepad: give a window from another package instead of GetActiveWindow
GetActiveWindow doesn't work on Xbox.

Updates #2084
2022-06-03 18:42:54 +09:00
Hajime Hoshi
1580e92dfc internal/gamepad: refactoring 2022-06-03 18:06:54 +09:00
Hajime Hoshi
90d26305e7 internal/gamepad: unify the naming convention for Win32API with other packages 2022-06-03 16:59:44 +09:00
Hajime Hoshi
124f233de0 internal/gamepad: cast returning values to uint32 2022-06-03 16:52:49 +09:00
Hajime Hoshi
532b476c4e Revert "internal/graphicsdriver/directx: pass nil for pReadRange at Map"
This reverts commit 3b13158cc0.

Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:59:34 +09:00
Hajime Hoshi
c6c45aadfa Revert "Revert "internal/glfwwin: ignore errors from DWM functions""
This reverts commit 991cec993c.

Reason: Reverted a wrong commit
2022-06-03 13:59:16 +09:00
Hajime Hoshi
991cec993c Revert "internal/glfwwin: ignore errors from DWM functions"
This reverts commit 9ad87c0153.

Reason: Specifying nil for reading ranges is not efficient
2022-06-03 13:49:45 +09:00
Hajime Hoshi
3b13158cc0 internal/graphicsdriver/directx: pass nil for pReadRange at Map
Updates #2113
2022-06-03 13:45:08 +09:00
Hajime Hoshi
9ad87c0153 internal/glfwwin: ignore errors from DWM functions
DWM functions might not be implemented on Proton. In the original
GLFW implementation, the returning values are not checked.

Updates #2113
2022-06-03 01:36:31 +09:00
Hajime Hoshi
c29c423686 internal/glfwwin, internal/graphicsdriver/directx: bug fix: HRESULT and Errno are imcompatible 2022-06-03 00:41:04 +09:00
Hajime Hoshi
7d95dddb1a internal/glfwwin: refactoring 2022-06-03 00:32:36 +09:00
Hajime Hoshi
666d50e83d internal/glfwwin: use HRESULT for an error value instead of GetLastError
GetLastError might not be reliable for some APIs like DwmFlush.

Updates #2113
2022-06-02 23:02:09 +09:00
Hajime Hoshi
4a9caf8afb internal/graphicsdriver/directx: ignore higher 32bit values for Errno
Updates #2113
2022-06-02 23:01:38 +09:00
Hajime Hoshi
fb03a1e351 internal/graphicsdriver/directx: bug fix: ID3D12Resource::Unmap does not return an value
Updates #2113
2022-06-02 12:52:58 +09:00
Hajime Hoshi
4a684c4195 treat Windows error values as uint32 instead of windows.Handle
The error value are defined as windows.Handle (64bit) in
golang.org/x/sys/windows, but an actual type should be HRESULT (32bit).
This causes an issue that a returning value from a Windows API was
recognized as a non-zero error value though the value was not an error,
when the value's lower 32-bits are all zero.

See also https://github.com/golang/go/issues/48736#issuecomment-1143993096

Updates #2113
2022-06-02 12:10:21 +09:00
Hajime Hoshi
b900f83a01 internal/graphicsdriver/directx: refactoring: remove an unused member Image.numRows 2022-06-02 01:53:27 +09:00
Hajime Hoshi
0dc6e4e64e internal/graphicsdriver/directx: use ID3D12Resource instead of ID3D12Resource1
Updates #2114
2022-06-02 01:26:02 +09:00
Hajime Hoshi
432365ff92 internal/glfwwin: ignore the error at SetProcessDpiAwarenessContext
Updates #2113
2022-06-01 23:11:06 +09:00
Hajime Hoshi
285a5cbc69 internal/glfwwin: skip some functions for Xbox
Updates #2084
2022-06-01 12:08:03 +09:00
Hajime Hoshi
0adb0c3860 internal/ui: bug fix: compile error 2022-06-01 02:09:10 +09:00
Hajime Hoshi
9c15bda275 internal/ui: return a null Window on Xbox
Updates #2084
2022-06-01 01:26:31 +09:00
Hajime Hoshi
ff868ba39f internal/ui: skip some functions for Xbox
Updates #2084
2022-06-01 00:58:36 +09:00
Hajime Hoshi
dcb5bb47c6 internal/glfw: unify the naming convension for Win32API 2022-06-01 00:48:22 +09:00
Hajime Hoshi
6fc71e97bb internal/glfwwin: skip some functions for Xbox
Updates #2084
2022-06-01 00:35:43 +09:00
Hajime Hoshi
aa4a2b64e0 internal/glfwwin: bug fix: update _glfw.windows 2022-06-01 00:01:07 +09:00
Hajime Hoshi
c99b948df3 internal/graphicsdriver/directx: refactoring
Updates #2084
2022-05-30 03:17:15 +09:00
Hajime Hoshi
d4226659ee internal/graphicsdriver/directx: initialize a device for Xbox
Updates #1162
2022-05-30 02:10:18 +09:00
Hajime Hoshi
59798d29f4 internal/graphicsdriver/directx: defer the initialization 2022-05-29 22:02:39 +09:00
Hajime Hoshi
b4491ab94d internal/graphicsdriver/directx: unify the naming convention with glfwwin 2022-05-29 21:18:23 +09:00
Hajime Hoshi
0081fa7a47 internal/graphicsdriver/directx: add a comment 2022-05-29 20:05:37 +09:00
Hajime Hoshi
ad380a32f4 internal/glfwwin: split GDK part to a new package internal/microsoftgdk
Updates #1162
2022-05-29 19:25:26 +09:00
Hajime Hoshi
7f46938ff7 internal/glfwwin: return an error at initWGL on Xbox
Updates #1162
2022-05-29 17:37:06 +09:00
Hajime Hoshi
59e6d4578b internal/glfw: skip some Win32APIs for Xbox
Updates #1162
2022-05-29 17:04:47 +09:00
Hajime Hoshi
ce147a7e38 internal/glfwwin: refactoring: remove Monitor.currentMode 2022-05-29 16:00:18 +09:00
Hajime Hoshi
2efbb819e0 internal/glfw: skip some Win32APIs for Xbox
Updates #1162
2022-05-29 15:54:37 +09:00
Hajime Hoshi
05d49c5a52 internal/glfwwin: create a pseudo monitor for Xbox
Updates #1162
2022-05-29 15:38:17 +09:00
Hajime Hoshi
f8163f93c0 internal/glfwwin: refactoring 2022-05-29 14:22:22 +09:00
Hajime Hoshi
ef7d10a36e internal/glfwwin: add a build tag microsoftgdk
Updates #1162
2022-05-29 01:31:42 +09:00
Hajime Hoshi
5c63c4a4aa internal/graphicsdriver/metal: support macOS 10.12 by removing packed types
From the Metal shading language specification [1] Table 2.2.3, attribute
variables in Ebitengine's vertices don't have to be packed. Then, we can
remove `packed` types.

[1] https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf

Closes #2107
2022-05-28 23:57:59 +09:00
Hajime Hoshi
ac922742bf internal/glfw: use shorter copyright comments 2022-05-27 20:38:45 +09:00
Hajime Hoshi
f7d1a43e98 internal/glfwwin: remove GammaRamp 2022-05-27 20:19:12 +09:00
Hajime Hoshi
df0208ec79 internal/glfwwin: remove unused exported functions 2022-05-27 20:15:36 +09:00
Hajime Hoshi
3a6b707b29 internal/glfwwin: remove unused members (a monitor size) 2022-05-27 20:12:43 +09:00
Hajime Hoshi
d577cc5e7d internal/graphicsdriver/opengl/gl: rename files
Updates #1162
2022-05-27 18:31:40 +09:00
TotallyGamerJet
726e88e520
internal/graphics/opengl/gl: remove CGO in openGL on macOS (#2104)
Updates #1162
2022-05-27 18:26:53 +09:00
Hajime Hoshi
f7172f41c8 internal/glfwwin: skip detecting monitors for Xbox
Updates #2084
2022-05-27 15:55:23 +09:00
Hajime Hoshi
c379873a1f rename Ebiten -> Ebitengine 2022-05-25 22:48:19 +09:00
Hajime Hoshi
1202e66114 internal/gamepad: bug fix: out of range at hatState on Windows
Closes #2103
2022-05-25 11:44:46 +09:00
Hajime Hoshi
7030840efa internal/graphicsdriver/opengl/gl: refactoring 2022-05-25 02:24:40 +09:00
Hajime Hoshi
604f14d2d4 internal/glfwwin: refactoring: reduce risky unsafe.Pointer usages 2022-05-25 02:21:30 +09:00
Hajime Hoshi
0d7062335e internal/glfwwin: remove GetProp and SetProp
GetProp and SetProp forced a risky usage of pointers.
2022-05-25 02:11:00 +09:00
Hajime Hoshi
ec2df98c70 internal/glfwwin: skip functions for Xbox
Updates #2084
2022-05-25 02:00:59 +09:00
Hajime Hoshi
847357c3ea internal/glfwwin: remove an unused function GetKeyName
MapVirtualKeyW is not available on Xbox.

Updates #2084
2022-05-25 01:00:32 +09:00
Hajime Hoshi
ffc9a0876a internal/glfwwin: remove changing the foreground lock timeout
See 58b48a3a00

Updates #2084
2022-05-25 00:34:54 +09:00
Hajime Hoshi
55657e72ae internal/ui: skip hideConsoleWindowOnWindows in Xbox
Updates #2084
2022-05-25 00:13:28 +09:00
Hajime Hoshi
3745c0a2e0 internal/graphicsdriver/opengl/gl: remove an unused function GetBufferSubData
This is basically a revert of 86a0c7aa82
2022-05-24 20:45:45 +09:00
Hajime Hoshi
a1370a4791 internal/graphicsdriver/opengl: remove an unused member gl.getBufferSubData 2022-05-24 20:40:53 +09:00
Hajime Hoshi
f888b7868b internal/graphicsdriver/opengl: fix the error message when GenFramebufferEXT fails 2022-05-23 22:25:40 +09:00
Hajime Hoshi
6cd655b5ce internal/glfwwin: bug fix: error values were not returned 2022-05-22 22:05:48 +09:00
Hajime Hoshi
0577a28aed all: add struct members for go-vet
Updates #1306
2022-05-22 22:05:40 +09:00
Hajime Hoshi
ad5ebae3cc internal/ui: refactoring 2022-05-22 21:53:42 +09:00
Hajime Hoshi
4396785829 Revert "internal/graphicsdriver/opengl: remove CGO in opengl for macOS (#2091)"
This reverts commit f7e21983cf.

Reason: test failures (#2102)

Closes #2102
2022-05-22 01:24:48 +09:00
TotallyGamerJet
f7e21983cf
internal/graphicsdriver/opengl: remove CGO in opengl for macOS (#2091)
Updates #1162
2022-05-22 00:58:45 +09:00
Hajime Hoshi
7eeef3ae0f internal/glfwwin: bug fix: WGL extension functions didn't work
Closes #2101
2022-05-22 00:40:50 +09:00
Hajime Hoshi
8d3de6207b internal/gamepad: add a warning message when getGamepads is not available
Updates #2100
2022-05-21 23:25:56 +09:00
Hajime Hoshi
8d318fc4de internal/gamepad: bug fix: getGamepads might not be available under a non-secure context
Closes #2100
2022-05-21 23:22:50 +09:00
Hajime Hoshi
6fa39d5e73 internal/glfw: make panic messages consistent 2022-05-21 13:19:11 +09:00
Hajime Hoshi
9a1eb0b124 internal/glfwwin: bug fix: wrong type casts (TlsGetValue) 2022-05-21 00:59:14 +09:00
Hajime Hoshi
93731673ad internal/glfwwin: bug fix: wrong type casts 2022-05-21 00:56:22 +09:00
Hajime Hoshi
374f1cf8e6 internal/glfwwin: fix typo 2022-05-21 00:18:36 +09:00
Hajime Hoshi
bd2a31bdd8 internal/glfwwin: remove unnecessary comments 2022-05-20 23:17:03 +09:00
Hajime Hoshi
8c467aaa1b internal/glfwwin: update GLFW to 3.3.7
Reference: 597ae79a86
2022-05-20 23:09:16 +09:00
Hajime Hoshi
f67b4cc1d6 internal/glfw: use a pure Go implementation of GLFW
This change removes internal/glfw/glfw, that is a DLL loader, and
replaces the usages with internal/glfwwin, that is a pure Go
implementation of GLFW for Windows.

The build tag `ebitenexternaldll` is also removed.

Closes #1764
2022-05-20 22:10:00 +09:00
Hajime Hoshi
edd617f80e internal: add a new package glfwwin
internal/glfwwin is a pure Go implementation of GLFW for Windows.

Updates #1764
2022-05-20 21:36:13 +09:00
Hajime Hoshi
eec5ea00ec internal/glfw: refactoring: use pointers or functions for callbacks 2022-05-20 17:49:46 +09:00
Hajime Hoshi
8d2b08dd14 internal/glfw: refactoring: make callback handlers consistent 2022-05-19 01:49:21 +09:00
Hajime Hoshi
7189c7f649 internal/glfw: refactoring: remove unused APIs
Ebiten doesn't rely on GLFW for gamepads.
2022-05-19 01:04:23 +09:00
Hajime Hoshi
fef79f4d3e internal/graphicsdriver/metal: update the minimum version of macOS
Updates #2095
2022-05-18 00:09:04 +09:00
Hajime Hoshi
3d00bb1fa2 internal/gamepad, internal/ui: type-cast returning values from Win32APIs just in case 2022-05-11 00:48:44 +09:00
Hajime Hoshi
812607cdfc internal/processtest/testdata: add a test case for #2089
Updates #2089
2022-05-08 23:45:21 +09:00
Hajime Hoshi
faf1e7350d internal/atlas: bug fix: wrong logic to create a new mask with edges
* Fixed wrong operator orders
 * Cleared an allocated region explicitlly

Closes #2089
2022-05-08 23:06:10 +09:00
Hajime Hoshi
7409f01b17 internal/graphicsdriver/metal/mtl: bug fix: specify the language version explicitly
Updates #2086
2022-05-05 23:50:48 +09:00
Hajime Hoshi
a0e1d08123 internal/graphicsdriver/directx: update comments
Updates #2081
2022-04-26 11:20:48 +09:00
Hajime Hoshi
7321e86a6b internal/graphicsdriver/directx: bug fix: the screen image can be nil when resizing the window
Closes #2081
2022-04-26 11:19:48 +09:00
Hajime Hoshi
38a2aa11fd internal/ui: bug fix: deadlock at Layout with Ebiten's image functions called
Closes #2079
2022-04-26 01:12:57 +09:00
Hajime Hoshi
dc811f9329 internal/gamepaddb: bug fix: crash at addAndroidDefaultMappings
Closes #2076
2022-04-19 23:36:02 +09:00
Hajime Hoshi
928d82c685 internal/atlas: potential bug fix: restore images before other image manipulations
From the reported stack trace, there could be a potential issue in
atlas.BeginFrame: images were manipulated before the images are restored.
Restoring images assumes that all images are not stale, but manipulating
images like putOnAtlas might cause other images stale in ReplacePixels.

Though we failed to reproduce the case, this fix should make sense.

Updates #2075
2022-04-18 02:19:46 +09:00
Hajime Hoshi
2fc691f661 internal/clock: rename CurrentFPS/TPS -> ActualFPS/TPS 2022-04-14 00:57:47 +09:00
Hajime Hoshi
f25dda1318 internal/clock: force to sync the timer when TPS is updated 2022-04-14 00:56:37 +09:00
Hajime Hoshi
2a5b5b4823 internal/ui: avoid a busy loop in restoreWindow
Updates #1826
2022-04-10 17:55:39 +09:00
Hajime Hoshi
3fe1df8b3b internal/ui: bug fix: ebiten.WindowSize() returned (1,1) when iconified 2022-04-10 16:50:47 +09:00
Hajime Hoshi
aae866350a internal/ui: bug fix: (*glfw.Window).GetSize() returns (0,0) when iconified
Closes #2066
2022-04-10 16:43:03 +09:00
Hajime Hoshi
d3b83dd4ea internal/ui: refactoring 2022-04-09 18:23:56 +09:00
Hajime Hoshi
fcb7df0a59 internal/ui: bug fix: checking fullscreen on Safari was wrong 2022-04-09 17:25:19 +09:00
Hajime Hoshi
a69be34001 internal/ui: update the error message for fullscreen 2022-04-09 16:55:09 +09:00
Hajime Hoshi
853d94c3ef internal/shader: implement strict type checks when calling a function
Closes #2032
2022-04-09 00:32:27 +09:00
Hajime Hoshi
15fe7158fd internal/shader: implement strict type checks in assignments
Closes #1972
2022-04-09 00:02:20 +09:00
Hajime Hoshi
93b4c0d9b1 internal/ui: add comments
Updates #1590
2022-04-08 18:40:13 +09:00
Hajime Hoshi
2008916261 internal/ui: bug fix: use the native unit for origWindowPosByOS 2022-04-08 16:43:13 +09:00
Hajime Hoshi
90070c09fe internal/ui: rename origPos -> origWindowPos 2022-04-08 15:59:16 +09:00
Hajime Hoshi
352d332097 internal/ui: remove redundant comments 2022-04-08 15:51:56 +09:00
Hajime Hoshi
ee124baf60 internal/ui: bug fix: WindowSize returned a wrong value on fullscreen on macOS
Closes #2062
2022-04-08 14:57:51 +09:00
Hajime Hoshi
ad66c3d90b internal/png: clean up files before generating 2022-04-06 11:48:46 +09:00
Hajime Hoshi
20beb9d2b8 internal/gamepaddb: update the database
Updates #1902
2022-04-06 11:41:05 +09:00
Hajime Hoshi
6e19c793f6 internal/png: update for Go 1.18 2022-04-06 11:32:48 +09:00
Hajime Hoshi
32de5ec2d0 internal/graphics: refactoring 2022-04-05 11:12:25 +09:00
Hajime Hoshi
c6e5582c56 Revert "internal/graphics: refactoring"
This reverts commit b6cc164e96.

Reason: wrong shader program
2022-04-04 14:31:37 +09:00
Hajime Hoshi
b6cc164e96 internal/graphics: refactoring 2022-04-04 14:30:51 +09:00
Hajime Hoshi
c56665b23c internal/processtest: bug fix: shadernomain is no longer a valid test
Updates #2035
2022-04-04 03:12:34 +09:00
Hajime Hoshi
736d77e0d2 internal/graphicsdriver: remove Graphics.NDCYDirection 2022-04-04 03:03:44 +09:00
Hajime Hoshi
6710808cd1 ebiten: compile shaders at NewShader
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
02db3bad53 internal/graphicscommand: remove the dependency on a graphics driver from compileShader
Updates #2035
2022-04-04 02:09:08 +09:00
Hajime Hoshi
4b0967be42 internal/ui: gofmt 2022-04-04 01:48:15 +09:00
Hajime Hoshi
f756be3d22 internal/devicescale: bug fix: glfw.Monitor.GetContentScale might return 0
Retrying to call GetContentScale solved this.

Closes #2051
2022-04-03 19:32:01 +09:00
Hajime Hoshi
f1f9f74e5c internal/ui: bug fix: force to refresh the framebuffer by resizing the window very quickly
Closes #2050
2022-04-03 18:43:22 +09:00
Hajime Hoshi
65094c61b1 internal/graphicscommand: reland: merge adjacent commands if the same shader and uniform variables are used
Closes #1846
2022-04-03 03:57:49 +09:00
Hajime Hoshi
f75a70dc40 internal/graphicscommand: treat []float32 instead of interface{} for uniform variables 2022-04-03 03:51:52 +09:00
Hajime Hoshi
990228e216 internal/graphicscommand: cache uniform name locations and types 2022-04-03 03:28:11 +09:00
Hajime Hoshi
9be454ef25 internal/graphicsdriver: remove an old comment 2022-04-03 02:53:43 +09:00
Hajime Hoshi
9f3f9e64cc internal/graphicscommand: add panic at convertUniforms 2022-04-03 00:39:05 +09:00
Hajime Hoshi
b52a02a178 internal/ui: bug fix: crash when Image.MarkDisposed is called multiple times
Closes #2048
2022-04-03 00:21:26 +09:00
Hajime Hoshi
651c5693c6 Revert "internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used"
This reverts commit 425ce27976.

Reason: test failures
2022-04-03 00:11:15 +09:00
Hajime Hoshi
425ce27976 internal/graphicscommand: merge adjacent commands if the same shader and uniform variables are used
Closes #1846
2022-04-02 23:55:14 +09:00
Hajime Hoshi
33078c764c internal/gamepaddb: make Update atomic
Closes #1978
2022-04-02 20:19:04 +09:00
Hajime Hoshi
3fafc05411 internal/graphicsdriver: remove Graphics.HasHighPrecisionFloat
Updates #879
2022-04-02 05:19:30 +09:00
Hajime Hoshi
351ef9fbb7 internal/atlas, internal/graphicsdriver: move the adjusting-pixel logic to atlas
Now pixels are adjusted even when the graphics driver doesn't have
high-precision floats, but this should not be problematic. This was
introduced at 9bff33472a, but the
adjusting way is much different from the current way.

Updates #879
Closes #1820
2022-04-02 05:15:29 +09:00
Hajime Hoshi
34e23f5256 internal/restorable: treat texels instead of pixels
Updates #1820
2022-04-02 04:25:27 +09:00
Hajime Hoshi
0c6362c93a internal/atlas: move the color scaling from internal/atlas to ebiten
Updates #1820
2022-04-02 02:47:56 +09:00
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
9c448d207a internal/ui: remove an unnecessary alias 2022-04-01 21:17:26 +09:00
Hajime Hoshi
b53cb2acd6 internal/ui, internal/mipmap, internal/graphicscommand: fix a wrong panic message 2022-04-01 20:12:12 +09:00
Hajime Hoshi
8e40b2562e internal/ui: remove an error returning value from Game.Draw 2022-04-01 19:10:10 +09:00
Hajime Hoshi
ea1c18d124 internal/ui: rename contextImpl -> context 2022-04-01 17:59:44 +09:00
Hajime Hoshi
09a548e055 internal/ui: consider the case when currentMonitor() returns nil
Closes #1887
2022-04-01 03:51:28 +09:00
Hajime Hoshi
07a7aca1b3 internal/gamepad: skip gamepads with more than 32 buttons
This change was removed at ef45058037
accidentally.

Updates #1173
Updates #2039
2022-04-01 02:24:15 +09:00
Hajime Hoshi
b5a9ff007c internal/ui: bug fix: WindowPosition/SetWindowPosition didn't work on macOS fullscreen
Updates #1590
Closes #2043
2022-03-30 12:10:48 +09:00
Hajime Hoshi
172da82aa7 internal/ui: optimization: reduce u.t.Call 2022-03-30 03:28:18 +09:00
Hajime Hoshi
f2860bebed internal/ui: remove an unnecessary hack to resize the window
The bug (#1606) is no longer reproducible even without the hack.

Updates #1606
Updates #1609
2022-03-30 02:48:39 +09:00
Hajime Hoshi
feb70963c6 internal/ui: force to put the window in the initial monitor
To make things simple, let's not put the window outside the initial
monitor.

Updates #1351
Closes #1575
2022-03-30 01:56:35 +09:00
Hajime Hoshi
07d6419dc6 internal/ui: bug fix: DeviceScaleFactor was not concurrent-safe before the main loop
Updates #1575
Closes #2042
2022-03-29 00:27:44 +09:00
Hajime Hoshi
2d912a2387 internal/shaderir/hlsl: bug fix: wrong offset of uniform array variables
Closes #2038
2022-03-27 01:49:52 +09:00
Hajime Hoshi
aef00a5235 internal/shader: bug fix: wrong type deduction at (scalar)*(matrix)
Updates #2037
2022-03-27 01:22:54 +09:00
Hajime Hoshi
6bd3c81e27 internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix-array variables were passed wrongly
Updates #2036
2022-03-27 00:32:30 +09:00
Hajime Hoshi
eaad959472 internal/graphicsdriver/metal: remove println 2022-03-27 00:12:34 +09:00
Hajime Hoshi
f6d87f6ee8 internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix variables were passed wrongly
Updates #2036
2022-03-26 23:58:48 +09:00
Hajime Hoshi
79e93d3b12 internal/graphicsdriver: introduce the DirectX driver
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
a936ffc032 internal/shader: restrict the number of arguments for atan/atan2 2022-03-26 19:40:04 +09:00
Hajime Hoshi
d30a31b16c internal/shaderir/hlsl: add function forward declarations 2022-03-26 19:10:03 +09:00
divVerent
1de1bfef55
internal/gamepad: fix uint16 underflow handling in gamepads. (#2030)
Fixes crash where Ebiten considers a keyboard a gamepad with way too many buttons.

Updates #2027
2022-03-26 15:41:59 +09:00
Hajime Hoshi
dcccd27629 internal/shaderir/msl: bug fix: mod for a vector and a scalar didn't work
Updates #2029
2022-03-26 02:57:38 +09:00
Hajime Hoshi
52376170a4 internal/shaderir: bug fix: float4x4(x) initialized all the components unexpectedly
See https://docs.microsoft.com/en-us/windows/win32/direct3d9/casting-and-conversion#parameter-value-modifiers

Updates #1007
2022-03-26 02:05:35 +09:00
Hajime Hoshi
cfd0de5c41 internal/shaderir: make outputs for unexpected operators consistent 2022-03-26 01:40:02 +09:00
Hajime Hoshi
4893b13acc internal/shaderir: add internal/shaderir/hlsl
Updates #1007
2022-03-26 01:31:05 +09:00
Hajime Hoshi
9bfbbb6e9e internal/ui: add graphicsDriverGetter.getDirectX()
Updates #1007
2022-03-25 19:43:38 +09:00
Hajime Hoshi
e4d0050452 internal/gamepad: bug fix: compile error
Updates #2027
2022-03-25 14:35:03 +09:00
Hajime Hoshi
b985689010 internal/gamepad: bug fix: crash when a too big button code is reported on Linux
Updates #2027
2022-03-25 14:28:09 +09:00
Hajime Hoshi
c61be3c532 internal/ui: bug fix: getMetal might return a nil pointer as a non-nil interface 2022-03-24 13:36:53 +09:00
Hajime Hoshi
eeb5687b73 internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to pointers
On second thought, returning pointers is more natural. Handling
nil is a caller's responsibility.
2022-03-24 13:20:36 +09:00
Hajime Hoshi
7bb7e45522 internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to interface
Converting a nil with a pointer type to an interface type is no longer
a nil-nil interface, and then comparing with nil causes an unexpected
results.
2022-03-24 03:24:58 +09:00
Hajime Hoshi
3074dca670 internal/ui: add the EBITEN_GRAPHICS_LIBRARY environment variable
The `ebitengl` build tag is gone instead.

Closes #2007
2022-03-24 02:23:37 +09:00
Hajime Hoshi
151dfffad6 internal/restorable: simplify canDetectContextLostExplicitly
This constant was set with some wrong assumptions:

 1. On Android, recovering was needed.
 2. On iOS, OpenGL ES was used when
    a. The architecture was 386 or amd64 == an emulator is used
    b. The build tag ebitengl was not specified
    c. gomobile-build was used
 3. On browsers, recovering was needed.

1., 2b, and 2c are correct.

2a. is not correct: Now emulators are available on all the
architectures with both Metal and OpenGL.

3. is not correct: Ebiten no longer recovers the contest lost.

Now, Ebiten can detect a context lost explicitly when

 1. On Android
 2. On iOS and on gomobile-build
    (When gomobile-build is used, OpenGL should always be used)

Based on this fact, this change changes the constant to a variable,
and fixes the logic to set the variable.
2022-03-23 03:01:59 +09:00
Hajime Hoshi
85daef7436 internal/ui: bug fix: OpenGL must be used when gomobile-build is used
Now the logic of graphicsDriver() is updated, this can return a Metal
graphics driver on iOS even when gomobile-build is used.

This change fixes this issue.
2022-03-23 02:58:56 +09:00
Hajime Hoshi
09b0a0ffaf internal/ui: refactoring: simplify the selection of graphics libraries 2022-03-23 02:21:53 +09:00
Hajime Hoshi
7e6e022065 cmd/ebitenmobile: support Metal for iOS simulators 2022-03-23 01:34:58 +09:00
Hajime Hoshi
a74e7b1578 Revert "internal/graphicsdriver/metal: refactoring"
This reverts commit 1c57393393.

Reason: nothing is rendered on iOS.

Closes #2022
2022-03-23 01:22:39 +09:00
Hajime Hoshi
8e6907c64a internal/ui: reduce the calls of graphicsDriver() 2022-03-22 02:17:41 +09:00
Hajime Hoshi
15548b4c74 internal/ui: add userInterfaceImpl.graphicsDriver 2022-03-22 00:13:22 +09:00
Hajime Hoshi
be1836339b internal/ui: define the common struct UserInterface for all the environments
The existing UserInterface structs became userInterfaceImpl structs.
2022-03-21 23:10:27 +09:00
Hajime Hoshi
99437944bc internal/ui: remove graphicsDrivre() calls from image.go 2022-03-21 22:49:47 +09:00
Hajime Hoshi
cd57bccbfc internal/graphicsdriver: let some functions return an error
This is a preparation for the DirectX driver.

Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
0dcf43b350 internal/graphicsdriver: reorder the member 2022-03-21 22:05:21 +09:00
Hajime Hoshi
5e973ab419 Revert "internal/graphicscommand: clear the queue regardless of an error"
This reverts commit e21636fbb9.

Reason: Simply this is no longer needed. We gave up testing when an error
occurs in a graphics command queue.
2022-03-21 21:57:59 +09:00
Hajime Hoshi
31104c4e79 internal/processtest: remove TestShaderNoMain and add shadernomain.go
A shader compilation error breaks the state of the graphics command
queue, and this cannot be reused. Thus, a process test is appropriated.
2022-03-21 21:52:38 +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
e21636fbb9 internal/graphicscommand: clear the queue regardless of an error
There was a potential issue that commands in the queue are never
reset when an error happens and the queue continues to send errors.
This is problematic especially for testings.

This change fixes the issue by Go's defer.
2022-03-21 20:10:03 +09:00
Hajime Hoshi
ad0e0e3e66 internal/graphicscommand: remove an unused member 2022-03-21 19:50:05 +09:00
Hajime Hoshi
9b1adf799d internal/shader: move syntax tests to internal/shader 2022-03-21 19:31:06 +09:00
Hajime Hoshi
b5bb576a58 internal/ui: refactoring: unexport ConvertUniforms 2022-03-21 17:05:50 +09:00
Hajime Hoshi
f4ad12987d internal/ui: bug fix: compile error with the cbackend tag 2022-03-21 16:59:53 +09:00
Hajime Hoshi
12ce5ae83a internal/ui: remove the call of graphicsDriver() from the context 2022-03-21 16:48:33 +09:00
Hajime Hoshi
fc96eb30a1 internal/atlas: simplify the logic by adding paddings to the mask 2022-03-21 16:13:21 +09:00
Hajime Hoshi
870a18e8f5 internal/buffered: remove unnecessary conditions from resolvePendingPixels 2022-03-21 15:27:21 +09:00
Hajime Hoshi
4b31983b6d internal/buffered: English 2022-03-21 15:20:52 +09:00
Hajime Hoshi
c316aaae72 internal/buffered: simplify the API 2022-03-21 15:19:06 +09:00
Hajime Hoshi
5c3f8915d1 internal/atlas: add an argument check 2022-03-21 15:11:38 +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
4f070915b2 internal/atlas: bug fix: do not use the padding when a mask is specified
With paddings, a mask size was not appropriate.

As a simple solution, let's not use paddings when a mask is specified.
2022-03-21 05:50:31 +09:00
Hajime Hoshi
dfc9eeaaec internal/restorable: bug fix: the parameter mask was not passed correctly 2022-03-21 05:40:13 +09:00
Hajime Hoshi
fbcbd2a001 internal/buffered: refactoring 2022-03-21 04:36:32 +09:00
Hajime Hoshi
b3f4d6c522 internal/atlas: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:56:04 +09:00
Hajime Hoshi
5c79b86412 internal/restorable: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:08:58 +09:00
Hajime Hoshi
e55dbbf3cd internal/restorable: add more tests 2022-03-21 03:04:52 +09:00
Hajime Hoshi
72a6ab8da4 internal/restorable: add more tests 2022-03-21 02:44:48 +09:00
Hajime Hoshi
924f7ea932 internal/restorable: refactoring 2022-03-21 01:26:48 +09:00
Hajime Hoshi
5fe6791b5d internal/graphicscommand: add a new paramter 'mask' to ReplacePixels 2022-03-21 01:11:01 +09:00
Hajime Hoshi
c1a0d83f8d internal/restorable: simplify the implementation of rect
Allow overlapped regions at pixelsRecords.

This removes the members `last*` for caching. These were introduced
at 7e7751bd43, and apparently these
are no longer needed.
2022-03-21 00:06:30 +09:00
Hajime Hoshi
ea81d4abf4 internal/buffered: refactoring 2022-03-20 19:03:41 +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
367a9ec5bf internal/atlas: refactoring 2022-03-20 18:07:29 +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
bd07f6246f internal/buffered: remove mysterious comments 2022-03-20 05:17:43 +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
Hajime Hoshi
3e44a20b22 internal/graphicscommand: swap arguments 2022-03-20 00:09:17 +09:00
Hajime Hoshi
8e3576b404 internal/mipmap: remove unused functions 2022-03-19 23:45:15 +09:00
Hajime Hoshi
7c2300b352 internal/graphicscommand: reduce the usages of the graphicsDriver function 2022-03-19 23:03:34 +09:00
Hajime Hoshi
58366ce64d internal/glfw: make the file operation atomic
If multiple Ebiten processes start at the same time, the file operation
can cause a race condition. Add a file lock to avoid this.
2022-03-18 20:32:25 +09:00
Hajime Hoshi
2e6bb8c4e2 internal/graphicsdriver/metal: add comments 2022-03-14 22:02:44 +09:00
Hajime Hoshi
a617576879 internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
This is a preparation for DirectX / HLSL.

Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
044d41dd2d internal/shaderir: change Op from string to int
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.

Updates #1007
2022-03-13 16:20:04 +09:00
Hajime Hoshi
7d0f95e9be internal/graphicsdriver: refactoring: replace Uniform with []float32
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
35a5c88901 internal/graphics: rename constants 2022-03-12 04:01:48 +09:00
Hajime Hoshi
98e2d86ea3 internal/shaderir/msl: refactoring 2022-03-12 00:18:55 +09:00
Hajime Hoshi
5715539a0f internal/shaderir/glsl, internal/shaderir/msl: refactoring 2022-03-11 15:18:38 +09:00
Hajime Hoshi
e63709a2a5 internal/shaderir/glsl: refactoring 2022-03-11 02:03:15 +09:00
Hajime Hoshi
6f00221051 internal/shaderir/msl: rename the package name
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
5f97bdc1d3 internal/shader: fix typo
Updates #2011
2022-03-10 02:54:32 +09:00
Hajime Hoshi
5614e9d7eb internal/shader: fix misspellings 2022-03-10 02:52:44 +09:00
Hajime Hoshi
880dd0682e internal/shader: bug fix: fix some failing tests 2022-03-10 02:24:29 +09:00
Hajime Hoshi
d3b72d4ef9 internal/shader: add test files
Updates #2011
2022-03-10 01:02:51 +09:00
Hajime Hoshi
de05ede27e internal/shader: bug fix: evaluate the builtin float/int functions in the pre-compile phase correctly
Closes #2011
2022-03-10 00:47:16 +09:00
Hajime Hoshi
47bfd0db9e internal/shaderir/metal: rename to msl
Closes #2010
2022-03-10 00:14:06 +09:00
Hajime Hoshi
5e5e3c64ac internal/shaderir/metal: remove a redundant case 2022-03-09 02:54:31 +09:00
Hajime Hoshi
15064dbdc1 internal/shaderir/glsl, internal/shaderir/metal: simplify function names 2022-03-09 01:43:36 +09:00
Hajime Hoshi
e4fba8b047 bug fix: compile error with Go 1.16 and older 2022-03-08 00:08:53 +09:00
Hajime Hoshi
86ba7719eb internal/ui: bug fix: use CompareAndSwap 2022-03-07 23:51:10 +09:00
Hajime Hoshi
c37ffecafd internal/graphicsdriver/metal: reorder uniform variables
This might improve memory allocations.

This makes the code more consistent with HLSL's packing rule [1]

[1] https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules
2022-03-05 22:12:08 +09:00
Hajime Hoshi
9c6b7aaca3 internal/ui: catch the error at At correctly 2022-03-05 01:44:59 +09:00
Hajime Hoshi
df2133186d internal/shaderir: bug fix: test failures 2022-03-04 19:01:58 +09:00
Hajime Hoshi
3c1e64dd67 internal/shaderir/metal: bug fix: define the 'mod' function correctly
Closes #2006
2022-03-04 18:05:44 +09:00
Hajime Hoshi
d4d4b9c070 internal/graphicsdriver/metal, internal/graphicsdriver/opengl: more efficient modulo 2022-03-04 03:47:55 +09:00
Hajime Hoshi
ed22052e5f internal/graphicscommand: add a comment 2022-02-28 00:15:52 +09:00
Hajime Hoshi
dd8900ea48 internal/graphicsdriver: refactoring: choose the graphics driver at this package 2022-02-27 23:51:19 +09:00
Hajime Hoshi
99f8e335ee ebiten: refactoring 2022-02-27 22:21:57 +09:00
Hajime Hoshi
77f765d483 internal/testing: bug fix: considering the case when Y is inverted
Closes #2003
2022-02-27 22:14:32 +09:00
Hajime Hoshi
4ca1220671 internal/graphicscommand: bug fix: compile error, test failures 2022-02-27 20:13:21 +09:00
Hajime Hoshi
b22309a0e5 internal/graphicsdriver: replace Pixels with ReadPixels
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
1cb7633ff6 internal/ui: bug fix: atomic.Value.Store cannot be called when a differnet type value is already stored 2022-02-27 17:41:19 +09:00
Hajime Hoshi
566957dc1c internal/graphicsdriver/metal: invert Y at the vertex shader
Instead of using a negative height in the viewport, invert the Y direction
at the vertex shader. This is a little more readable as a negative height
is hacky.

This is a preparation for DirectX 12. DirectX 12's coodination system
is very similar to Metal, but doesn't treat a negative height in its
viewport unfortunately.

Updates #1007
2022-02-27 01:53:03 +09:00
divVerent
ea35296be7
ebiten: provide SetScreenFilterEnabled, a way to disable the default screen filter (#1997)
Using FilterNearest rather than filterScreen or FilterLinear speeds up a
Dell E6500 from 23fps->36fps and 27fps->48fps.

Updates #1772
2022-02-24 03:46:27 +09:00
divVerent
f2209a0b51
internal/atlas: optimization: send premultiplied alpha from vertex to fragment shader. (#1996)
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.

Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.

I assume this is a strict improvement, however this may warrant some testing.

Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.

Updates #1772
2022-02-24 02:27:50 +09:00
divVerent
476f4e3f9a
internal/gamepad: fix SetWindowLongPtrW crash on 32-bit Windows (#1999)
Closes #1998
2022-02-23 23:18:20 +09:00
Hajime Hoshi
8b7273b74a internal/graphicsdriver/metal: call PresentDrawable only when necessary 2022-02-22 01:37:13 +09:00
Hajime Hoshi
ee911fd892 internal/graphicsdriver/metal: fix an error message 2022-02-20 22:01:36 +09:00
Hajime Hoshi
bf33658e64 internal/gamepad: respect original names more 2022-02-15 04:07:11 +09:00
Hajime Hoshi
f17d222a4b internal/atlas: resolve deferred every frame instead of every tick
Resolving defferred functions doesn't have to be done every tick. Rather,
this should be done every frame as this is related to rendering.
2022-02-14 03:45:58 +09:00
Hajime Hoshi
4949c49cd0 internal/ui: refactoring 2022-02-14 03:39:02 +09:00
Hajime Hoshi
871121abe3 internal/ui: refactoring: remove (*contextImpl).layout 2022-02-14 02:59:02 +09:00
Hajime Hoshi
cffa123405 internal/ui: refactoring: remove sizeChanged for js
It is safe to call Layout every frame.
2022-02-14 02:50:32 +09:00
Hajime Hoshi
e2f0878a4c internal/ui: refactoring: remove sizeChanged
It is safe to call Layout every frame.
2022-02-14 02:17:52 +09:00
Hajime Hoshi
fcd4453e4f ebiten: remove RunOnMainThread
Unfortunately, there are several issues in RunOnMainThread:

 * RunOnMainThread cannot be portable: It is impossible to implement this
   correctly on mobiles.
 * RunOnMainThread doesn't make sense on mobiles: the rendering works on
   a different thread (goroutine) on mobiles.
 * RunOnMainThread can cause deadlocks very easily.

Until we find a better solution, let's remove this.

Closes #1945
2022-02-14 01:49:42 +09:00
Hajime Hoshi
e09c1bf8f1 internal/ui: refactoring: remove an error value from runOnAnotherThreadFromMainThread 2022-02-14 00:55:58 +09:00
Hajime Hoshi
ce3f83958e internal/graphicscommand: rename RunOnMainThread -> RunOnRenderingThread 2022-02-14 00:20:49 +09:00
Hajime Hoshi
b695cb928a internal/ui: remove RunWithoutMainLoop in non-mobile environments 2022-02-13 22:31:48 +09:00
Hajime Hoshi
82b9f7dc56 ebiten: refactoring: remove setScreenClearedEveryFrame 2022-02-13 20:40:46 +09:00
Hajime Hoshi
0c1c40995c internal/ui: rename types and members: uiContext -> gameForUI 2022-02-13 20:20:46 +09:00
Hajime Hoshi
29382b424b internal/ui: refactoring: remove some exposed functions 2022-02-13 20:09:13 +09:00
Hajime Hoshi
08defeeded internal/ui: move more logics to internal/ui 2022-02-13 20:02:49 +09:00
Hajime Hoshi
9b2f0b6c56 internal/ui: rename ResetForFrame -> ResetForTick
Resetting happens every tick, not every frame.
2022-02-13 19:54:40 +09:00
Hajime Hoshi
a2cb9fda82 internal/ui: make adjustPosition concurrent-safe 2022-02-13 19:52:39 +09:00
Hajime Hoshi
31aa01131d ebiten: refactoring: reduce call of ui.Get() 2022-02-13 19:40:48 +09:00
Hajime Hoshi
6a8e45e6c1 internal/ui: refactoring: simplify ResetForFrame
Updating the layout is already done every frame, so doing this in
ResetForFrame is not needed.

Updates #490
2022-02-13 19:31:35 +09:00
Hajime Hoshi
7b164882fc internal/ui: refactoring: move AdjustPosition to the package internal/ui 2022-02-13 19:14:29 +09:00
Hajime Hoshi
08ae7006ef internal/ui: refactoring: move some logics to internal/ui 2022-02-13 19:02:59 +09:00
Hajime Hoshi
2609d73a1a internal/ui: refactoring: move some logics to internal/ui 2022-02-13 18:01:18 +09:00
Hajime Hoshi
b282b1805b internal/ui: refactoring: add ui.SetError
This is a preparation to move uiContext to the package internal/ui.
2022-02-13 17:17:08 +09:00
Hajime Hoshi
ab1ad2c72f .github/workflow: add a test to build with the build tag ebitencbackend 2022-02-13 16:57:48 +09:00
Hajime Hoshi
73d995740f internal/ui: bug fix: compile error with ebitencbackend 2022-02-13 16:48:30 +09:00
Hajime Hoshi
e9cfbc1630 internal/ui: refactoring: remove Graphics() 2022-02-13 04:17:39 +09:00
Hajime Hoshi
1c57393393 internal/graphicsdriver/metal: refactoring 2022-02-13 01:00:20 +09:00
Hajime Hoshi
5f59807284 internal/gamepad: refactoring 2022-02-12 03:49:09 +09:00
Hajime Hoshi
ab5daa0f90 internal/ui: separate graphics_ios.go to each archtecture
This change removes the support of 32bit iOS. 32bit iOS is no longer
supported by Go 1.15.
2022-02-12 02:14:32 +09:00
Hajime Hoshi
162f62f54e internal/graphicsdriver/metal/mtl: bug fix: test compile error 2022-02-11 23:23:22 +09:00
Hajime Hoshi
176e984a58 internal/ui: refactoring: remove dependency on the package mtl 2022-02-11 23:11:49 +09:00
Hajime Hoshi
6f3c6d6c1b internal/graphicsdriver/meta: rename function 2022-02-11 22:47:13 +09:00
Hajime Hoshi
cc4e2f08be internal/graphicsdriver/metal: rename files 2022-02-11 21:49:05 +09:00
Hajime Hoshi
76848f48e6 internal/ui: simplify build tags 2022-02-11 20:47:14 +09:00
Hajime Hoshi
2c2c4bc428 ebiten: add WindowResizingModeType and its constants and functions
This allows a new state to disallow resizing the window but allow
making the window fullscreen on macOS by a user.

This change adds the new type WindowResizingModeType. There are
these constants of this type:

 * WindowResizingModeDisabled
 * WindowResizingModeOnlyFullscreenEnabled
 * WindowResizingModeEnabled

Closes #1819
2022-02-11 04:59:04 +09:00
Hajime Hoshi
f1987cae10 internal/ui: refactoring 2022-02-10 19:35:51 +09:00
Hajime Hoshi
35b9dd0846 internal/ui: give up SetWindowAspectRatioFixed
Unfortunately, it is almost impossible to provide a consistent behavior
to keep the aspect ratio of the window on Windows. Instead of having an
incomplete API, let's remove this.

Closes #1988
2022-02-10 18:35:00 +09:00
Hajime Hoshi
0291986658 internal/ui: bug fix: make the window resizable after the window is created
Making the window resizable BEFORE the window is created doesn't
work correctly, especially when switching to enable resizing later.

Closes #1987
2022-02-10 00:53:22 +09:00
Hajime Hoshi
5899470511 internal/ui: enable vsync even when resizing the window
Now I couldn't see the issue. Probably the implementation of
internal/graphicsdriver/metal has changed since the last fix, but
I am not sure.

Updates #1740
Closes #1954
2022-02-09 23:59:38 +09:00
Hajime Hoshi
edca32e520 internal/ui: bug fix: do not set the minimum window width for macOS
Shrinking a window size by a cursor sometimes makes a smaller window
than 126px. To avoid such flaky behavior, do not set the limitation of
the minimum window width.

On Linux/UNIX, there should not be reasons to limit the window width.

Updates #165
2022-02-09 23:30:26 +09:00
Hajime Hoshi
ad675640b1 internal/ui: bug fix: the aspect ratio should update the window size limits
Updates #1804
2022-02-09 23:18:41 +09:00
Hajime Hoshi
f2da62a175 internal/ui: refactoring 2022-02-09 22:22:14 +09:00
Hajime Hoshi
57c123a412 internal/ui: add comments
Updates #1804
2022-02-09 22:16:31 +09:00
Hajime Hoshi
891ca2a08d ebiten: add IsWindowAspectRatioFixed
This also updates examples/windowsize.

Closes #1804
2022-02-09 20:06:18 +09:00
Hajime Hoshi
7482cae978 internal/ui: bug fix: the aspect ratio must be updated whenever the window size is forcibly updated
This also adds a new flag -aspectratiofixed to examples/windowsize

Updates #1804
2022-02-09 19:56:50 +09:00
Hajime Hoshi
740dfd5aed internal/glfw: refactoring: keep the original API when possible
Updates #1804
2022-02-09 19:36:47 +09:00
Hajime Hoshi
623c050537 ebiten: rename SetKeepWindowAspectRatio -> SetWindowAspectRatioFixed
Updates #1804
2022-02-09 19:29:55 +09:00
Tom Lister
18659ef4ab
internal/ui: add SetWindowKeepAspectRatio (#1985)
Updates #1804
2022-02-09 19:11:25 +09:00
Hajime Hoshi
180eb483bb internal/ui: make currentMonitor return initMonitor when the window is not initialized yet 2022-02-09 00:26:49 +09:00
Hajime Hoshi
b2872f216a internal/ui: update comments
Updates #1575
2022-02-08 20:27:46 +09:00
Hajime Hoshi
cd2ef6771a internal/ui: bug fix: a wrong monitor was used at setWindowPositionInDIP 2022-02-08 20:20:36 +09:00
Hajime Hoshi
9f581327fa intetrnal/ui: remove recreating a window after the fullscreen mode
As macOS's fullscreen is a native fullscreen, this hack is no longer
needed.

Updates #1004
2022-02-08 19:41:09 +09:00
Hajime Hoshi
f8097eb45d internal/ui: give an initial window size at createWindow
This enables to skip setWindowSizeInDIPImpl in most cases.

Updates #1651
Updates #1914
2022-02-08 19:36:30 +09:00
Hajime Hoshi
320e7037f6 internal/ui: update comments 2022-02-08 19:23:38 +09:00
Hajime Hoshi
6dbc5ba558 internal/ui: refactoring: call updateWindowSizeLimits in createWindow 2022-02-08 16:06:12 +09:00
Hajime Hoshi
4c6c31e384 all: reorder build tags in an alphabetical order 2022-02-08 15:49:15 +09:00
Hajime Hoshi
9c8b4db81f internal/ui: separate 'vibrate' part to internal/vibrate 2022-02-08 14:48:55 +09:00
Hajime Hoshi
d2d3673bd2 internal/ui: remove a redundant call of SetTitle 2022-02-08 04:30:58 +09:00
Hajime Hoshi
2fc09c7fcb internal/ui: use the cursor position to choose the initial monitor for Linux/UNIX
Updates #1918
Closes #1982
2022-02-08 03:20:45 +09:00
Hajime Hoshi
294ee43716 internal/ui: remove a special logic for UNIX
The issue #1118 can no longer be reproduced.

Updates #1118
Updates #1982
2022-02-08 01:29:22 +09:00
Hajime Hoshi
cb4085277b internal/ui: bug fix: adjust the window position correctly
Updates #1982
2022-02-07 23:52:16 +09:00
Hajime Hoshi
ed04021151 internal/ui: use the cursor position to choose the initial monitor for Windows
Updates #1918
Updates #1982
2022-02-07 23:31:46 +09:00
Hajime Hoshi
cafb71719c internal/ui: use the cursor position to choose the initial monitor
Updates #1982
2022-02-07 22:37:10 +09:00
Hajime Hoshi
126dc81a96 internal/ui: add a comment 2022-02-07 00:51:48 +09:00
Hajime Hoshi
b78160262c internal/ui: rename files 2022-02-07 00:37:32 +09:00
Hajime Hoshi
f18aef2b08 ebiten: refactoring: move the caller of SetGraphicsDriver to the package ui 2022-02-06 22:01:25 +09:00
Hajime Hoshi
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +09:00
Hajime Hoshi
52f4c409ac internal/ui: refactoring: make Graphics a global function 2022-02-06 20:29:49 +09:00
Hajime Hoshi
0f09ddfbd2 internal/driver: remove Window
Closes #1983
2022-02-06 20:12:40 +09:00
Hajime Hoshi
80c03792cb internal/driver: move the key definitions to internal/ui
Updates #1983
2022-02-06 19:14:18 +09:00
Hajime Hoshi
887a3ff749 internal/cbackend: bug fix: compile error again 2022-02-06 19:07:17 +09:00
Hajime Hoshi
0eecab8278 internal/cbackend: bug fix: compile error 2022-02-06 18:59:21 +09:00
Hajime Hoshi
3b7b66170f internal/driver: remove an unused type Modifier 2022-02-06 18:49:33 +09:00
Hajime Hoshi
2fbfa5444b internal/driver: remove Input 2022-02-06 18:34:31 +09:00
Hajime Hoshi
6f72b15912 internal/driver: move some definitions to internal/ui
Updates #1983
2022-02-06 18:13:45 +09:00
Hajime Hoshi
149736c3cf internal/uidriver/*: integrate the packages into internal/ui
Updates #1983
2022-02-06 17:23:04 +09:00
Hajime Hoshi
67bb58849e internal/uidriver/mobile: add build tags 2022-02-06 15:59:05 +09:00
Hajime Hoshi
12a70952a9 internal/glfw: remove an unreached code 2022-02-06 05:24:25 +09:00
Hajime Hoshi
93b2a0756b internal/gamepaddb: allow the standard layout mapping for any platforms
Closes #1957
2022-02-06 03:38:02 +09:00
Hajime Hoshi
19bfc97a5e mobile/ebitenmobileview: bug fix: compile error 2022-02-05 23:26:44 +09:00
Hajime Hoshi
2b902bacd9 internal/driver: remove an unused file 2022-02-05 23:14:00 +09:00
Hajime Hoshi
67663795fd internal/gamepaddb: move driver.StandardGamepadButton to gamepaddb.StandardButton 2022-02-05 23:11:09 +09:00
Hajime Hoshi
627509e974 internal/gamepad: move driver.GamepadButton to gamepad.Button 2022-02-05 23:03:30 +09:00
Hajime Hoshi
1bee10f999 internal/gamepad: move constants from internal/driver 2022-02-05 22:42:14 +09:00
Hajime Hoshi
3bdd8097b5 internal/uidriver: refactoring: remove the gamepad part
Use the gamepad package instead.
2022-02-05 22:32:31 +09:00
Hajime Hoshi
e6e0c6d850 internal/uidriver/glfw: refactoring 2022-02-05 21:52:06 +09:00
Hajime Hoshi
bf1cb035eb internal/gamepad: port the gamepad part for c-backend 2022-02-05 19:11:57 +09:00
Hajime Hoshi
5443fc312a internal/uidriver/cbackend: add a new file 2022-02-05 18:00:32 +09:00
Hajime Hoshi
3470caf5b1 internal/uidriver/cbackend: refactoring: separate the gamepad part 2022-02-05 17:59:27 +09:00
Hajime Hoshi
1570c506ae internal/gamepad: port the implementation for Android 2022-02-05 17:27:24 +09:00
Hajime Hoshi
8d9937801b internal/gamepad: refactoring 2022-02-05 02:11:24 +09:00
Hajime Hoshi
d0e8efca33 internal/gamepad: port the implementation for Android 2022-02-04 23:23:22 +09:00
Hajime Hoshi
ee1b5e2044 internal/uidriver/mobile: stop requesting a frame on gamepads
In general, it is impossible to treat gamepad inputtings as events.
With FPSModeVsyncOffMinimum, the application cannot update with
gamepad inputtings.
2022-02-04 22:46:41 +09:00
Hajime Hoshi
577b4eed0d internal/uidriver/mobile: separate the gamepad part 2022-02-04 14:54:20 +09:00
Hajime Hoshi
f6d8f42c36 internal/gamepad: refactoring: use unix.InotifyEvent 2022-02-04 04:59:40 +09:00
Hajime Hoshi
ef45058037 internal/gamepad: implement for Linux
Updates #1452
2022-02-04 04:26:33 +09:00
Hajime Hoshi
d2afbd43cc internal/gamepaddb, mobile/ebitenmobileview: refactoring 2022-02-03 04:35:55 +09:00
Hajime Hoshi
e1c65d395c internal/uidriver/glfw: add a comment
Updates #1982
2022-02-03 01:41:09 +09:00
Hajime Hoshi
9999b65261 internal/uidriver/glfw: bug fix: a callback must be registered at createWindow 2022-02-03 01:00:24 +09:00
Hajime Hoshi
80f178b5e8 internal/uidriver/glfw: initialize the callback at init 2022-02-03 00:31:49 +09:00
Hajime Hoshi
a19bbd3b09 internal/uidriver/glfw: use shoten sleeping time at waitForFramebufferSizeCallback
Updates #1918
2022-02-03 00:28:14 +09:00
Hajime Hoshi
85bebece04 internal/uidriver/js: bug fix: compile error 2022-02-02 02:27:08 +09:00
Hajime Hoshi
f3f8f6177c internal/gamepad: add gamepad_null.go 2022-02-02 02:18:02 +09:00
Hajime Hoshi
ea39fca10c internal/gamepad: rename functions *Num -> *Count 2022-02-02 02:01:46 +09:00
Hajime Hoshi
a8576008f0 internal/gamepads: refactoring: remove a struct member 2022-02-02 00:32:29 +09:00
Hajime Hoshi
96ddec1753 internal/gamepad: refactoring reorder implementations for consistency 2022-02-01 13:54:33 +09:00
Hajime Hoshi
f5b68e5dc1 internal/gamepad: implement for Windows
Updates #1452
Updates #1764
2022-02-01 13:23:05 +09:00
Hajime Hoshi
cbf13630a9 internal/uidriver/glfw: remove an unnecessary error handling 2022-02-01 01:03:10 +09:00
Hajime Hoshi
e261951946 internal/gamepad: remove nativeGamepad.present 2022-01-30 18:59:25 +09:00
Hajime Hoshi
84e53d4c61 internal/graphicsdriver/opengl, internal/uidriver/glfw: treat Win32 API errors correctly
The returned errors from syscall.Syscall* and windows.LazyProc.Call come
from GetLastError. The value of GetLastError is not reliable when the
function succeeds.

This change fixes the usages of error values. The error value is now
used only when the API explicitly fails.
2022-01-30 15:54:24 +09:00
Hajime Hoshi
178a1d929c internal/gamepad: add comments and make Vibrate concurrent-safe 2022-01-29 03:50:43 +09:00
Hajime Hoshi
1d59023649 internal/gamepad: make the APIs concurrent-safe again 2022-01-29 03:41:47 +09:00
Hajime Hoshi
2e9ce94ed0 internal/gamepad: call init in update to make the initialization faster 2022-01-29 03:06:56 +09:00
Hajime Hoshi
d3cf8935e8 internal/gamepad: add comments 2022-01-29 02:22:10 +09:00
Hajime Hoshi
71e17efd80 internal/gamepad: simplify the implementation by making the APIs concurrent-unsafe 2022-01-29 02:07:15 +09:00
Hajime Hoshi
5edfd1b743 internal/gamepad: move the implementation of gamepad for GOOS=js
Updates #1957
2022-01-29 01:44:42 +09:00
Hajime Hoshi
2df4e17ae9 internal/uidriver/mobile: bug fix: use AVFoudation instead of AVFAudio for old iOS 2022-01-27 00:28:01 +09:00
Hajime Hoshi
12de3a7749 internal/uidriver/mobile: bug fix: specify a shared AVAudioSession for CHHapticEngine
Closes #1976
2022-01-26 23:53:56 +09:00
Hajime Hoshi
eabd82cda0 internal/uidriver/mobile: make Vibrate async 2022-01-26 22:36:31 +09:00
Hajime Hoshi
8f1f9e3a5f internal/uidriver/glfw: do not set the window size on fullscreen
The window size and the framebuffer size of fullscreen doesn't match.

Updates #1960
2022-01-26 16:23:34 +09:00
Hajime Hoshi
5ee493e85a internal/uidriver/glfw: bug fix: needed to adjuts the units between the framebuffer and the window
Updates #1960
Closes #1975
2022-01-26 04:58:08 +09:00
Hajime Hoshi
f76d1c8d50 Revert "internal/uidriver/glfw: bug fix: needed to set the window position after restoring from fullscreen"
This reverts commit 99a15d81f4.

Reason: The true culprit was 12c144070f

Updates #1975
2022-01-26 04:57:28 +09:00
Hajime Hoshi
99a15d81f4 internal/uidriver/glfw: bug fix: needed to set the window position after restoring from fullscreen
Closes #1975
2022-01-26 04:29:12 +09:00
Hajime Hoshi
da1d6ddf17 internal/uidriver/glfw: refactoring: SetTitle after restoring from fullscreen is no longer needed 2022-01-26 04:15:09 +09:00
Hajime Hoshi
d0a6ce6567 internal/graphicsdriver/metal: disable presentsWithTransaction in the fullscreen mode
Updates #1745
Closes #1974
2022-01-26 03:55:14 +09:00
Hajime Hoshi
11d01f4de1 internal/cbackend: add EbitenVibrateGamepad
Updates #1452
2022-01-26 03:32:52 +09:00
Hajime Hoshi
fb3a022327 ebiten: use the DB's name for GamepadName
Updates #1949
2022-01-25 21:14:03 +09:00
Hajime Hoshi
cdf2335f5a refactoring: better error handlings on Windows 2022-01-23 18:30:40 +09:00
Hajime Hoshi
a049c403cf internal/gamepad: bug fix: go-vet failed (misuse of unsafe.Pointer)
Updates #1452
2022-01-23 02:08:30 +09:00
Hajime Hoshi
580307f150 internal/gamepad: bug fix: go-vet failed
Updates #1452
2022-01-23 01:56:14 +09:00
Hajime Hoshi
ff24f7718c internal/uidriver/glfw: use an original implementation for macOS
Updates #1452
2022-01-23 01:48:24 +09:00
Hajime Hoshi
84c680c6ed internal/shader: ban the operator div on a matrix
The operator div on a matrix doesn't work on Metal.
2022-01-21 03:37:34 +09:00
Hajime Hoshi
2e5b4954f3 internal/shader: bug fix: forbid mat + float
mat + float doesn't work on Metal.
2022-01-21 02:42:22 +09:00
Hajime Hoshi
99f003a17a internal/shader: bug fix: mat *= vec is not allowed
Updates #1971
2022-01-21 02:03:50 +09:00
Hajime Hoshi
0415773b94 internal/shader: bug fix: allow the *= operator for a vector and a matrix
Updates #1971
2022-01-21 01:59:58 +09:00
Hajime Hoshi
8b8b96c9e7 internal/shader: bug fix: wrong test (int*float) 2022-01-21 01:31:46 +09:00
Hajime Hoshi
8d2bf6525c internal/shader: bug fix: wrong type checkings for operator *
Updates #1971
2022-01-21 01:06:02 +09:00
Hajime Hoshi
8321cecfdd internal/atlas: typo 2022-01-19 23:44:59 +09:00
Hajime Hoshi
0a537b7ad2 internal/shader: bug fix: a number literal must be represented as floats in some contexts 2022-01-17 21:14:07 +09:00
Hajime Hoshi
4940159e5b internal/shader: bug fix: operators between vec/mat and float should work
Closes #1963
2022-01-17 20:52:44 +09:00
Hajime Hoshi
f5edc189e6 internal/uidriver/glfw: bug fix: wrong lock usages 2022-01-17 01:29:29 +09:00
Elias Daler
12c144070f
internal/uidriver/glfw: fix window float enable/disable (#1962)
Closes #1960
2022-01-17 00:28:25 +09:00
Bertrand Jung
c4fbcdd1ae
internal/uidriver/glfw: use FreeConsole instead of hiding (#1961)
Closes #485
2022-01-16 22:31:17 +09:00
Hajime Hoshi
260f7e07df internal/shader: bug fix: deduction checks for the % operator were lacked 2022-01-14 03:51:04 +09:00
Hajime Hoshi
bf48a0b11a internal/shaderir: bug fix: test failures 2022-01-12 01:57:06 +09:00
Hajime Hoshi
08ddb4233b internal/shaderir/glsl: bug fix: % was not available on old GLSLs
Use a new utility function modInt instead.

Closes #1951
2022-01-12 01:41:09 +09:00
Hajime Hoshi
d110716dc0 internal/shader: bug fix: check types correctly for assign operators
Closes #1950
2022-01-12 00:39:39 +09:00
Hajime Hoshi
83bd0772d4 internal/shader: bug fix: % should be valid only for integers
Closes #1947
2022-01-11 23:53:09 +09:00
Hajime Hoshi
ca3f84fdd6 internal/uidriver/cbackend: rename an argument
Updates #1452
2022-01-11 04:12:08 +09:00
Hajime Hoshi
eb6e2026dc internal/uidriver/glfw: remove unused go:generate comments 2022-01-10 22:05:17 +09:00
Hajime Hoshi
d4b722eb06 ebiten: rename VibrateOptions.Intensity -> Magnitude
Updates #1452
2022-01-10 16:02:26 +09:00
Hajime Hoshi
edff1f0dd9 internal/gamepaddb: enable mappings for iOS
Updates #1557
Closes #1722
2022-01-09 17:57:09 +09:00
Hajime Hoshi
8334ca9a18 iternal/gamepaddb: update TODO comments 2022-01-09 04:02:00 +09:00
Hajime Hoshi
4106fb15fe internal/gamepaddb: implement the mappings for Android
Updates #1557
2022-01-09 03:29:19 +09:00
Hajime Hoshi
1b498a03cc Revert "internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS"
This reverts commit 1dd13ae06e.

Reason: This caused FPS drop on macOS 12.0.1

Updates #1885
Closes #1939
2022-01-09 01:02:53 +09:00
Hajime Hoshi
d1a5a161d7 internal/atlas: typo 2022-01-08 23:33:59 +09:00
Hajime Hoshi
e66d87e03d internal/buffered, interal/mipmap: typo 2022-01-08 23:32:58 +09:00
Hajime Hoshi
9d72d8c65a internal/buffered, interal/mipmap: typo 2022-01-08 23:31:20 +09:00
Hajime Hoshi
0680ca413d internal/atlas: bug fix: the offscreen must be an independent image
Closes #1938
2022-01-08 23:25:06 +09:00
Hajime Hoshi
3b0ce21a56 Revert "internal/graphicsdriver: bug fix: render semi-transparent vectors correctly"
This reverts commit 202f642395.

Reason: TestImageEvenOdd failed

Updates #1933
2022-01-06 03:19:46 +09:00
Hajime Hoshi
202f642395 internal/graphicsdriver: bug fix: render semi-transparent vectors correctly
Closes #1933
2022-01-06 03:00:25 +09:00
Hajime Hoshi
116203c5a5 cmd/ebitenmobile: update gomobile version (reland)
This switches from .framework to .xcframwork for iOS.

Closes #1922
2022-01-05 17:31:46 +09:00
Hajime Hoshi
c67e4385de internal/thread: bug fix: do not close 'terminate' channel
The `terminate` channel is resued on mobiles (see (*UserInterface).Update
in internal/uidriver/mobile). The channel must not be closed.

Closes #1932
2022-01-05 17:21:53 +09:00
Hajime Hoshi
6b34ddecfa internal/graphicsdriver/opengl/gles: add GLES_SILENCE_DEPRECATION to suppress warnings 2022-01-05 01:54:00 +09:00
Hajime Hoshi
ebb4851a32 internal/uidriver/js: bug fix: context might be nil before the loop starts
Closes #1928
2022-01-03 15:17:30 +09:00
Changkun Ou
626c91e360
ebiten: add RunOnMainThread(func()) (#1927)
Closes #1926
2022-01-03 03:30:29 +09:00
Hajime Hoshi
220a8f48ac internal/uidriver/glfw: refactoring: remove initTitle 2021-12-29 22:26:56 +09:00
Hajime Hoshi
5ee2ff56ca interna/uidriver: refactoring: remove initFPSMode 2021-12-29 22:21:27 +09:00
Hajime Hoshi
374871c031 internal/shader: bug fix: a meaningless statement should raise an error (a non-call expression statement)
Updates #1898
2021-12-27 23:14:05 +09:00
Hajime Hoshi
481a2145ae internal/shader: bug fix: a meaningless statement should raise an error
Closes #1898
2021-12-27 22:05:58 +09:00
Hajime Hoshi
dd4d2f6aa0 internal/glfw/glfw: update for GLFW 3.3.6
Closes #1896
2021-12-27 01:57:55 +09:00
Hajime Hoshi
a89e9d9368 internal/gamepaddb: update the database file
Updates #1903
2021-12-27 01:18:03 +09:00
Hajime Hoshi
f182b185d9 internal/graphicscommand: bug fix: overflow when len(vertices) > len(indices)
Closes #1913
2021-12-26 06:15:12 +09:00
Hajime Hoshi
011e5061df internal/cbackend: simplify the audio API 2021-12-23 22:20:04 +09:00
Hajime Hoshi
e6131894a7 internal/cbackend: add AudioBufferSizeInSeconds 2021-12-23 02:55:54 +09:00
Hajime Hoshi
1799ed0b28 add a build tag 'ebitencbackend' and internal/cbackend
This enables to create a C archive with Ebiten without an actual driver
implementation. This enables Ebiten work on a platform Go doesn't support.
See also Hitsumabushi project: github.com/hajimehoshi/hitsumabushi.

The backend C API is not stable and might change later. Then, the build
tag 'ebitencbackend' is not documented on purpose.

Closes #1900
2021-12-22 21:12:48 +09:00
Hajime Hoshi
b0b52c6297 internal/driver: typo 2021-12-22 18:47:52 +09:00
Hajime Hoshi
39ef252c2e
ebiten: Add VibrationOptions to specify intensity (#1891)
Updates #1452
2021-12-04 22:14:02 +09:00
Hajime Hoshi
bdf78dab27 internal/uidriver/glfw: Clean up build tags 2021-11-27 18:52:33 +09:00
Hajime Hoshi
ef5f8a9018 internal/uidriver/glfw: Adjusting the view size is not needed on macOS 12
Updates #1745
2021-11-27 18:47:05 +09:00
Hajime Hoshi
e6f2764d08 internal/uidriver/glfw: Refactoring: Remove toChangeSize
Updates #1884
2021-11-27 18:00:39 +09:00
Hajime Hoshi
22e64c7df0 internal/uidriver/glfw: Bug fix: Rendering should be updated after restoring from fullscreen
u.toChangeSize affects the result of u.updateSize. When the callback
for WindowSetSize is invoked, toChangeSize should be true.

In order to simplify the logic, we have to remove toChangeSize later.

Closes #1884
2021-11-27 17:53:40 +09:00
Hajime Hoshi
1dd13ae06e internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS
This fix works only for Metal. There is not a good solution for
OpenGL so far unfortunately.

Closes #1885
2021-11-27 02:52:48 +09:00
Hajime Hoshi
73bf7a0939 internal/uidriver/glfw: Bug fix: Return a tentative scale when glfw.GetPrmaryMonitor returns 1
Updates #1878
2021-11-24 22:35:10 +09:00
Hajime Hoshi
b4f87f9651 internal/uidriver/mobile: Implement Vibrate for Android
This change also adds AndroidManifest.xml for the example. This is
used for `gomobile install` command.

Updates #1452
2021-11-19 01:49:22 +09:00
Hajime Hoshi
8ae6793d4d internal/shader: Check the number of arguments 2021-11-14 17:34:06 +09:00
Hajime Hoshi
9be4ce928b internal/shader: Add more tests for const
Updates #1847
2021-11-14 17:06:54 +09:00
Hajime Hoshi
36ce3b836e internal/shader: Bug fix: Treat a non-typed consntat argument as a float
Closes #1874
2021-11-14 15:47:59 +09:00
Hajime Hoshi
ee414ed849 Revert "internal/uidriver/glfw: Refactoring"
This reverts commit c4df397d87.

Reason: Compile error
2021-11-12 22:29:03 +09:00
Hajime Hoshi
c4df397d87 internal/uidriver/glfw: Refactoring 2021-11-12 22:19:32 +09:00
Hajime Hoshi
b6cf95f5bb internal/uidriver/js: Optimization: Reduce the call of js.Value.Get 2021-11-12 02:48:58 +09:00
Hajime Hoshi
1f7e7e2816 internal/uidriver/mobile: Remove the warnings
Closes #1872
2021-11-11 02:28:05 +09:00
Hajime Hoshi
5d5ce370f1 internal/uidriver/mobile: Implement Vibrate on iOS
Updates #1452
2021-11-11 00:50:02 +09:00
Hajime Hoshi
00e2b15e2a shaderir: Bug fix: A wrong argument for fmt.Sprintf
This change also improves the result of espcae analysis.

Closes #1863
2021-11-02 00:05:07 +09:00
Hajime Hoshi
7661147e31 internal/graphicsdriver/opengl: Avoid allocations by escaping to heap 2021-10-31 22:34:14 +09:00
Hajime Hoshi
113796efae internal/uidriver/glfw: Bug fix: Crashed a transparent button with the green button
Updates #1822
Closes #1857
2021-10-31 18:21:19 +09:00
Hajime Hoshi
0238549cfb internal/atlas, initernal/graphics: Better buffer size calculation 2021-10-31 17:20:39 +09:00
Hajime Hoshi
d236d73a1f internal/atlas, initernal/graphics: Bug fix: Needed to reset 'notFullyUsedTime' 2021-10-31 17:18:07 +09:00
Hajime Hoshi
15f62bfeb5 internal/graphicsdriver/opengl: Optimization: Cache texture variable names 2021-10-31 05:40:44 +09:00
Hajime Hoshi
9d51356eef internal/graphicsdriver/opengl: Optimization 2021-10-31 05:17:23 +09:00
Hajime Hoshi
b74a4a0275 internal/graphicsdriver/opengl: Optimization: Avoid heap allocations 2021-10-31 02:10:44 +09:00
Hajime Hoshi
7b7791156c internal/graphicsdriver/opengl: Remove unreached return 2021-10-31 01:38:01 +09:00
Hajime Hoshi
98083ccd0a internal/graphicsdriver/opengl: Avoid heap allocation of a local variable
If a variable is passed to an argument interface{}, the variable might be
allocated on the heap unexpectedly.
2021-10-31 01:11:12 +09:00
Hajime Hoshi
a082db04fd internal/jsutil: Optimization: Avoid using empty interface{} conversions 2021-10-30 18:53:21 +09:00
Hajime Hoshi
a826ecb29b internal/jsutil: Move a function to internal/graphicsdriver/opengl 2021-10-30 18:33:43 +09:00
Hajime Hoshi
06f4142ca0 internal/driver: Optimization: Replace interface{} with driver.Uniform
Converting a value from/to interface{} can create a value in heap
and this is not efficient.
2021-10-30 02:58:28 +09:00
Hajime Hoshi
1f82bb297c internal/graphicsdriver/opengl: Optimization: Avoid the empty interface 2021-10-30 02:28:57 +09:00
Hajime Hoshi
60f2c7ace6 internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame (uniform variables) 2021-10-30 00:22:31 +09:00
Hajime Hoshi
b4f45edff8 internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame 2021-10-30 00:13:57 +09:00
Hajime Hoshi
76324254c1 internal/graphicsdriver/opengl: Avoid creating objects for debugging 2021-10-30 00:04:03 +09:00
Hajime Hoshi
b1a442f86a internal/graphicscommand: Optimization: Pool drawTrianglesCommand objects 2021-10-29 23:41:47 +09:00
Hajime Hoshi
d3ac199aa9 internal/graphicsdriver/opengl: Optimization: Avoid fmt.Sprintf 2021-10-29 21:43:40 +09:00
Hajime Hoshi
3c1f8da7f8 internal/graphicsdriver/opengl: Optimization: Avoid interface conversion 2021-10-29 21:35:40 +09:00
Hajime Hoshi
5b7724f575 internal/uidriver/mobile: Bug fix: Compile error 2021-10-25 03:01:33 +09:00
Hajime Hoshi
2aa232878d ebiten: Add VibrateGamepad and implement this on browsers
Updates #1452
2021-10-25 02:30:42 +09:00
Hajime Hoshi
dde53df6ae internal/uidriver/glfw: Bug fix: Compile error 2021-10-24 15:23:25 +09:00
Hajime Hoshi
99bfdef416 internal/graphicsdriver/opengl/gl: Support OpenBSD 2021-10-24 15:09:16 +09:00
Hajime Hoshi
ef62f407d1 Clean up build tags 2021-10-24 15:05:36 +09:00
Hajime Hoshi
878831b842 internal/graphicsdriver/opengl: Bug fix: compile error 2021-10-24 14:55:50 +09:00
Hajime Hoshi
a5198275fa internal/graphicsdriver/opengl/gl: Remove an unused file 2021-10-24 14:46:38 +09:00
Hajime Hoshi
7c6f2fd799 ebiten: Vibrate takes time durations instead of the options
Android and browsers can specify only a time duration for vibration.

VibrateOptions is renamed to GamepadVibrateOptions for gamepads.

Updates #1452
2021-10-24 05:02:49 +09:00
Hajime Hoshi
f96d0a97a8 internal/uidriver/mobile: Bug fix: Compile error 2021-10-24 01:22:02 +09:00
Hajime Hoshi
b8a5ea7bd6 ebiten: Add Vibrate and VibrateOptions, and implement this on browsers
Updates #1452
2021-10-24 01:05:33 +09:00
Hajime Hoshi
96dc80fd08 internal/restorable: Remove needsDisposingWhenRestoring
Now restoring from context lost doesn't work on browsers. Then,
the constant needsDisposingWhenRestoring is actually always true.
2021-10-23 23:46:29 +09:00
Hajime Hoshi
dddfe73604 internal/uidriver/mobile: Bug fix: iOS with ebitengl build tag didn't work correctly 2021-10-23 23:32:57 +09:00
Hajime Hoshi
b11f17b281 internal/uidriver/mobile: Support gamepads on iOS
Closes #1105
2021-10-19 19:04:12 +09:00
Hajime Hoshi
a70be6e2f8 internal/uidriver/mobile: Refactoring
Updates #1105
2021-10-16 23:46:14 +09:00
Hajime Hoshi
2d9349824f internal/uidriver/mobile: Separate UpdateInput into UpdateInput and UpdateGamepads 2021-10-16 20:37:01 +09:00
Hajime Hoshi
ce86a9940c internal/uidriver/mobile: Fix the package name in a panic message 2021-10-16 20:13:36 +09:00
Hajime Hoshi
c3b4b92fa2 internal/uidriver/mobile: Reduce calling make 2021-10-16 20:09:36 +09:00
Hajime Hoshi
efdb31a524 internal/uidriver/mobile: Refactoring 2021-10-16 19:59:30 +09:00
Hajime Hoshi
ad3115b347 mobile/ebitenmobileview: Avoid creating slices every frame 2021-10-16 18:39:47 +09:00
Hajime Hoshi
8b775cf0dd internal/glfw: Add a new build tag ebitenexternaldll to requrie external DLLs
Embedding a DLL file and extrating it on the fly can be problematic.
The application might be unexpectedly recognized as a virus by some
virus checkers.

To mitigate this issue, Ebiten adds a new build mode `ebitenexternaldll`
which prevents Ebiten from embedding DLL files. Instead, the application
will require DLL files for GLFW.

Closes #1832
2021-10-14 02:44:25 +09:00
Hajime Hoshi
bce2e83565 internal/glfw: Update Dockerfile 2021-10-14 00:03:43 +09:00
Hajime Hoshi
6f79185b2c internal/glfw/glfw: Update documents 2021-10-13 23:48:53 +09:00
Hajime Hoshi
6f29e57378 internal/uidriver/glfw: Wait for a FramebufferSize callback for the initial temporary window
Updates #1847
2021-10-13 00:16:18 +09:00
Hajime Hoshi
2f2ccbbe55 internal/uidriver/glfw: Bug fix: Wait for FramebufferSize callback after a window creation
Closes #1847
2021-10-13 00:04:14 +09:00