Commit Graph

4424 Commits

Author SHA1 Message Date
Hajime Hoshi
91e1c0ea29 ebiten: add more cursor shapes
This change adds these new cursor shapes:

* CursorShapeNESWResize
* CursorShapeNWSEResize
* CursorShapeMove
* CursorShapeNotAllowed

Closes #2476
2023-07-23 00:49:45 +09:00
Hajime Hoshi
269b557e38 internal/glfw: rename files
Updates #1162
2023-07-22 18:15:46 +09:00
Hajime Hoshi
3d41e8171e internal/cglfw: refactoring: split build.go into each platform 2023-07-22 17:37:48 +09:00
Hajime Hoshi
47dea6fac4 move internal/glfw/glfw to internal/cglfw 2023-07-22 01:02:55 +09:00
Hajime Hoshi
c85c5b1884 internal/glfw: move Wayland files 2023-07-21 01:59:40 +09:00
Hajime Hoshi
0324db5657 internal/glfw/glfw: remove -l options
DLLs for OpenGL are loaded automatically and doesn't have to link them
when compiling.

DLLs for Vulkan are not used.
2023-07-21 01:09:25 +09:00
Hajime Hoshi
65bbfad84a internal/glfw/glfw: remove null_platform.h 2023-07-21 01:04:08 +09:00
Hajime Hoshi
214f6094f8 internal/glfw/glfw: move osmesa_context.h 2023-07-21 00:09:17 +09:00
Hajime Hoshi
f6e5d2eca6 internal/glfw/glfw: remove unnecessary files 2023-07-21 00:03:26 +09:00
Hajime Hoshi
bccb33236f internal/glfw/glfw: move xkb_unicode.* and X11 files 2023-07-20 23:37:44 +09:00
Hajime Hoshi
e10c5f5c59 internal/glfw/glfw: move and remove null_* files 2023-07-15 12:57:15 +09:00
Hajime Hoshi
31bad92c23 internal/glfw/glfw: move cocoa_* and nsgl_* files 2023-07-15 12:38:43 +09:00
Hajime Hoshi
647d2aca14 internal/glfw/glfw: move egl_context.* files 2023-07-15 12:30:12 +09:00
Hajime Hoshi
4d9ae2a815 ./internal/glfw/glfw: move posix_*.* files 2023-07-13 03:39:12 +09:00
Hajime Hoshi
d8a8404fd4 internal/glfw/glfw/glfw/src: remove internal.h 2023-07-13 03:39:12 +09:00
Hajime Hoshi
a4c183c5d4 internal/glfw/glfw: move some C and H files 2023-07-13 03:08:09 +09:00
Hajime Hoshi
8ee3a6d0c1 internal/glfw/glfw/glfw/src: remove warnings for Wayland 2023-07-13 02:33:06 +09:00
Hajime Hoshi
5ddf75c4b3 internal/glfw/glfw/glfw/src: bug fix: build failure 2023-07-11 00:15:41 +09:00
Hajime Hoshi
72293d48b5 internal/glfw/glfw: unify c_glfw_bsd.go and c_glfw_linux.go 2023-07-11 00:05:33 +09:00
Hajime Hoshi
bf197e379b internal/glfw/glfw: refactoring: remove glfw/include 2023-07-10 23:30:03 +09:00
Hajime Hoshi
4267e5d22e internal/gamepad: bug fix: do not call GetRawInputDeviceList with the count 0
Updates #2696
2023-07-08 19:18:05 +09:00
Hajime Hoshi
bc2b373bca internal/glfw/glfw: fix build tags 2023-07-08 14:04:30 +09:00
Hajime Hoshi
f8d8d7a231 examples/life, internal/graphicsdriver/opengl/gl: format copyright texts 2023-07-08 02:50:54 +09:00
Hajime Hoshi
c2b386a917 internal/glfw/glfw: refactoring 2023-07-08 02:34:56 +09:00
Hajime Hoshi
fafbe2711f internal/glfw/glfw: refactoring 2023-07-08 02:16:39 +09:00
Hajime Hoshi
8039911bc8 internal/glfw/glfw: add license header comments 2023-07-08 02:15:47 +09:00
Hajime Hoshi
a4c2072c0f internal/glfw/glfw: add 'static' to C functions 2023-07-08 00:37:20 +09:00
Hajime Hoshi
eba8713c64 internal/glfw/glfw: refactoring: reduce files 2023-07-08 00:33:20 +09:00
Hajime Hoshi
65fd352e3b internal/glfw/glfw: remove unused files 2023-07-07 12:12:47 +09:00
Hajime Hoshi
7a7d4fd91f internal/ui: bug fix: need to delay to capture a cursor
From the spec https://w3c.github.io/pointerlock/#extensions-to-the-element-interface,
capturing a cursor might require a cooltime. This change adds a delay
to capture a cursor just after escaping from a capture.

Closes #2693
2023-07-07 01:24:02 +09:00
Hajime Hoshi
d0b6d2c41a internal/glfw/glfw: remove implementation for joystick
Closes #2692
2023-07-06 23:24:34 +09:00
Hajime Hoshi
8052c5bdd5 internal/glfw/glfw: remove the Windows part 2023-07-06 00:08:48 +09:00
Hajime Hoshi
fbe732b378 copy github.com/go-gl/glfw/v3.3/glfw to internal/glfw/glfw
Closes #2546
2023-07-05 23:59:34 +09:00
guangwu
54e1263565
all: unnecessary use of fmt.Sprintf (#2691)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-05 16:36:29 +09:00
Hajime Hoshi
eb5c1ee818 internal/ui: bug fix: the original cursor position was not scaled correctly
Updates #2690
2023-07-05 09:24:29 +09:00
Hajime Hoshi
929539b66e add exp/textinput package
This works only for macOS and browsers so far.

Updates #1029
2023-07-05 02:09:04 +09:00
Hajime Hoshi
1d02d20879 internal/ui: fix comments 2023-07-04 23:34:00 +09:00
divVerent
b96aea70f1
internal/ui: compute antialias region size correctly. (#2681)
Closes #2679
2023-06-24 02:25:19 +09:00
Hajime Hoshi
8de08295e9 internal/restorable: refactoring 2023-05-26 01:44:13 +09:00
Hajime Hoshi
0f4066e7ac internal/restorable: remove clearIfOverlapped
We found clearIfOverlapped could be a heavy task in some actual applications.
Instead of clearing existing data in the pixels records, add a new record
with a nil slice which indicates a cleared region.
2023-05-25 21:26:53 +09:00
Hajime Hoshi
47f19da710 internal/restorable: early return for an empty rectangle 2023-05-25 19:17:22 +09:00
Hajime Hoshi
90562ee84b internal/goglfw: enable to build for GOOS=darwin
Updates #2546
2023-05-21 21:29:40 +09:00
Hajime Hoshi
0ab214b018 internal/goglfw: move updateWindowStyles call to win32window_windows.go
updateWindowStyles is originally a Windows-specific function in GLFW,
so this should be in win32window_windows.go.
2023-05-14 02:56:32 +09:00
the-goodies
12a179aab9
internal/goglfw: fix _GET_X_LPARAM and _GET_Y_LPARAM from api_windows.go (#2665)
Negative values should not disappear. For example, if _HIWORD returns 63000,
then _GET_Y_LPARAM should return -2536, but now it returns 63000.

This fixes that.
2023-05-10 09:27:40 +09:00
Hajime Hoshi
50b68a0427 internal/goglfw: refactoring: use unsafe.Add 2023-05-10 00:41:57 +09:00
Hajime Hoshi
1035b1d182 internal/shader: bug fix: wrong issue number
Updates #2590
Updates #2648
2023-05-09 01:40:33 +09:00
Hajime Hoshi
ad23ae81c1 internal/shader: bug fix: forbide assigning to a uniform variable
Closes #2648
2023-05-09 01:38:41 +09:00
Hajime Hoshi
0785502be3 internal/ui: refactoring 2023-05-09 00:35:54 +09:00
Hajime Hoshi
20edb04e5e internal/restorable: refactoring: add EndFrame 2023-05-08 01:09:25 +09:00
Hajime Hoshi
befe990562 internal/shaderir: refactoring 2023-05-05 14:24:48 +09:00
Hajime Hoshi
ceb2bfc89c internal/shaderir: refactoring: use the append pattern 2023-05-04 14:34:22 +09:00
Hajime Hoshi
e4c9d6705c internal/shaderir: refactoring 2023-05-04 14:26:08 +09:00
Hajime Hoshi
ecf07ad09e internal/graphicscommand: speed optimization: reduce boundary checks
Co-authored-by: Egon Elbre <egonelbre@gmail.com>
2023-05-04 12:55:53 +09:00
Hajime Hoshi
d16b591a35 internal/graphicsdriver/directx: bug fix: use an associated IDXGIFactory
In DirectX 11, if a device and a factory are independently created,
some functions like MakeWindowAssociation doe't work well.

This change fixes the issue by getting a factory from a device and
using it.

Closes #2661
2023-05-01 19:17:08 +09:00
Hajime Hoshi
b32258ab8c internal/atlas: refactoring 2023-04-29 13:41:39 +09:00
Hajime Hoshi
e98acd3dc7 internal/graphicsdriver: refactoring: use image.Rectangle 2023-04-29 01:12:05 +09:00
Hajime Hoshi
d2c991b774 all: refactoring: use image.Rectangle 2023-04-28 01:03:38 +09:00
Hajime Hoshi
cdcffd7d4f internal/restorable: refactoring: use image.Rectangle 2023-04-28 00:42:40 +09:00
Hajime Hoshi
d9a2b0922d internal/atlas: refactoring: remove unnecessary calculations 2023-04-28 00:26:09 +09:00
Hajime Hoshi
9e61b52a70 internal/atlas: refactoring: use image.Rectangle 2023-04-27 23:55:11 +09:00
Hajime Hoshi
82c7436be5 internal/packing: refactoring: use image.Rectangle 2023-04-27 23:45:57 +09:00
Hajime Hoshi
6c5477adea internal/atlas: remove borders at the upper and the left sides
Updates #2657
2023-04-27 09:06:05 +09:00
Hajime Hoshi
2a1d23d926 internal/shader: bug fix: panic when an assignment mismatch happens
Closes #2654
2023-04-26 22:09:25 +09:00
Hajime Hoshi
56b4cdc3c4 internal/graphics: use pixels for offsets 2023-04-26 00:38:23 +09:00
Hajime Hoshi
9d2178cf71 internal/shaderir: rename the built-in func to get a texel to __texelAt 2023-04-23 22:57:30 +09:00
Hajime Hoshi
49582519c1 all: add a compiler directive kage:unit
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.

With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.

With the texel-unit mode, the behavior is the same as the current
behavior.

Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
b5ca404c42 internal/shader: bug fix: a swizzling 'r' didn't work for vec2
Closes #2652
2023-04-23 21:29:20 +09:00
Hajime Hoshi
00e45affe9 all: update OpenGL version from 2.1 to 3.2
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.

Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
40c38eb9ee internal/graphicsdriver/opengl: refactoring: remove contextPlatform 2023-04-22 21:52:20 +09:00
Hajime Hoshi
8926a4213e internal/graphicsdriver/opengl: refactoring: move consts to gl 2023-04-22 21:20:34 +09:00
Hajime Hoshi
00ed6f08fc internal/graphicsdriver/opengl/gl: refactoring: reduce types 2023-04-22 19:27:56 +09:00
Hajime Hoshi
504006fc22 internal/graphicsdriver/opengl/gl: refactoring: remove unused types 2023-04-22 16:18:18 +09:00
Hajime Hoshi
0495101450 internal/graphicsdriver/opengl/gl: bug fix: build error with GOOS=js 2023-04-22 16:10:49 +09:00
Hajime Hoshi
0542f9daa3 internal/graphicsdriver/opengl/gl: refactoring 2023-04-22 15:59:18 +09:00
Hajime Hoshi
4f69ca4ea9 internal/graphicsdriver/opengl: add a debug mode with a build tag ebitenginegldebug
In the debug mode, GetError is inserted in each GL function call.

Closes #2650
2023-04-22 13:17:08 +09:00
Hajime Hoshi
b40c5b1e99 internal/ui: catch an error at At at updateIconIfNeeded
Closes #2647
2023-04-20 00:59:14 +09:00
Hajime Hoshi
95709d9182 internal/graphicsdriver/opengl: update GLES version to 3.0
GLES 3.0 is required for GLSL ES 3.0

Updates #1431
2023-04-19 22:43:26 +09:00
Hajime Hoshi
7509c1d7f5 internal/graphicsdriver/opengl: remove the version es100
es300 is requried for 'texelFetch' [1].

[1] https://registry.khronos.org/OpenGL-Refpages/es3.0/html/texelFetch.xhtml

Updates #1431
2023-04-19 22:10:32 +09:00
Hajime Hoshi
2f55bb1b3d internal/atlas, internal/graphicscommand: refactoring 2023-04-19 21:43:08 +09:00
Hajime Hoshi
6817be2594 internal/goglfw: ignore the invalid-handle error at DestroyWindow
Updates #2551
2023-04-18 23:53:26 +09:00
Hajime Hoshi
eb6a773d3f internal/graphicscommand: remove unnecessary space chars 2023-04-18 01:19:28 +09:00
Hajime Hoshi
df32901dce internal/shader: refactoring 2023-04-16 18:37:06 +09:00
Hajime Hoshi
c00579509a internal/ui: bug fix: wrong mouse cursor movement calculation
Closes #2634
2023-04-10 15:25:04 +09:00
Hajime Hoshi
a56924b22f internal/graphicsdriver/directx: refactoring 2023-04-09 16:49:52 +09:00
Hajime Hoshi
4473557e23 internal/graphicsdriver/directx: smooth rendering when resizing the window with DirectX 12
Updates #2615
2023-04-09 16:38:29 +09:00
Hajime Hoshi
2423733598 internal/graphicsdriver/directx: bug fix: wrong size was used when resizing
Updates #2633
2023-04-09 16:34:56 +09:00
Hajime Hoshi
2c088b9059 internal/graphicsdriver/directx: resize the swap chain after presenting is done
Updates #2633
2023-04-09 16:29:00 +09:00
Hajime Hoshi
730c7a2ad0 internal/graphicsdriver/directx: refactoring 2023-04-09 15:30:46 +09:00
Hajime Hoshi
78d3e4273b internal/graphicsdriver/directx: remove tearing
This is basically a revert of 0035ba0bd1.
I couldn't confirm that allowing tearing improved FPS. Rather, this
has a potential risk to cause an error at Present of the swap chain due
to an inconsistent argument, though I have not confirmed an actual issue.

Now the DirectX 11 driver was introduced, the situation has changed.

Updates #2034
Updates #2188
2023-04-09 14:47:51 +09:00
divVerent
cc24796270
internal/restorable: optimize removeDuplicatedRegions from O((n+m)^2) to O(n*m + m^2) (#2631)
This is achieved by replacing the function by one that only adds a single
new region, and only considers duplicates between the previously existing
region and the one newly added one, thereby removing previously redundant
checking of each previously existing region against each other.

This speeds up AAAAXY loading on a Moto G7 Play from 52.27 seconds to
8.15 seconds.

Closes #2626
2023-04-09 02:31:22 +09:00
Hajime Hoshi
ce71c31a27 internal/packing: refactoring: remove a redundant check of sizes 2023-04-09 01:13:44 +09:00
divVerent
574925cf7a
packing: remove redundant canAlloc checking and alloc allocating. (#2629)
By removing redundant work done in canAlloc and just calling alloc right away,
this removes 35% contribution to AAAAXY loading CPU time on the profile on
https://user-images.githubusercontent.com/251568/230496805-c5e32c19-9258-49c8-800b-a3f0bc3b072d.svg,
or - as measured via stopwatch - brings loading time on Moto G7 Play from
17.22s to 14.94s after already applying #2627.

This should be safe as there is no case in which alloc succeeds and the
allocated region isn't used; also, there is no case in which alloc mutates the
tree when it doesn't actually succeed (comment added in one place to justify
this).

Closes #2628
2023-04-08 22:03:16 +09:00
Hajime Hoshi
0d1f990338 internal/processtest: output a better error message when failing to compile a Go program 2023-04-01 04:01:39 +09:00
Hajime Hoshi
2875eb25f1 internal/processtest: add a test for #2620
Updates #2620
2023-04-01 03:59:00 +09:00
Hajime Hoshi
4e7db88829 internal/processtest: bug fix: timeout didn't work for go-run
Apparently timing-out for a go-run process didn't work well. Instead,
use CommandContext for the actual test binary which is already built.
2023-04-01 03:56:50 +09:00
Hajime Hoshi
09d2459f1c internal/ui: a more robust fix for the unfocused-window loop
Depending on the member variable bufferOnceSwapped is a little fragile.
Detect whether the window is shown or not instead.

Updates #2620
2023-04-01 03:36:51 +09:00
Hajime Hoshi
db7c99fde8 internal/ui: bug fix: an unfocused window should not wait until buffers are swapped once
On macOS, a window is hidden until buffers are swapped once. If a game is
not runnable on unfocused, as the window is hidden and unfocused, the
waiting loop for a window never ends.

This change fixes the issue by changing the loop condition.

Closes #2620
2023-04-01 03:01:59 +09:00
Hajime Hoshi
f5e0496611 internal/goglfw: ignore invalid-window-handle error at DestroyWindow
Closes #2551
2023-03-31 23:59:11 +09:00
Hajime Hoshi
14b34a7b0a internal/ui: typo 2023-03-31 03:21:48 +09:00
Hajime Hoshi
1999f8a024 internal/ui: use DirectX as a fallback for old Windows
Initializing OpenGL can fail [1], though this is pretty rare. For such
this case, try DirectX as a fallback.

[1] https://answers.microsoft.com/en-us/windows/forum/all/my-drivers-dont-support-opengl/a1ee0267-4dc8-4385-a185-6ed322d78329

Updates #2613
2023-03-31 03:15:52 +09:00