Commit Graph

4214 Commits

Author SHA1 Message Date
Hajime Hoshi
34cc6405dd internal/shader: add type checks for the builtin function clamp
Updates #2184
2022-08-19 00:14:38 +09:00
Hajime Hoshi
82a9aac689 internal/shader: add type checks for the builtin function cross
Updates #2184
2022-08-18 23:45:01 +09:00
Hajime Hoshi
7af6c99954 internal/shader: add type checks for some builtin functions
Updates #2184
2022-08-18 23:21:25 +09:00
Hajime Hoshi
3aad4fada1 internal/shaderir: add comments
Updates #2253
2022-08-18 17:46:53 +09:00
TotallyGamerJet
05470f7706
internal/graphicsdriver/metal: remove C for macOS (#2243)
Updates #1162
2022-08-18 01:39:34 +09:00
Hajime Hoshi
fb775d806c internal/shader: disallow 'discard' in other functions than the fragment entry point
Closes #2248
2022-08-17 23:39:52 +09:00
Hajime Hoshi
9d303e8dc5 internal/graphicsdriver/directx: bug fix: do not reset command allocators at Begin
Closes #2249
2022-08-17 22:37:26 +09:00
Hajime Hoshi
e9e48919df internal/processtest: rename test 2022-08-17 22:04:51 +09:00
Hajime Hoshi
b211b79a5c internal/shader: use a return statement in a fragment shader entrypoint
Updates #2247
2022-08-17 22:02:13 +09:00
Hajime Hoshi
bf4648eb35 internal/shaderir: fix a wrong comment 2022-08-17 17:43:59 +09:00
Hajime Hoshi
cf92158e33 ebiten: bug fix: add an indirect function call for a fragment shader
Closes #2245
Closes #2247
2022-08-17 16:37:37 +09:00
Hajime Hoshi
bb2df24f83 internal/graphicsdriver/directx: use DXGI_PRESENT_TEST when the screen is invisible
This change also reduces FPS to about 10 when the screen is invisible
in order to save CPU power.

Closes #2181
2022-08-17 00:10:44 +09:00
Hajime Hoshi
5b182efe7e internal/ui: forbide SetWindowSize when the window is maximized
On Windows, changing the size of a maximized window results in
unexpected states. Let's forbid this.

On macOS, a maximized window is just a regular window so it is
OK to allow resizing by `SetWindowSize`.

On Linux or other Unix, the behavior depends on window systems
and it is hard to expect what would happen, so forbid this just in
case.

Closes #1986
2022-08-15 16:29:20 +09:00
Hajime Hoshi
bc8e2fe6ac internal/glfw: bug fix: the window should be focused when closing is handled
Closes #2165
2022-08-12 22:34:19 +09:00
Hajime Hoshi
dd292552d5 audio: move the implementation for NintendoSDK to Oto
Updates #2242
2022-08-12 20:53:55 +09:00
Hajime Hoshi
8081d0636a internal/cbackend: rename to nintendosdk
Updates #2242
2022-08-12 17:19:37 +09:00
Hajime Hoshi
e7c0a121c4 all: remove the build tag 'ebitencbackend'
This also automatically enables 'egl' when 'nintendosdk' is specified.

Updates #2242
2022-08-12 13:15:39 +09:00
Hajime Hoshi
dac6548c0c all: rename ebitenginecbackend to nintendosdk
Updates #2242
2022-08-12 02:05:29 +09:00
Hajime Hoshi
0578a831cc internal/microsoftgdk: initialize GDK on the Ebitengine side
Updats #2084
2022-08-11 21:45:13 +09:00
Hajime Hoshi
91797a6589 internal/microsoftgdk: remove dummy.c
Simply this was not needed.

Updates #2084
2022-08-11 21:23:13 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
85aabf734b internal/ui: remove panic at (*glfwWindow).Maximize
Just doing nothing is more consistent with other functions.

Updates #1990
2022-08-10 22:18:55 +09:00
Hajime Hoshi
4104abdf77 internal/ui: refactoring 2022-08-10 21:34:39 +09:00
Hajime Hoshi
b5196a5a7c internal/ui: bug fix: glfwWindow.IsMaximized should not return true on fullscreen
Closes #2239
2022-08-10 21:17:13 +09:00
Hajime Hoshi
7a936f7052 internal/ui: enable SetWindowSize even with fullscreen on macOS
Closes #1590
2022-08-10 15:57:59 +09:00
Hajime Hoshi
085b64006d internal/ui: refactoring: indentation 2022-08-10 15:47:50 +09:00
Hajime Hoshi
2ab255dd1c internal/ui: refactoring: delay the call of outsideSize() 2022-08-10 14:53:28 +09:00
Hajime Hoshi
7eff5cbd4a internal/ui: refactoring: separate updateSize into updateSize and outsideSize 2022-08-10 14:50:20 +09:00
Hajime Hoshi
2480871155 internal/ui: bug fix: compile error 2022-08-10 12:11:32 +09:00
Hajime Hoshi
57fc4d438b internal/ui: refactoring: separate the Windows API part to another file 2022-08-10 11:51:35 +09:00
Hajime Hoshi
a57560105f internal/ui: refactoring: add userInterfaceImplNative for each OS 2022-08-10 11:44:03 +09:00
Hajime Hoshi
d0fa68691c internal/ui: enable some functions even on fullsceen
This is thanks to a GLFW v3.3.8 change:
9950cc52df

Updates #1590
2022-08-10 09:00:33 +09:00
Hajime Hoshi
a84a738360 internal/ui: bug fix: collectionBehavior mattered for fullscreen
Closes #2238
2022-08-10 01:06:26 +09:00
Hajime Hoshi
205245b094 internal/shader: implement a new built-in function discard
Closes #1969
2022-08-09 11:31:59 +09:00
Hajime Hoshi
2826555044 internal/cbackend: remove CloseAudio 2022-08-08 12:38:27 +09:00
Hajime Hoshi
0217ed0544 ebiten: add WritePixels replacing ReplacePixels
Closes #2236
2022-08-08 03:50:27 +09:00
Hajime Hoshi
34aa52459e internal/ui: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:26 +09:00
Hajime Hoshi
bd1b9cdb9b internal/mipmap: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:21 +09:00
Hajime Hoshi
7061b34222 internal/buffered: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:11 +09:00
Hajime Hoshi
8ce84c6596 internal/atlas: rename ReplacePixels -> WritePixels 2022-08-08 03:24:46 +09:00
Hajime Hoshi
af894d5c83 internal/restorable: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:16:26 +09:00
Hajime Hoshi
7542bbc29c internal/graphicscommand: bug fix: test failures
Updates #2236
2022-08-08 03:10:50 +09:00
Hajime Hoshi
70f5e84098 internal/graphicsdriver: rename ReplacePixels to WritePixels
Updates #2236
2022-08-08 03:05:04 +09:00
Hajime Hoshi
ea04e2a9de ebiten: remove returning error from ReadPixels
- As ReadPixels should often be used at Draw, error handling would be hard.
- Make the API consistent with ReplacePixels.

Updates #1995
2022-08-08 02:48:25 +09:00
Hajime Hoshi
869147eda0 internal/graphicscommand: rename pixelCommand -> readPixelCommand
Updates #1995
2022-08-08 01:47:07 +09:00
Hajime Hoshi
81bd5b488c ebiten: add (*Image).ReadPixels
Closes #1995
2022-08-08 01:42:26 +09:00
Hajime Hoshi
72d5002e72 remove go2cpp support
Closes #2126
2022-08-07 22:17:53 +09:00
Hajime Hoshi
abcacc26d8 internal/glfwwin: update for GLFW v3.3.8
Closes #2214
2022-08-07 15:03:33 +09:00
Hajime Hoshi
98894d66fb internal/ui: revert the fix for #2183
- `CGEventSourceKeyState` cannot treat right modifier keys correctly.
- Unpaired keyup and keydown are very common (especially on browsers)
  and this is not a serious issue.

Updates #2183
2022-08-06 11:19:56 +09:00
Hajime Hoshi
6d87be7169 internal/ui, internal/mipmap: refactoring: replace At with ReadPixels
Updates #1995
2022-08-06 00:32:42 +09:00
Hajime Hoshi
6c22f3f1a8 internal/buffered: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:58:01 +09:00
Hajime Hoshi
bf5f7ee34d internal/restorable: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:37:27 +09:00
Hajime Hoshi
7b6ce7dcba internal/ui: bug fix: reset key states when the window is not focused on macOS
Updates #2183
2022-08-05 20:22:50 +09:00
Hajime Hoshi
e81c46a0d7 internal/ui: bug fix: vkKey definitions were not found on iOS 2022-08-05 19:10:42 +09:00
Hajime Hoshi
50f66963b0 internal/ui: refactoring 2022-08-05 19:07:47 +09:00
Hajime Hoshi
a7135ce10b internal/ui: fix build tags 2022-08-05 19:07:37 +09:00
Hajime Hoshi
a6004517dc internal/ui: use a direct method to get key states instead of events on macOS
Closes #2183
2022-08-05 19:04:01 +09:00
mattn
2bacecca24
fix typos (#2227) 2022-08-03 22:40:39 +09:00
mattn
3cd0daac67
go generate ./... with Go 1.19 (#2228) 2022-08-03 20:48:02 +09:00
Hajime Hoshi
764ec8c794 internal/atlas: refactoring 2022-08-02 01:13:46 +09:00
Herczog Zoltán
fabf3fb374
internal/graphicsdriver/metal: remove supportsMetal check (#2223)
Closes #2211
2022-07-31 21:20:53 +09:00
Vseslav Kochenov
3ac37e250f
ebiten: add ReadDebugInfo for getting debug info (only graphics libray so far) (#2222)
Closes #2177
2022-07-31 02:56:16 +09:00
Hajime Hoshi
2aa595de52 Revert "internal/graphicsdriver/directx: bug fix: check the error at CreateGraphicsPipelineState at initialization"
This reverts commit c183555cc8.

Reason: this didn't help anything on the reporter's machine
2022-07-31 00:46:26 +09:00
Hajime Hoshi
95fb4370db internal/glfwwin: remove the call of RemovePropW
This is unnecessary, and doesn't work on Xbox.

Also DestroyWindow doesn't work on Xbox so skip this on Xbox.

Updates #2084
2022-07-30 18:42:43 +09:00
divVerent
21207f827c
do not require installing file2byteslice to update go generate'd files. (#2221)
The tool is already referenced in go.mod, so it is trivial to just go run it -
that way, go generate can use it without the user explicitly installing it first.
2022-07-29 20:43:23 +09:00
Hajime Hoshi
c183555cc8 internal/graphicsdriver/directx: bug fix: check the error at CreateGraphicsPipelineState at initialization
CreateGraphicsPipelineState someitmes causes an error
DXGI_ERROR_DEVICE_HUNG, but we failed to know why.

Instead of fixing this, check the error earlier and use the fallback
grpahics library OpenGL in this case.

Updates #2198
2022-07-29 16:20:09 +09:00
Hajime Hoshi
3eeb401d22 internal/gamepaddb: refactoring 2022-07-29 12:17:55 +09:00
Hajime Hoshi
bacb630c5b internal/gamepaddb: bug fix: don't panic with invalid inputs
Closes #2218
2022-07-29 12:14:20 +09:00
Hajime Hoshi
ca8c36499d ebiten: recommend errors.Is instead of comparing the returned value directly
Closes #2152
2022-07-24 23:25:48 +09:00
Hajime Hoshi
9ea399e7cc internal/graphicsdriver/directx: typo 2022-07-20 01:24:08 +09:00
Hajime Hoshi
7025f195a7 internal/graphicsdriver/directx: check DirectX availability earlier for Wine
Closes #2114
2022-07-20 01:22:45 +09:00
Hajime Hoshi
e861080145 internal/graphicsdriver/directx: early error check for Wine
Updates #2114
2022-07-19 23:55:44 +09:00
Hajime Hoshi
f8acd5e7ee internal/graphicsdriver/directx: bug fix: D3D12CreateDevice could be called without creating a device 2022-07-19 03:22:46 +09:00
Hajime Hoshi
0f9ec45709 internal/graphicsdriver/directx: refactoring 2022-07-18 23:36:42 +09:00
Hajime Hoshi
0f52381580 ebiten: rename TPS functions
* SetMaxTPS() -> SetTPS()
* MaxTPS() -> TPS()
* CurrentTPS() -> ActualTPS()
* CurrentFPS() -> ActualFPS()

Closes #2071
2022-07-17 11:30:12 +09:00
Hajime Hoshi
356c625601 internal/gamepad: improve resetting vibrations 2022-07-16 02:44:54 +09:00
Hajime Hoshi
90ac7d047d internal/graphicsdriver/opengl/gl: bug fix: wrong build tag syntax 2022-07-15 23:34:09 +09:00
Hajime Hoshi
9e1a2bcb30 internal/gamepad: reorder function implements 2022-07-15 21:52:26 +09:00
Hajime Hoshi
d6547f12c6 internal/gamepad: implement gamepad vibrations for Xbox
Updates #2084
2022-07-15 21:33:23 +09:00
Hajime Hoshi
d231a35d3b internal/gamepad: bug fix: release IDirectInputDevice8W on disconnecting
Closes #2205
2022-07-15 15:44:40 +09:00
Hajime Hoshi
520a30f3c7 internal/gamepad: bug fix: memory leak on Xbox
Updates #2084
2022-07-15 15:12:56 +09:00
Hajime Hoshi
c14403f195 internal/gamepad: bug fix: Y axis values are opposite on Xbox
Updates #2084
2022-07-15 14:55:38 +09:00
Hajime Hoshi
b31ce0a568 internal/graphicsdriver/directx: update comments 2022-07-15 13:33:45 +09:00
Hajime Hoshi
b48c2aa103 internal/graphicsdriver/directx: bug fix: too many constant buffers could be allocated
Closes #2204
2022-07-15 03:40:24 +09:00
Hajime Hoshi
e3d025bf4f internal/graphicsdriver/directx: fix a wrong constant usage 2022-07-15 02:49:01 +09:00
Hajime Hoshi
8d74039617 internal/graphicsdriver/directx: increment numDescriptorsPerFrame
16 seems too conservative. Let's double it.

Updates #2188
2022-07-15 02:42:23 +09:00
Hajime Hoshi
9a35366380
internal/graphicsdriver/directx: batch ResourceBarrier commands (#2203)
Updates #2188
2022-07-15 02:34:38 +09:00
Hajime Hoshi
41edd98675 Revert "internal/graphicsdriver/directx: batch ExecuteCommandList"
This reverts commit f92107c2ee.

Reason: Performance regression

Updates #2188
2022-07-15 01:06:08 +09:00
Hajime Hoshi
f92107c2ee internal/graphicsdriver/directx: batch ExecuteCommandList
Updates #2188
2022-07-15 00:51:02 +09:00
Hajime Hoshi
82d31c5fb7 internal/graphicsdriver/directx: remove redundant resetting of allocators
Updates #2202
2022-07-15 00:13:28 +09:00
Hajime Hoshi
479483b76d internal/graphicsdriver/directx: bug fix: need to reset command allocators
Closes #2202
2022-07-14 21:21:55 +09:00
Hajime Hoshi
b3267a7126 internal/graphicsdriver/directx: bug fix: wrong offsets
* Wrong offsets were speicified when creating a constant buffer view and
  a shader resource view.
* Wrong root descriptor tables were speicified. For one draw command,
  one descriptor table for a constant buffer and textures should be used.

Updates #2198
Closes #2201
2022-07-14 03:01:40 +09:00
Hajime Hoshi
42d5d91829 internal/graphicsdriver/directx: unmap constant buffers appropriately
Updates #2198
2022-07-14 01:54:34 +09:00
Hajime Hoshi
6f182d1124 internal/graphicsdriver/directx: fix a suspicious error chceck 2022-07-14 01:45:21 +09:00
Hajime Hoshi
7bf179472b internal/restorable: change the naming convention: Num -> Count 2022-07-13 02:11:12 +09:00
Hajime Hoshi
921aeb4ea7 audio: rename channelNum -> channelCount 2022-07-13 02:08:38 +09:00
Hajime Hoshi
16ff5c5039 internal/shaderir: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
dce34d2306 internal/shader: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
afed6a83c6 internal/graphics: change the naming convention: Num -> Count
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
2203c3c448 internal/ui: remove the keypress event and the charCode preperty usages
These APIs are deprecated.

Closes #2199
2022-07-12 23:36:58 +09:00
Hajime Hoshi
55adc2113e internal/clock: Update -> UpdateFrame 2022-07-12 13:18:49 +09:00
Hajime Hoshi
e05df6a778 internal/ui: refactoring 2022-07-12 12:47:34 +09:00
Hajime Hoshi
d4e1787154 internal/clock: refactoring 2022-07-12 12:42:16 +09:00
Hajime Hoshi
c5e952d196 internal/ui: refactoring: reduce members from globalState 2022-07-12 12:35:07 +09:00
Hajime Hoshi
08e54ae1a6 internal/ui: rename the TPS functions
Updates #2071
2022-07-12 12:25:57 +09:00
Hajime Hoshi
b8367da7e2 internal/graphics: optimize imageSrcNUnsafeAt 2022-07-11 01:07:06 +09:00
Hajime Hoshi
b27b7ec483 internal/graphicsdriver/directx: use CreateEventEx to follow the official example 2022-07-10 22:44:40 +09:00
Hajime Hoshi
4c121ae5eb internal/graphicsdriver/directx: bug fix: a wrong fence value was passed to SetEventOnCompletion 2022-07-10 22:24:39 +09:00
Hajime Hoshi
a22125a075 internal/graphicsdriver/directx: bug fix: ResizeBuffers failed without the flag
Closes #2193
2022-07-10 19:55:28 +09:00
Hajime Hoshi
4afabe34ae internal/shader: optimization: remove unnecessary local variables
Updates #2034
Updates #2188
2022-07-10 19:01:58 +09:00
Hajime Hoshi
b6a340a96f internal/shader: optimization: use a regular return for a function with one output parameter
Updates #2034
Updates #2188
2022-07-10 18:18:46 +09:00
Hajime Hoshi
8c879c7bcf internal/shader: refactoring 2022-07-10 16:02:50 +09:00
Hajime Hoshi
bf0f3d304b internal/graphicsdriver/directx: add optimization flag to D3DCompile
Updates #2034
Updates #2188
2022-07-10 02:55:16 +09:00
Hajime Hoshi
0035ba0bd1 internal/graphicsdriver/directx: allow tearing when vsync is off
Updates #2034
Updates #2188
2022-07-10 01:17:36 +09:00
Hajime Hoshi
a32a137fa8 internal/graphicsdriver/directx: skip unnecessary flushing commands
Updates #2034
Updates #2188
2022-07-10 00:24:14 +09:00
Hajime Hoshi
b2a1b9a9a2 internal/shader: bug fix: float constant didn't work with assign operators 2022-07-09 22:29:42 +09:00
Hajime Hoshi
55c7a2df6c internal/graphicsdriver/opengl/gl: bug fix: wrong build tags 2022-07-09 16:15:56 +09:00
Hajime Hoshi
28fd3ec9e5 add the ebitengine version build tags besides the ebiten version
Closes #2111
Updates #2190
2022-07-09 15:38:03 +09:00
Hajime Hoshi
428b1263d9 add ebitenginecbackend build tag besides ebitencbackend
Updates #2111
Updates #2190
2022-07-09 15:23:52 +09:00
Hajime Hoshi
204fb5935b add new environment variables with the EBITENGINE_ suffix
Updates #2111
Updates #2190
2022-07-09 15:00:28 +09:00
Hajime Hoshi
a5179b9491 internal/shaderir/glsl: bug fix: test failures with OpenGL
Updates #2186
2022-07-09 02:43:48 +09:00
Hajime Hoshi
c01821ca5c internal/shader: use all functions for vector comparisons
Updates #2186
2022-07-09 02:30:16 +09:00
Hajime Hoshi
3d5031571d internal/graphicsdriver/directx: add the original source at D3DCompile errors 2022-07-09 01:59:51 +09:00
Hajime Hoshi
6dcd2ff11c internal/shader: bug fix: wrong assignment rule for booleans 2022-07-08 02:19:42 +09:00
Hajime Hoshi
87be157b23 internal/shader: refactoring 2022-07-08 01:09:42 +09:00
Hajime Hoshi
a3590cb258 internal/shader: add type checks to bool/int/flaot
Updates #2184
2022-07-08 00:22:55 +09:00
Hajime Hoshi
faa2ad5c6f internal/shader: add type checks for mat2/mat3/mat4
Updates #2184
2022-07-07 23:05:26 +09:00
Hajime Hoshi
f89277fd85 internal/shader: add type checks to vec2/vec3/vec4
Updates #2184
2022-07-07 00:20:02 +09:00
Hajime Hoshi
a866fe7391 internal/graphicscommand: improve debug command messages for shaders 2022-07-06 19:29:19 +09:00
Hajime Hoshi
8522bfd0bf internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.

Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
dd805c9414 internal/atlas: remove a wrong comment
(*restrable.Image).ReplacePixels can take overlapped regions.
See TestOverlappedPixels.

Updates #2180
2022-07-05 13:59:23 +09:00
Hajime Hoshi
08ebab0558 internal/ui: better fix for initialMonitorByOS
Updates #2179
2022-07-04 14:42:21 +09:00
Hajime Hoshi
47c65a92ae internal/graphicsdriver/directx: bug fix: ignore DXGI_STATUS_OCCLUDED
When a screen is locked, an Ebitengine application crashed as the
swap chain's Present returned DXGI_STATUS_OCCLUDED.

Let's ignore the error and continue to run the applications. In the
ideal world, an application should stop running during the screen lock,
so let's revisit this later.

This fix also fixes the issue that a Win32API GetCursorPos returned
an error ERROR_ACCESS_DENIED when the screen was locked.

Closes #2179
2022-07-04 12:55:36 +09:00
Hajime Hoshi
fb23e4b578 internal/processtest/testdata: fix col and row
Updates #2154
2022-07-04 12:07:39 +09:00
Hajime Hoshi
5411e8136b ebiten: bug fix: use DrawTriangles as an implementation of Set
Closes #2154
2022-07-04 12:02:47 +09:00
Hajime Hoshi
7d725f3e58 Revert "internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal"
This reverts commit c31cc4ecff.

Reason: This didn't fix the issue.

Updates #2154
2022-07-04 11:50:06 +09:00
Hajime Hoshi
c31cc4ecff internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal
Inserting a dummy rendering command after ReplacePixels and before
DrawTriangles solved the issue. This is a very dirty hack, but
there seems no other better way.

Closes #2154
2022-07-03 15:59:18 +09:00
Hajime Hoshi
afe1a93648 internal/graphicscommand, internal/graphicsdriver/metal: remove unused code 2022-07-03 15:23:52 +09:00
Hajime Hoshi
12533c2cce Revert "internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles"
This reverts commit ac802cf0d0.

Reason: This caused flickerings, and didn't solve #2154

Updates #2154
Closes #2174
2022-07-03 12:17:58 +09:00
Hajime Hoshi
ac5c48f575 internal/gamepad: support Xbox
Updates #2084
2022-07-02 01:02:24 +09:00
Hajime Hoshi
a6f6fdbfb7 internal/gamepad: update for Xbox
Updates #2084
2022-07-01 20:43:49 +09:00
Hajime Hoshi
97039ff714 internal/gamepad: implement gamepad detection callbacks for Xbox
Updates #2084
2022-07-01 17:15:11 +09:00
Hajime Hoshi
298d6488cc internal/affine: add test
Updates #2170
2022-07-01 01:46:37 +09:00
Hajime Hoshi
8cdfa4f66c internal/affine: create a fast path for ChangeHSV
When hue = 0 and saturation = 1, this should be the same as scaling.

Closes #2170
2022-06-30 11:32:12 +09:00
Hajime Hoshi
a9c9e18ff4 internal/graphicscommand: better strings for ColorM 2022-06-30 11:13:02 +09:00
Hajime Hoshi
0eb2f76422 internal/buffered: refactoring 2022-06-25 01:42:40 +09:00
Hajime Hoshi
bf27f25e26 internal/gamepad: bug fix: build failures on FreeBSD 2022-06-25 01:36:13 +09:00
Hajime Hoshi
c490347cef internal/buffer: bug fix: shader manipulations must be buffered
Closes #2162
2022-06-25 01:31:20 +09:00
Hajime Hoshi
2d23168aca iinternal/gamepad: start implementation for Xbox
Updates #2084
2022-06-25 00:02:12 +09:00
Hajime Hoshi
3fb3997160 internal/gamepad: separate the Xbox part
Updates #2084
2022-06-24 22:49:37 +09:00
Hajime Hoshi
847c4f067a internal/gamepad: make nativeGamepad(s) interfaces
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 21:52:48 +09:00
Hajime Hoshi
f1037d8bff internal/ui: handle gamepad errors 2022-06-24 20:20:49 +09:00
Hajime Hoshi
0cd43bd081 internal/gamepad: stop embedding a member into a struct
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 19:01:50 +09:00
Hajime Hoshi
712940cb02 internal/graphicsdriver/directx: bug fix: leave mapped regions for constant buffers
Mapping for a constant buffer every frame might sometimes fails. We
are not sure the reason, but in the official examples, leaving mapped
regoins seems the way to go.

Updates #2084
Closes #2157
2022-06-23 17:09:46 +09:00
Hajime Hoshi
506d534370 internal/ui: fix window sizes for Xbox
Updates #2084
2022-06-23 14:50:41 +09:00
Hajime Hoshi
c93cecdc2b internal/graphicsdriver/directx: accept S_FALSE at ScheduleFrameEventX 2022-06-22 02:13:32 +09:00
Hajime Hoshi
7b05e59000 internal/graphicsdriver/directx: bug fix: wrong GUID for IDXGIDevice 2022-06-22 01:59:22 +09:00
Hajime Hoshi
8311ff1e46 internal/graphicsdriver/directx: bug fix: wrong pointer usage 2022-06-22 01:49:23 +09:00
Hajime Hoshi
10af36ee9f internal/jsutil: bug fix: unnecessary allocations of temporary ArrayBuffers
Closes #2156
2022-06-21 21:54:02 +09:00
Hajime Hoshi
7e92b79a00 internal/graphicsdriver/directx: implement swap chains for Xbox
Updates #2084
2022-06-21 12:21:00 +09:00
Hajime Hoshi
a641f9ede0 internal/graphicsdriver/directx: refactoring 2022-06-20 23:40:53 +09:00
Hajime Hoshi
969e87fb89 internal/graphicsdriver/directx: fix moveToNextFrame for Xbox
Updates #2084
2022-06-20 00:41:34 +09:00
Hajime Hoshi
f8e9dcf035 internal/graphicsdriver/directx: refactoring 2022-06-19 17:58:04 +09:00
Hajime Hoshi
08c8c8089a internal/graphicsdriver/directx: bug fix: clear constant buffers at the end of DrawTriangles
Constant buffers should not be reset while a stencil buffer is used.

Closes #2138
2022-06-19 17:13:34 +09:00
Hajime Hoshi
ac802cf0d0 internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles
Closes #2154
2022-06-19 15:38:12 +09:00
Hajime Hoshi
667bf2ff9d internal/graphicsdriver/directx: refactoring 2022-06-19 01:44:31 +09:00
Hajime Hoshi
2a5b64bf4d internal/graphicsdriver/directx: suppress warnings for depth buffers
Updates #2138
2022-06-19 00:21:04 +09:00
Hajime Hoshi
81b3d7bfac internal/graphicsdriver/directx: add an assertion 2022-06-18 22:33:07 +09:00
Hajime Hoshi
f7a108e693 internal/graphicsdriver/directx: refactoring 2022-06-18 21:53:41 +09:00
Hajime Hoshi
b71a4975dd internal/graphicsdriver/directx: bug fix: wrong state transitions at screen images
This change fixes the following issues:
 * There should be two resource states for presenting targets, so an image
   for the screen must have two resource states, though it had only one
   in the current implementation.
 * At removeImage, the screen image was removed unexpectedly.

Updates #2081
Closes #2151
2022-06-18 19:01:59 +09:00
Hajime Hoshi
522660c1f9 internal/graphicsdriver/directx: fix fence usages
Updates #2034
Updates #2138
Updates #2149
2022-06-18 15:44:54 +09:00
Hajime Hoshi
e78d888b24 internal/graphicsdriver/directx: handle error at Signal 2022-06-18 02:53:12 +09:00
Hajime Hoshi
0c38d6faeb internal/graphicsdriver/directx: add comment about frames
Updates #2034
2022-06-18 01:18:49 +09:00
Hajime Hoshi
a16ffef499 internal/graphicsdriver/directx: update frameIndex at present
This follows the official GDK samples.
2022-06-18 01:09:54 +09:00
Hajime Hoshi
07a558b38d internal/graphicsdriver/metal: bug fix: the default driver must be initialized on the main thread
Closes #2147
2022-06-17 14:58:26 +09:00
Hajime Hoshi
b43312fe80 internal/graphicsdriver/directx: add comments
Updates #2142
2022-06-17 12:19:36 +09:00
Hajime Hoshi
2f84e77e74 internal/graphicsdriver/directx: fallback to OpenGL when initialization fails
Closes #2142
2022-06-17 12:12:44 +09:00
Hajime Hoshi
9962fc5ee5 internal/graphicsdriver/direct: replace Get -> NewGraphics
Updates #2142
2022-06-17 11:48:40 +09:00
Hajime Hoshi
138463e219 internal/ui: rename chooseGraphicsDriver -> newGraphicsDriver 2022-06-17 02:40:39 +09:00
Hajime Hoshi
7484df0c5e internal/graphicsdriver/metal: replace Get with NewGraphics
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.

Updates #2142
2022-06-17 02:40:35 +09:00
Hajime Hoshi
a6d415ebf2
internal/graphicsdriver/opengl: replace Get with NewGraphics (#2146)
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.

Updates #2142
2022-06-17 02:02:29 +09:00
Hajime Hoshi
195b060911 internal/graphicsdriver/metal: refactoring: initialize the driver at Get 2022-06-16 23:52:55 +09:00
Hajime Hoshi
76d88b276a internal/graphicsdriver/directx: call C++ side for ID3D12GraphicsCommandList functions
Updates #2084
2022-06-13 22:35:58 +09:00
Hajime Hoshi
4aebcd2a04 internal/graphicsdriver/directx: bug fix: consider empty slices as arguments 2022-06-13 17:51:02 +09:00
Hajime Hoshi
c08d79d2ce internal/graphicsdriver/directx: keep runtime.KeepAlive for Xbox 2022-06-13 17:36:58 +09:00
Hajime Hoshi
4adf46c2b0 internal/graphicsdriver/directx: refactoring 2022-06-13 17:25:27 +09:00
Hajime Hoshi
348435f769 internal/graphicsdriver/directx: fix a constant value for Xbox
Updates #2084
2022-06-13 14:23:29 +09:00
Hajime Hoshi
44cfb92cee internal/ui: bug fix: MaximizeWindow before Run caused an unexpected error on Windows
Closes #2137
2022-06-13 12:28:20 +09:00
Hajime Hoshi
aef5402831 internal/graphicsdriver/directx: remove unused function 2022-06-13 01:35:31 +09:00
Hajime Hoshi
bcb2fe8c93 internal/graphicsdriver/directx: enable D3D12SerializeRootSignature for Xbox
Updates #2084
2022-06-13 01:02:48 +09:00
Hajime Hoshi
253f2757d1 internal/atlas: add a test to modify pixels after ReplacePixels call 2022-06-11 23:44:29 +09:00
Hajime Hoshi
08b52698c6 internal/graphicsdriver/directx: call C++ side for some functions for Xbox
Updates #2084
2022-06-11 19:37:17 +09:00
Hajime Hoshi
4a19d645b7 internal/graphicsdriver/opengl: remove a comment 2022-06-11 15:36:10 +09:00
Hajime Hoshi
71a32d2036 internal/ui: pass the canvas element directly instead of an ID 2022-06-11 15:34:17 +09:00
Hajime Hoshi
95628ee5f7 internal/ui: add a unique ID to the canvas for browsers 2022-06-11 15:24:50 +09:00
Hajime Hoshi
d42bb7d699 internal/graphicsdriver/directx: add a comment for Xbox
Updates #2084
2022-06-11 14:20:21 +09:00
Hajime Hoshi
826afcb9cc internal/graphicsdriver/directx: fix CopyTextureRegion for Xbox
Updates #2084
2022-06-10 22:51:04 +09:00
Hajime Hoshi
abef203a70 rename github.com/ebitne/purego -> github.com/ebitengine/purego 2022-06-10 21:59:01 +09:00
Hajime Hoshi
07aa906753 internal/graphicsdriver/directx: fix GetCPU/GPUDescriptorHandleForHeapStart for Xbox
Updates #2084
2022-06-10 21:35:20 +09:00
Hajime Hoshi
b9373c498b internal/graphicsdriver/directx: fix CreateCommandList for Xbox
Updates #2084
2022-06-10 16:44:07 +09:00
Hajime Hoshi
37369a2f4b internal/atlas: add TestMaxImageSizeJust 2022-06-10 14:30:18 +09:00
Hajime Hoshi
03567f74f9 internal/atlas: bug fix: respect injected maxSize for testings 2022-06-10 14:25:08 +09:00
Hajime Hoshi
7c458f519e internal/atlas: remove unnecessary comments 2022-06-10 13:53:24 +09:00
Hajime Hoshi
6b814888b5 internal/atlas: always use DrawTriangles at putOnAtlas
DrawTriangles was introduced at #1508, and apparently there is no
reason we should use ReplacePixels here. So, simplify the logic by
using only DrawTriangles.
2022-06-10 02:58:04 +09:00
Hajime Hoshi
bdae45be8f internal/atlas: add assertions 2022-06-10 02:38:35 +09:00
Hajime Hoshi
116e131ccf internal/atlas: rename ImageTypeIsolated -> ImageTypeUnmanaged 2022-06-10 02:11:08 +09:00
Hajime Hoshi
b40022b286 internal/atlas: stop using padding for ImageTypeVolatile and ImageTypeIsolated
Closes #2131
2022-06-10 00:54:48 +09:00
Hajime Hoshi
9e34103491 internal/atlas: refactoring: make paddingSize a method
Updates #2131
2022-06-10 00:23:25 +09:00
Hajime Hoshi
5290605b2d internal/atlas: add comments 2022-06-08 11:18:08 +09:00
Hajime Hoshi
9ee56ac320 inetrnal/atlas: remove unnecessary (and risky) locks 2022-06-08 10:05:15 +09:00
Hajime Hoshi
3b6a080519 internal/atlas: bug fix: use the global lock for shaders
Closes #2129
2022-06-08 10:00:31 +09:00
Hajime Hoshi
83ac234142 internal/ui: bug fix: offscreen images were created too often unexpectedly 2022-06-08 09:26:22 +09:00
Hajime Hoshi
6b212d7642 internal/restorable: refactoring: add Image.needsRestoring 2022-06-08 02:24:10 +09:00
Hajime Hoshi
9f729cf5c3 internal/restorable: remove SetVolatile 2022-06-08 02:20:09 +09:00
Hajime Hoshi
81f91658ff internal/atlas: refactoring: remove SetVolatile and SetIsolate
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
b8e8d72377 internal/restorable: rename ImageTypeScreenFramebuffer -> ImageTypeScreen 2022-06-07 23:45:35 +09:00
Hajime Hoshi
d3e3df812a internal/ui: recreate an offscreen image when isScreenClearedEveryFrame is toggled
This is a preparation to remove SetVolatile and SetIsolated in
the atlas package.
2022-06-07 23:16:42 +09:00
Hajime Hoshi
6398230f84 internal/graphicscommand: add 'screen' info to (*newImageCommand).String() 2022-06-06 11:13:04 +09:00
Hajime Hoshi
73c893e977 internal/restorable: refactoring: unify NewScreenFramebufferImage and NewImage 2022-06-06 09:33:50 +09:00
Hajime Hoshi
31fd736ca5 internal/graphicscommand: refactoring: unify NewScreenFrameBufferImage and NewImage 2022-06-06 09:21:11 +09:00
Hajime Hoshi
cb0cbb4efa internal/restorable: refactoring: introduce ImageType 2022-06-06 09:13:55 +09:00
Hajime Hoshi
7f10744514 internal/atlas: add an assertion at putOnAtlas 2022-06-06 09:01:04 +09:00
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