Commit Graph

709 Commits

Author SHA1 Message Date
Hajime Hoshi
9f7d6962ff ebiten: Rename shader functions to get colors from textures
Updates #1325
2020-09-19 19:01:05 +09:00
Hajime Hoshi
850303b770 ebiten: Change the type of Uniforms to map[string]interface{}
Fixes #1324
2020-09-06 21:02:30 +09:00
Hajime Hoshi
d2cfed7558 examples/shader: Remove an unused variable
Updates #1328
2020-09-01 23:50:19 +09:00
Hajime Hoshi
dd7b0d81ae ebiten: Rename shader builtin functions
* imageSrcTextureSourceRegion -> imageSrcTextureRegion
 * image[N]TextureAt -> imageSrc[N]At
 * image[N]TextureBoundsAt -> imageSrc[N]BoundsAt

Updates #1325
2020-09-01 21:31:50 +09:00
Hajime Hoshi
77fa0cb9ef ui: Add SetInitFocused
Fixes #769
2020-08-23 02:19:09 +09:00
Tom Lister
65d5b64d29
ebiten: Rename SetClearingScreenSkipped/IsClearingScreenSkipped functions (#1317)
Fixes #1315
2020-08-20 17:12:22 +09:00
Hajime Hoshi
3060ad96f1 examples/contextlost: Fix comments 2020-08-20 00:45:59 +09:00
Hajime Hoshi
6718cd32a6 examples/contextlost: Skip Draw when the context lost happens
Updates #1314
2020-08-19 21:15:49 +09:00
Hajime Hoshi
7ec63acd1d ebiten: Bug fix: Set the state of being volatile on SetClearingScreenSkipped
Fixes #1309
2020-08-19 01:23:30 +09:00
Hajime Hoshi
2acb604260 examples/contextlost: Bug fix: Failed to compile with Go 1.12 2020-08-16 23:05:33 +09:00
Hajime Hoshi
05a1c2faa1 examples/shader: Always use 1 for an alpha
This is necessary to keep the color pre-multiplied
2020-08-16 02:34:21 +09:00
Hajime Hoshi
06ed4f5444 shader: Implement len function
Fixes #1279
2020-08-16 02:07:39 +09:00
Hajime Hoshi
a1d278b097 examples/shader: Add water.go
Updates #1284
2020-08-15 21:36:13 +09:00
Hajime Hoshi
d90edf5826 examples/windowsize: Add an option to skip clearing the screen
Updates #1132
2020-08-15 03:14:38 +09:00
Hajime Hoshi
d73472f4f2 Use the library style of file2byteslice 2020-08-14 00:50:09 +09:00
Hajime Hoshi
a1c7c18788 examples/shader: Regenerate files with the latest file2byteslice 2020-08-13 03:03:27 +09:00
Magnus
95022ff1a5
examples/shader: dissolve shader (#1291)
Updates #1284
2020-08-12 00:43:07 +09:00
Hajime Hoshi
08270ee729 shader: Enable to parse ... in an array type 2020-08-11 23:51:22 +09:00
Hajime Hoshi
70acb9c1f6 shader: Rename shader bultin functions
Renamed image0TextureSize to imageSrcTextureSize, and removed the
other texture-size functions.

As texture-coordinates are always in image0's texture texels,
calculations with texels are always done with image0's texture texels.
Then, other texture-size functions are useless. To avoid confusion,
let's remove the functions and leave the necessary funciton.
2020-08-11 05:02:22 +09:00
Hajime Hoshi
b95195ab71 examples/shader: Fix some API usages 2020-08-11 04:25:20 +09:00
Hajime Hoshi
69f87d5fd1 ebiten: Add new shader builtin functions: image[N]TextureBoundAt
Fixes #1287
2020-08-11 03:24:54 +09:00
Hajime Hoshi
bc930ed0ec Revert "examples/shader: Rename ScreenSize -> ImageSize"
This reverts commit 3893f9cdbe.

Reason: The screen size and the image size can be different.
2020-08-11 02:16:16 +09:00
Hajime Hoshi
68ca0c634e ebiten: Rename builtin shader functions
* textureDstSize -> imageDstTextureSize
 * texture[N]Size -> image[N]TextureSize
 * texture[N]At -> image[N]TextureAt

Updates #1287
2020-08-11 02:07:53 +09:00
Hajime Hoshi
3893f9cdbe examples/shader: Rename ScreenSize -> ImageSize 2020-08-11 01:52:16 +09:00
Hajime Hoshi
8bfe406470 examples/shader: Make the chromatic berration example more readable 2020-08-10 21:58:49 +09:00
Hajime Hoshi
8aa90e60d2 examples/shader: Regenerate bytes 2020-08-10 21:52:58 +09:00
Hajime Hoshi
f282a57a69 Revert "examples/shader: Merge generate.go and main.go"
This reverts commit fec9cae66a.

Reason: go generate failed without the build tag
2020-08-10 21:52:18 +09:00
Hajime Hoshi
fec9cae66a examples/shader: Merge generate.go and main.go 2020-08-10 21:12:34 +09:00
Tom Lister
6e5a9a4534
examples/shader: Add the chromatic aberration example (#1288)
Updates #1284
2020-08-10 21:08:53 +09:00
Hajime Hoshi
8dec91db43 examples/shader: Add the radial blur example
Updates #1284
2020-08-10 05:16:44 +09:00
Ishmeet
c352e69689
examples: Add a snake game (#1276) 2020-08-01 02:00:45 +09:00
Hajime Hoshi
0b3f846b47 examples/text: Update the title 2020-07-30 03:11:06 +09:00
Hajime Hoshi
481c160c2a text: Replace MeasureString with BoundString
Fixes #1272
2020-07-30 00:51:10 +09:00
Hajime Hoshi
2fb5108bbe shader: Rename viewportSize to textureDstSize
Updates #1239
2020-07-26 00:03:55 +09:00
Hajime Hoshi
c6282e1cfc examples/polygons: Bug fix: Inserted an experimental code 2020-07-25 23:30:01 +09:00
Hajime Hoshi
2bdbcd724d ebiten: Rename Draw*WithShader -> Draw*Shader
Updates #1168
2020-07-25 23:15:11 +09:00
Hajime Hoshi
a159f55520 examples/airship: Bug fix: z could be a too small number
Fixes #1256
2020-07-21 00:34:06 +09:00
Hajime Hoshi
c567a7b507 ebiten: Add DrawRectangleWithShader
Updates #1168
2020-07-20 22:48:22 +09:00
Hajime Hoshi
1217db3b1e ebiten: Remove user-defined vertex shaders
Fixes #1253
2020-07-20 10:07:55 +09:00
Hajime Hoshi
a3f62559c6 examples/shader: Add lighting example
Fixes #1234
2020-07-19 15:42:35 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
4021c24534 shader: Separate uniform variables and texture variabls
Textures cannot be treated as a regular variable, then they should
be treated differently from other uniform variables.

Add a new function texture0At replacing texture2D.

Updates #1239
2020-07-08 01:12:07 +09:00
Hajime Hoshi
f7757ae025 ebiten: Add AddressUnsafe
Fixes #1219
2020-07-03 00:33:07 +09:00
Hajime Hoshi
dcba380827 examples/audiopanning: Remove intro loop 2020-07-01 23:14:45 +09:00
Gabriel Ochsenhofer
9942d5bac2
example: Stereo audio panning example (#1227)
This example simulates an audio source (sprite) and an audio listener (camera).
The panning is relative to the sprite's position.

Fixes #1224
2020-07-01 23:03:47 +09:00
Hajime Hoshi
5d092ae022 examples/raycasting: Adjust the position of the message 2020-07-01 01:52:49 +09:00
João Wiciuk
c57e569aea
examples/raycasting: Fixed duplicated points, plotting ray count (#1225) 2020-07-01 01:47:42 +09:00
Hajime Hoshi
aee5d6d708 examples/sprites, examples/spriteshd: Misspelling 2020-06-28 22:22:52 +09:00
Hajime Hoshi
ebb3bcfeb5 examples/shader: Refactoring 2020-06-24 02:47:51 +09:00
Hajime Hoshi
545342262f examples/shader: Show an image 2020-06-24 01:41:27 +09:00
Hajime Hoshi
1f9cc53ce4 examples/keyboard/keyboard: Use RunGame
Updates #1111
2020-06-22 03:44:40 +09:00
Hajime Hoshi
841085863b examples/shader: Embed the shader file 2020-06-22 01:07:00 +09:00
Hajime Hoshi
d0df5950b5 examples/shader: Add mouse cursor 2020-06-22 00:47:53 +09:00
Hajime Hoshi
40e581c19f shader: Allow to mix an int and a float in a binary expression
Updates #1190
2020-06-21 03:34:55 +09:00
Hajime Hoshi
1785b6a670 examples/moire: Add a smaller scale, and remove AdjustTexel function from shaders
This can reproduce the bug reported at #669.

Apparently, the fix (8827520d4a) is
no longer required after 3550abef7a.
That's pretty odd, but examples/moire proves this fact.

Updates #669
Updates #759
2020-06-15 00:29:34 +09:00
Hajime Hoshi
d98713728a uidriver/glfw: Bug fix: SetVsyncEnabled(false) did not work before the main loop
Fixes #1197
2020-06-14 11:50:58 +09:00
Hajime Hoshi
f39c591252 shader: Enable more Go syntax 2020-06-11 01:13:03 +09:00
Hajime Hoshi
b64dc627e9 shader: Add a builtin function viewportSize 2020-06-10 23:07:57 +09:00
datosh
f3d0a71eba
Example for an orthogonal 2D camera (#1188) 2020-06-10 23:01:25 +09:00
loig
63677e0e50
examples: Use RunGame (#1183)
Fixes #1111
2020-06-07 21:36:46 +09:00
loig
e117086ca1
examples/wheel: Use RunGame (#1182)
Updates #1111
2020-06-07 19:23:25 +09:00
Hajime Hoshi
ba36d5a8e9 shader: Reland: Add a predefined uniform variable: __viewportSize 2020-06-07 00:14:09 +09:00
Hajime Hoshi
fe308f1971 Revert "shader: Add a predefined uniform variable: Internal_ViewportSize"
This reverts commit 6f411842f0.

Reason: Test failures on internal/restorable
2020-06-05 04:36:09 +09:00
Hajime Hoshi
6f411842f0 shader: Add a predefined uniform variable: Internal_ViewportSize 2020-06-05 03:00:43 +09:00
Hajime Hoshi
d0aa18ddb9 Add shader public APIs experimentally
Updates #1168
2020-06-04 01:40:50 +09:00
Hajime Hoshi
1da6dbcb29 examples: Use RunGame
Updates #1111
2020-05-30 21:47:36 +09:00
Hajime Hoshi
bab3288a37 examples: Use RunGame
Updates #1111
2020-05-30 21:20:26 +09:00
Hajime Hoshi
47f415fe5a examples/raycasting: Use RunGame
Updates #1111
2020-05-24 00:12:44 +09:00
Hajime Hoshi
0bbf0d5291 examples: Use RunGame
Updates #1111
2020-05-23 23:36:53 +09:00
Hajime Hoshi
837f767f45 examples: Use RunGame
Updates #1111
2020-05-15 03:55:28 +09:00
Hajime Hoshi
dc3ed76e3e examples: Use RunGame
Updates #1111
2020-05-12 02:35:26 +09:00
Hajime Hoshi
b71fa0b59b examples: Use RunGame
Updates #1111
2020-05-10 05:40:50 +09:00
Hajime Hoshi
a1e65a5e90 examples/hue: Use RunGame
Updates #1111
2020-05-10 05:29:18 +09:00
Hajime Hoshi
ce965077d8 examples/hsv: Use Game interface and RunGame
Updates #1111
2020-05-07 16:55:42 +09:00
Hajime Hoshi
9c1b99bd26
examples/audioinfiniteloop: Fix a wrong comment 2020-04-22 21:57:15 +09:00
Hajime Hoshi
29ef737413 examples/gamepad: Use RunGame
Updates #1111
2020-04-20 01:36:12 +09:00
Hajime Hoshi
ff271493e2 examples/fullscreen: Use RunGame
Updates #1111
2020-04-20 01:10:05 +09:00
Hajime Hoshi
de8707f6a1 examples/highdpi: Use RunGame
Updates #1111
2020-04-12 20:49:52 +09:00
Hajime Hoshi
6529629d29 examples: Use RunGame
Updates #1111
2020-04-12 20:30:51 +09:00
Hajime Hoshi
e16a4cd85c examples: Use RunGame
Updates #1111
2020-04-12 19:03:04 +09:00
Hajime Hoshi
cd4a0ba489 examples/rotate: Use RunGame
Updates #1111
2020-04-12 18:05:35 +09:00
Hajime Hoshi
9302160486 examples/flappy: Use RunGame
Updates #1111
2020-04-01 15:59:49 +09:00
Hajime Hoshi
01a1334639 examples/blocks: Use RunGame
Updates #1111
2020-04-01 15:57:49 +09:00
Hajime Hoshi
a70d6a314e examples/2048: Use RunGame
Updates #1111
2020-04-01 15:51:54 +09:00
Hajime Hoshi
7ac6b0bfa3 Update dependencies 2020-03-31 03:32:38 +09:00
Hajime Hoshi
161d8aae8f ui: Forbid RestoreWindow when the window is not maximized nor minimized
Fixes #1124
2020-03-31 02:48:22 +09:00
Hajime Hoshi
b470dace1a examples/windowsize: Bug fix: Nothing was rendered with -legacy mode 2020-03-31 02:22:21 +09:00
Hajime Hoshi
f01f5045ba examples/mascot: Use RunGame
Updates #1111
2020-03-31 01:06:47 +09:00
Hajime Hoshi
569f684d9b examples/windowsize: Improve messages 2020-03-29 02:36:14 +09:00
Hajime Hoshi
b7d555e724 examples/blocks: Bug fix: ESC key caused crashing 2020-03-29 02:35:58 +09:00
Hajime Hoshi
231edfbd3f example/contextlost: Bug fix: Compilie error on Go 1.14, Should use WebGL2 2020-03-29 02:03:14 +09:00
Hajime Hoshi
4fe5acd711 ui: Panic on MaximizeWindow when the window is not resizable
On Windows, the window could be maximized even when the window was
not resizable. This behavior is confusing. Forbid it so that the
behavior will be clearer.
2020-03-28 22:08:48 +09:00
Hajime Hoshi
7b5fb0a0d0 ui: Bug fix: The window was not shown on the secondary monitor on launching
This change changes the behavior of WindowPosition /
SetWindowPosition. The window position is now a relative position
and the origin position is the left-upper of the current monitor.

Fixes #1115
2020-03-28 19:51:47 +09:00
Hajime Hoshi
eb5f5485b3 examples/mascot: Add comments 2020-03-28 16:40:00 +09:00
Hajime Hoshi
e9508f8fbd examples/windowsize: Bug fix: Key I was assigned for multiple purposes 2020-03-28 15:29:02 +09:00
Hajime Hoshi
844dbc4a9b examples/windowsize: Better instruction message 2020-03-28 15:27:31 +09:00
Hajime Hoshi
237498e51f
ui: Add an optional function Draw function to Game interface (#1107)
This change adds an optional function Draw to the Game interface.
With Draw function, the game logic and rendering are separate.
There are some benefits:

  * The API is clearer and easier to understand.
  * When TPS < FPS, smoother rendering can be performed without
    changing the game logic depending on TPS.
  * Porting to XNA, which has separate functions Update and Draw,
    would be a little easier.

Draw is optional due to backward compatibility. Game interface was
already used before v1.11.x in mobile packages, and adding a
function would break existing code unfortunately. Then, we adopted
switching the behavior based on whether Draw is implemented or not
by type assertions.

IsDrawingSkipped will always return false when Draw is implemented.

Fixes #1104
2020-03-24 12:01:37 +09:00
Hajime Hoshi
37a8ae06c5 example/mascot: Use vx16 instead of dir 2020-03-22 17:31:46 +09:00