Commit Graph

1192 Commits

Author SHA1 Message Date
Hajime Hoshi
4c2fc30311 graphicsutil: Don't allow nil GeoM 2018-06-17 01:48:56 +09:00
Hajime Hoshi
f6b7a6be73 graphics: Use copy function in appendVertices 2018-06-17 01:09:05 +09:00
Hajime Hoshi
b4ace53596 affine: Remove GeoM to avoid GeoM allocations on the heap 2018-06-17 00:59:50 +09:00
Hajime Hoshi
460c47a9eb opengl: Pass slices to js.Value 2018-06-16 02:19:18 +09:00
Hajime Hoshi
3fbe8d8ecb opengl: Change Shader/Program/Buffer to js.Value 2018-06-16 00:30:16 +09:00
Hajime Hoshi
2497b64cf7 opengl: Change uniformLocation to js.Value 2018-06-16 00:30:16 +09:00
Hajime Hoshi
17ccf06755 opengl: Change Texture/Framebuffer to js.Value 2018-06-16 00:30:16 +09:00
Hajime Hoshi
48e2c2aba9 opengl: Use gopherwasm 2018-06-16 00:30:16 +09:00
Hajime Hoshi
b87a851c0e ui: New GopherWASM API 2018-06-16 00:26:28 +09:00
Hajime Hoshi
a90b7efdf4 shareable: Refactoring 2018-06-11 01:02:25 +09:00
Hajime Hoshi
3ee76ffd8e graphicsutil: Move vertices.go to graphicsutil 2018-06-10 23:08:22 +09:00
Hajime Hoshi
9745ccee47 restorable: Make (*Image).DrawImage accept vertices and indices 2018-06-10 22:59:00 +09:00
Hajime Hoshi
97a54548df restorable: Rename vertices -> quadVertices 2018-06-10 20:41:17 +09:00
Hajime Hoshi
600983e028 restorable: Record indices for restoring 2018-06-10 20:17:48 +09:00
Hajime Hoshi
2e5e7e6e24 restorable: Remove merging commands for code simplicity 2018-06-10 20:06:17 +09:00
Hajime Hoshi
03079ba067 restorable: Refactoring 2018-06-10 18:40:46 +09:00
Hajime Hoshi
c782380a1c restorable: Specify indices from restorable package 2018-06-10 18:17:58 +09:00
Hajime Hoshi
2853895e6b graphics: Refactoring: Rename functions 2018-06-10 17:53:57 +09:00
Hajime Hoshi
32ac3840a7 graphics: Add comments 2018-06-10 17:10:11 +09:00
Hajime Hoshi
4e21bfd005 graphics: Rename elements -> indices 2018-06-10 17:06:40 +09:00
Hajime Hoshi
8a268e871f graphics: Specify indices before commands 2018-06-10 17:04:58 +09:00
Hajime Hoshi
be665a3526 ui: Better way to avoid blocking
Fixes #625
2018-06-09 13:36:35 +09:00
Hajime Hoshi
6e12f287b0 ui: Use goroutine to avoid blocking on GopherJS 2018-06-09 03:05:37 +09:00
Hajime Hoshi
e6d0943366 graphics: Rename color_matrix -> color_matrix_body 2018-06-06 02:46:54 +09:00
Hajime Hoshi
b86860abcc graphics: Call BindBuffer only when the program was null 2018-06-04 00:13:23 +09:00
Hajime Hoshi
fac639f9b7 graphics: Refactoring: Remove drawImageCommand.quadsNum 2018-06-03 23:58:08 +09:00
Hajime Hoshi
c9dd04d471 graphics: Refactoring: Remove command groups 2018-06-03 23:13:01 +09:00
Hajime Hoshi
9d87622a19 graphics: Set elements for every EnqueueDrawImageCommand 2018-06-03 20:42:45 +09:00
Hajime Hoshi
525ad04568 graphics: Split the notion of vertices and elements 2018-06-03 16:07:26 +09:00
Hajime Hoshi
25f2dfc677 graphics: Refactoring 2018-06-03 01:43:10 +09:00
Hajime Hoshi
03e3f0f5f7 graphics: Call glBufferSubData for element array buffer every frame
This is a preparation for more flexible drawing commands.
2018-05-31 00:53:05 +09:00
Hajime Hoshi
5e93d75ae0 graphics: Fix comments 2018-05-28 02:38:26 +09:00
Hajime Hoshi
399f965729 opengl: Add BindBuffer accepting both element-array-buffer and array-buffer
This change is a pure refactoring to clarify that array buffer is
binded before its usage.
2018-05-28 00:34:00 +09:00
Hajime Hoshi
311788dfe2 ui: Remove warnings of deadlock
Now gopherwasm fixed this problem by avoiding js.MakeFunc.

See also: 3fe87b73c0
2018-05-27 04:10:14 +09:00
Hajime Hoshi
8e9c3bd304 ui: Use gopherwasm 2018-05-27 02:35:17 +09:00
Hajime Hoshi
faaf391619 audio: Give up syncing audio timer and game timer (#617)
Syncing was already incomplete (e.g. decoding takes more than one
frame and delays can happen in this case). Giving up syncing audio
timer and game timer should not affect the game experience so much.
Instead, clock implementation will be much simpler.
2018-05-27 00:30:12 +09:00
Hajime Hoshi
5976e4bbbc audio: More intellegent suspending/resuming (#617)
Before this change, the audio is suspended when the game stops for
1/12[s]. However, as game often stops for more than 1/12[s]
especially on mobiles, this implemntation caused some audio
glitches.

This change fixes this problem by re-implementing suspending/
resumeing audio by detecting the window is active/focused or not.
2018-05-26 23:31:04 +09:00
Hajime Hoshi
d88d1be4ad mobile: Refactoring 2018-05-26 22:51:30 +09:00
Hajime Hoshi
980055e07a devicescale: Use gopherwasm 2018-05-25 02:00:41 +09:00
Hajime Hoshi
d894a13698 web: Use gopherwasm 2018-05-25 01:59:50 +09:00
Hajime Hoshi
2ec075004a clock: Use gopherwasm 2018-05-25 01:14:31 +09:00
Hajime Hoshi
4c5613d73c opengl: Remove unneeded casts 2018-05-23 01:29:16 +09:00
Hajime Hoshi
b84dc0585d opengl: Remove dependencies on gopherjs/webgl
This is a preparation for #528
2018-05-23 00:48:24 +09:00
Hajime Hoshi
81a1fd4744 testflock: Use just sync.Mutex on browsers (#615) 2018-05-19 21:10:34 +09:00
Hajime Hoshi
0637a812bc web: Fix detecting mobile browsers for NodeJS 2018-05-16 22:29:19 +09:00
Hajime Hoshi
a5eb1b84ab web: Better way to detect NodeJS 2018-05-16 22:10:35 +09:00
Hajime Hoshi
c2df8326fc ui: Refactoring: Use IsNodeJS 2018-05-16 22:02:33 +09:00
Hajime Hoshi
d7d892f2d6 graphics: Allow a little margin for edge pixels 2018-05-13 23:00:06 +09:00
Hajime Hoshi
a1dd7b39a3 graphics: Remove roundTexel function
Actually, at least 704d4cf464,
examples/moire doesn't work well without roundTexel on MacBook Pro.
However, now other parts are fixed (e.g. highp is used), it looks
like roundTexel is no longer needed.
2018-05-13 22:30:22 +09:00
Hajime Hoshi
b402cddd01 graphics: Bug fix: wrong refactoring in shader 2018-05-13 14:20:54 +09:00
Hajime Hoshi
efaa5aa17a graphics: Refactor shader 2018-05-13 03:31:28 +09:00
Hajime Hoshi
3ccfe087d9 Refactoring 2018-05-12 15:25:01 +09:00
Hajime Hoshi
453921f1d3 ui: Bug fix: sizeChange must be set after updateFullscreenScaleIfNeeded 2018-05-12 02:11:37 +09:00
Hajime Hoshi
f5336ce7bc opengl: Use 'EXT' functions for framebuffers
Some pretty old machines don't support OpenGL 3.x or later, and in
such environment, some framebuffer functions like glGenFramebuffers
are not available. Instead, EXT versions can be used even on
machines that don't support OpenGL 3.x.

After this change, Ebiten always tries to use EXT version of
framebuffer functions. I believe EXT version is always available
when non-EXT version is available, so this chang eshould be safe.

Fixes #602
2018-05-10 02:11:23 +09:00
Hajime Hoshi
92631e64ed Remove internal/sync
nosync package for GopherJS is problematic since nosync's mutex
assumes that Lock call is never duplicated, which is not true in
actual applications.

See also #603.
2018-05-09 23:41:08 +09:00
Hajime Hoshi
167d21ec46 devicescale: Panic on Android when called from init funcs 2018-05-05 03:16:29 +09:00
Hajime Hoshi
d8dba69b47 ui: Add MonitorSize
Fixes #470
2018-05-05 02:42:45 +09:00
Hajime Hoshi
9a06b31556 ui: Don't panic at DeviceScaleFactor in init
Fixes #597
2018-05-05 01:28:29 +09:00
Hajime Hoshi
d41f959b96 ui: Initialize GLFW before Run 2018-05-04 23:55:23 +09:00
Hajime Hoshi
f1927d8aca shareable: Add tests 2018-05-03 14:10:43 +09:00
Hajime Hoshi
03dcd94884 shareable: Bug fix: Don't mark disposed when the image becomes not shared 2018-05-03 11:49:55 +09:00
Hajime Hoshi
9efccea31c ui: Add SetWindowTitle
Fixes #595
2018-05-02 19:21:17 +09:00
Hajime Hoshi
0e19aa558a graphics: Remove unneeded GL calls 2018-05-02 01:12:17 +09:00
Hajime Hoshi
6a34b87a6c opengl: Refactoring 2018-05-02 01:01:04 +09:00
Hajime Hoshi
ea1444ea7e shareable: Add checks at operations for disposed images 2018-04-30 03:34:35 +09:00
Hajime Hoshi
9df977dff8 shareable: Add 'disposed' state instead of 'allocated' state 2018-04-30 03:30:10 +09:00
Hajime Hoshi
5dc1df3260 shareable: Fix tests 2018-04-29 19:15:04 +09:00
Hajime Hoshi
1f1847c259 shareable: Remove println 2018-04-29 19:10:36 +09:00
Hajime Hoshi
9c408dce7c shareable: Lazy allocation (#592)
Clear is called when an image becomes a render target, and it
looks like Clear causes the memory spikes.

Before this change, when an image is created, shared region on a GL
texture is allocated. After that, the image's region is copied to
non-shared region when the image becomes a rendering target.

After this change, an image is not allocated on a GL texture first,
and allocated only when it is necessary. Then, Clear calls can be
avoided as much as possible.
2018-04-29 18:51:51 +09:00
Hajime Hoshi
916c7aac8a restorable: Fix comments 2018-04-29 13:49:33 +09:00
Hajime Hoshi
45afb6db67 Reland: restorable: Merge Clear to ReplacePixel 2018-04-29 13:40:18 +09:00
Hajime Hoshi
613f384cb5 graphics: Add EBITEN_DUMP_IMAGES_KEY
Fixes #589
2018-04-28 22:08:20 +09:00
Hajime Hoshi
eb357f61b5 restorable: Bug fix: Calling At must resolve the image's stale state 2018-04-28 21:56:20 +09:00
Hajime Hoshi
b22cc9d4be Add periods after 'DO NOT EDIT' 2018-04-28 03:37:19 +09:00
Hajime Hoshi
0bc712422f restorable: Bug fix: Remove SetFinalizer for disposing
SetFinalizer causes concurrent issue
2018-04-27 12:08:59 +09:00
Hajime Hoshi
dff492955d shareable: Reset finalizer in any cases 2018-04-26 01:51:57 +09:00
Hajime Hoshi
1cf4f30541 Revert "restorable: Merge Clear to ReplacePixels"
This reverts commit fb641d88cd.

Reason: When restoring the image where ReplacePixels is called,
dummyImage might not be restored since there is no record of
relationships between this image and dummyImage. Now pixels is not
nil when reverting by chance, but this would cause problems in the
future.
2018-04-25 22:31:48 +09:00
Hajime Hoshi
fb641d88cd restorable: Merge Clear to ReplacePixels
This can avoid unnecessary stale images that requires loading
pixels from GPU.
2018-04-25 01:30:57 +09:00
Hajime Hoshi
1571e04753 Revert "graphics: Call glFlush after glTexSubImage2D for MacBook Pro"
This reverts commit 7f5719fadd.

Reason: This didn't change the situation
2018-04-22 22:06:38 +09:00
Jake Bentvelzen
2f4ca72dbd input: Add Pause and Print Screen buttons (#555)
Fixes #579
2018-04-21 09:36:28 -07:00
Hajime Hoshi
3fa2beb502 Fix the do-not-edit comment https://golang.org/s/generatedcode 2018-04-20 00:54:33 -07:00
Hajime Hoshi
b691e73342 Revert "graphics: Experimental fix: call glFlush always after glTexSubImage2D"
This reverts commit d2da77eb96.

Reason: This doesn't solve the issue on MacBook Late 2013.
2018-04-14 23:16:26 +09:00
Hajime Hoshi
d2da77eb96 graphics: Experimental fix: call glFlush always after glTexSubImage2D 2018-04-14 23:06:20 +09:00
Hajime Hoshi
7f5719fadd graphics: Call glFlush after glTexSubImage2D for MacBook Pro 2018-04-14 17:59:10 +09:00
Hajime Hoshi
d1ef57c280 input: Remove the last period from do-not-edit comment 2018-04-14 04:22:09 +09:00
Hajime Hoshi
61d4df0e04 input: Add numpad keys for Edge (#580) 2018-04-14 02:43:31 +09:00
Hajime Hoshi
dd6110fbf8 input: Add KeyNumLock (#580) 2018-04-14 02:43:26 +09:00
Hajime Hoshi
5229e5a713 input: Add numpad keys except for Edge browser (#580) 2018-04-14 02:43:21 +09:00
Hajime Hoshi
4708d4a6f9 Add internal/png 2018-04-10 04:17:41 +09:00
Hajime Hoshi
070c8ec737 shareable: Rename variables 2018-04-09 02:18:46 +09:00
Hajime Hoshi
899f007fd0 ui: Panic when error is found on mobile 2018-04-07 03:33:20 +09:00
Hajime Hoshi
2d3c6ab5b8 ui: Remove build tag 'gomobilebuild'
Fixes #573
2018-04-07 02:14:54 +09:00
Hajime Hoshi
9902497e3d test: Use flock to make tests exclusive
Fixes #575
2018-04-07 00:59:52 +09:00
Hajime Hoshi
e77eb9f80f shareable: Temporary disable tests (#575) 2018-04-06 03:47:05 +09:00
Hajime Hoshi
cc725b99af restorable: Replace emptyImage with dummyImage 2018-04-06 03:08:52 +09:00
Hajime Hoshi
70f16daafd restorable: Fix tests (wrong assumption was used) 2018-04-06 02:15:49 +09:00
Hajime Hoshi
7b5ad46e49 shareable: NewImage* now returns a cleared image 2018-04-06 02:08:12 +09:00
Hajime Hoshi
1a335032a2 shareable: Bug fix: backend's restorable image must be disposed 2018-04-06 01:12:08 +09:00
Hajime Hoshi
8ff79c970a shareable: Use defer for tests 2018-04-05 12:02:08 +09:00
Hajime Hoshi
24e20306f2 restorable: Move 'putting random-colored dot' to restorable 2018-04-05 11:18:28 +09:00