Commit Graph

853 Commits

Author SHA1 Message Date
Hajime Hoshi
873bb35587 vector: Add ArcTo
Updates #844
2021-07-16 22:52:32 +09:00
Hajime Hoshi
cea0aa72cb vector: Rename AppendVerticesAndIndices to AppendVerticesAndIndicesForFilling
Updates #844
2021-07-16 17:20:09 +09:00
Hajime Hoshi
5c4885c988 inpututil: Add AppendJustConnectedTouchIDs
Closes #1705
2021-07-10 23:30:04 +09:00
Hajime Hoshi
e8ea4046cb inpututil: Add AppendJustConnectedGamepadIDs
Updates #1705
2021-07-10 22:32:19 +09:00
Hajime Hoshi
a79c287bb7 inpututil: Add AppendPressedKeys
Updates #1705
2021-07-10 22:18:15 +09:00
Hajime Hoshi
30e3047d29 examples/typewriter: Fix comments 2021-07-10 04:38:26 +09:00
Hajime Hoshi
431cd33839 ebiten: Add AppendInputChars, AppendGamepadIDs, and AppendTouchIDs
These functions reduce unnecessary allocations of arrays.

Closes #1692
2021-07-10 03:03:24 +09:00
Hajime Hoshi
b466a0cbd7 ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
8ff42f55a1 internal/graphicsdriver/opengl: Give up restorign on browsers
Using restorable images is expensive as this sometimes requires to
load pixels from GPU. On browsers, just reloading the application
should be fine when the context lost happens.

Closes #1603
2021-06-26 16:54:21 +09:00
Hiroki KUMAZAKI
eb5fde74af
examples: Add an example "stars" (#1679) 2021-06-24 22:50:47 +09:00
Hajime Hoshi
a615be69c7 examples: Add //go:build 2021-06-24 21:49:37 +09:00
Hajime Hoshi
bd13e96727 examples/noise: Show FPS 2021-06-24 12:06:59 +09:00
Hajime Hoshi
49c3c30c79 ebiten: Add IsWindowBeingClosed / SetWindowClosingHandled / IsWindowClosingHandled
IsWindowBeingClosed reports whether the window is being closed by
the user.

SetWindowClosingHandled sets whether the window closing is handled
or not. If the state is true, the window is not closed immediately
by the user and the game can handle the closing state. In this case,
the Update function should return an error in order to end the game.

This change also adds examples/windowclosing.

Closes #1574
2021-06-14 02:29:11 +09:00
Hajime Hoshi
b54ad73a2b Add go:build comments with go1.17beta1 fmt 2021-06-11 01:11:46 +09:00
Hajime Hoshi
95a98950b8 examples/resources: Unify jab.wav to 48000 Hz
Updates #1649
2021-05-25 22:32:50 +09:00
Hajime Hoshi
ac526b1b83 examples/wav: Use 48000 Hz
Updates #1649
2021-05-25 22:09:48 +09:00
Hajime Hoshi
0247261d34 examples/flappy: Change the sample rate to 48000 2021-05-23 22:04:41 +09:00
Hajime Hoshi
7f67fb7b90 examples/flappy: Accept gamepads 2021-05-23 19:44:03 +09:00
Hajime Hoshi
44e96f2377 examples/resources/images: Add a license about alert.png 2021-05-04 18:17:17 +09:00
Hajime Hoshi
e1d0b902e1 examples/audio: Add buttons 2021-05-04 02:02:17 +09:00
Tom Lister
bea5ab3335
internal/uidriver/glfw: Native macOS implementation for setting cursor shape (#1624)
Updates #1624
2021-05-02 14:50:50 +09:00
Hajime Hoshi
34be0371be examples/windowsize: Bug fix: Suppress calling SetWindowPosition if the position is not updated
This is a temoprary fix for the issue that the window size unexpectedly
shrunk on Linux.

Updates #1607
Closes #1605
2021-04-20 20:48:46 +09:00
Hajime Hoshi
7f8c3a13b3 examples/audiopanning: Bug fix: Align the buffer size
Closes #1598
2021-04-20 02:47:14 +09:00
Hajime Hoshi
5b96439fed Revert "examples/audiopanning: Bug fix: Out of range at reading bytes"
This reverts commit b1545b115c.

Reason: Calling UnreadByte twice is illegal

Updates #1598
2021-04-20 00:20:21 +09:00
Hajime Hoshi
b1545b115c examples/audiopanning: Bug fix: Out of range at reading bytes
Closes #1598
2021-04-19 22:06:00 +09:00
Hajime Hoshi
2f451e6014 examples/windowsize: Enable to specify either maxwindowsize or minwindowsize 2021-04-18 23:21:34 +09:00
Hajime Hoshi
45642668f7 examples/cursor: Change the background colors
On Windows, cursor colors are determined based on the background
color, and if the background color is gray, the cursor might be
invisible. This change adjust the color so that the cursor should
be visible in any cases.

Closes #1583
2021-04-18 19:34:53 +09:00
Hajime Hoshi
81ef20ddd0 examples: Use the new keys
Updates #1394
2021-04-18 01:13:20 +09:00
Hajime Hoshi
1b70901659 examples/windowsize: Swap arrow keys for resizing 2021-04-18 01:07:09 +09:00
Hajime Hoshi
ed4dded094 examples/hsv, examples/hue: Use wider screens 2021-04-17 22:10:14 +09:00
Hajime Hoshi
c950e03fb1 examples/blocks/blocks: Use gamepads to go back to the title 2021-04-17 21:55:58 +09:00
Hajime Hoshi
c8ed6ec12e examples/keyboard/keyboard: go generate 2021-04-17 19:30:04 +09:00
Hajime Hoshi
9b6ba5ed2c ebiten: Add {Set,}WindowSizeLimits
Closes #1385
2021-04-17 03:58:06 +09:00
Hajime Hoshi
d00d0c8556 ebiten: Add CursorShape/SetCursorShape/CursorShapeType
This change adds APIs to enable to use system cursor shapes other
than the default shape (an arrow).

This change doesn't add these cursors since they seem a little
different on macOS from the other platforms.

 * GLFW_HRESIZE_CURSOR
 * GLFW_VRESIZE_CURSOR

Closes #995
2021-04-16 01:09:19 +09:00
Hajime Hoshi
3043c6cb8e examples/windowsize: Enable to switch CursorMode 2021-04-11 03:33:02 +09:00
Hajime Hoshi
d46b0c5b49 examples/shader: Use const
Closes #1192
2021-04-09 02:02:03 +09:00
Hajime Hoshi
0300be7d9e examples/keyboard: Use inpututil functions in Update rather than Draw
This is not a strict rule, but it is preferrable to use input functions
in Update rather than Draw.
2021-04-07 01:54:53 +09:00
Hajime Hoshi
0fcf5c8470 inpututil: Add PressedKeys
Closes #770
2021-04-07 01:50:39 +09:00
Huw Griffiths
e1e213cc10
Add a new Touch example (#1547) 2021-03-24 22:27:12 +09:00
Hajime Hoshi
2c0108e178 examples/tiles: Misspelling 2021-03-09 03:23:53 +09:00
Hajime Hoshi
a13930650d examples/audiopanning: Bug fix: Fix several issues
* The stream was not looped.
 * The shown position was wrong.

Closes #1502
2021-02-22 02:00:52 +09:00
Hajime Hoshi
311d53ce2e examples/audio: Enable to touch 2021-02-21 19:20:24 +09:00
Hajime Hoshi
6f462e824f examples/audio: Use the same audio file for Ogg and MP3
This also changes the sample rate to 32000 for some special
environments.
2021-02-21 17:57:06 +09:00
Hajime Hoshi
d999b4dc8e internal/uidriver/glfw: Bug fix: Enable to specify ebiten.Image to SetWindowIcon
Closes #1468
2021-02-07 21:18:30 +09:00
Chris S. Kim
3d5733f693
examples/keyboard: Minor typo fix (#1436) 2020-12-15 11:55:17 +09:00
Hajime Hoshi
ede16afd30 examples/shader: Add a new example 'texel' 2020-12-09 23:33:59 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
61a8f2c69c examples/rotate: Update the resolution 2020-11-05 00:37:24 +09:00
Hajime Hoshi
552fbb7ed9 examples/contextlost: Enable to build on non-JS environments 2020-11-05 00:36:07 +09:00
Hajime Hoshi
fa53160e18 mipmap: Stop using negative mipmaps
Negative mipmaps tend to allocate extremely big images.

Instead, encourage to use images with explicit padding when enlarging
the image.

Fixes #1400
2020-10-31 02:52:40 +09:00
Hajime Hoshi
19d6f8d20a examples: Update resolutions
Fixes #1408
2020-10-31 02:06:45 +09:00
Hajime Hoshi
fd41042dcb examples/airship: Update the resolution
Updates #1408
2020-10-31 01:56:58 +09:00
Hajime Hoshi
e7d080ca4a mipmap: Bug fix: Too big scale tried to allocate too big images
Fixes #1399
2020-10-21 11:28:05 +09:00
Hajime Hoshi
75158feccf examples/shader: Add build tags for the generated files 2020-10-17 22:38:45 +09:00
Hajime Hoshi
fe6a2daef4 graphicsdriver/metal: Bug fix: Had to set the vsync state again at resetting
Fixes #1364
2020-10-14 01:58:56 +09:00
Hajime Hoshi
dfeb48b154 examples/windowsize: Fix the message 2020-10-10 23:00:49 +09:00
Hajime Hoshi
10f394f72b examples/wav: Play SE immediately 2020-10-10 05:03:51 +09:00
Hajime Hoshi
b1c67c7661 ebiten: Introduce type TouchID
Fixes #604
2020-10-10 03:57:47 +09:00
Hajime Hoshi
809b7a3afa ebiten: Introduce type GamepadID
Updates #604
2020-10-08 01:57:08 +09:00
Hajime Hoshi
bb20e62435 examples/gamepad: Bug fix: Misuse of indices and gamepad IDs 2020-10-08 01:13:51 +09:00
Hajime Hoshi
f1f7b350de audio, audio/mp3, audio/vorbis, audio/wav: Remove Close functions
Fixes #859
2020-10-07 23:39:58 +09:00
Hajime Hoshi
7a0e31a23a Clean up the 'js' build tags
Updates #1129
2020-10-07 01:33:10 +09:00
Hajime Hoshi
47065f5f2c Remove supporting jsgo
Updates #1129
2020-10-07 00:46:07 +09:00
Hajime Hoshi
41cf90a321 ebiten: Change the default value of IsRunningOnUnfocused to be true
Fixes #1180
2020-10-07 00:30:49 +09:00
Hajime Hoshi
c777dc6938 examples/contextlost: Bug fix: Compile error 2020-10-06 01:34:07 +09:00
Hajime Hoshi
1b816eb249 ebiten: Remove the error returning value from NewImageFromImage
Updates #1380
2020-10-06 01:03:33 +09:00
Hajime Hoshi
c6053bcf14 ebiten: Remove the error returning value from NewImage
Updates #1380
2020-10-06 00:48:56 +09:00
Hajime Hoshi
54da0d9763 ebiten: Remove the returning value from (*Image).DrawImage
Updates #1380
2020-10-06 00:21:17 +09:00
Hajime Hoshi
944a19c6f7 audio: Remove the error returning value from NewContext
Updates #1380
2020-10-05 02:25:13 +09:00
Hajime Hoshi
29b4087ebf audio: Remove the error returning value from NewPlayerFromBytes
Updates #1380
2020-10-05 02:18:27 +09:00
Hajime Hoshi
448a863eb1 ebiten: Remove FilterDefault
Fixes #503
2020-10-05 01:48:47 +09:00
Hajime Hoshi
fe97e7b0a5 ebiten: Remove the filter argument from NewImage and NewImageFromImage
Updates #503
2020-10-05 01:40:44 +09:00
Hajime Hoshi
8f00c8fbf5 ebiten: Remove the argument from Update
Fixes #1260
2020-10-04 19:33:10 +09:00
Hajime Hoshi
e90b5ff277 Update import paths in the documents 2020-10-04 05:07:08 +09:00
Hajime Hoshi
1d4ff9a906 ebiten: Remove the deprecated functions and constants
Updates #1127
2020-10-04 04:47:24 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
eb38324021 examples: Use golang.org/x/image/font/opentype
Fixes #484
2020-10-03 23:14:09 +09:00
Hajime Hoshi
43734dc1a2 examples/resources/fonts: Remove Arcade_n.ttf 2020-10-03 20:40:33 +09:00
Hajime Hoshi
92c0d8da7e Revert "examples/font: Use golang.org/x/image/font/opentype"
This reverts commit 7b3294064d.

Reason: #1377
2020-10-03 20:25:57 +09:00
Hajime Hoshi
990ba69d7a Revert "examples/2048: Use golang.org/x/image/font/opentype"
This reverts commit aa9f7f7c19.

Reason: #1377
2020-10-03 20:25:45 +09:00
Hajime Hoshi
041377a9a2 Revert "examples/fullscreen: Use golang.org/x/image/font/opentype"
This reverts commit b264a421ae.

Reason: #1377
2020-10-03 20:25:02 +09:00
Hajime Hoshi
42fe708263 Revert "examples/text: Use golang.org/x/image/font/opentype"
This reverts commit 013a42ddb8.

Reason: #1377
2020-10-03 20:24:05 +09:00
Hajime Hoshi
584916c694 examples/keyboard: Use golang.org/x/image/font/opentype
Updates #484
2020-10-03 15:32:10 +09:00
Hajime Hoshi
3f1d0788f5 examples: Use golang.org/x/image/font/opentype
Updates #484
2020-10-03 15:25:39 +09:00
Hajime Hoshi
c9af0e9bd4 examples/blocks: Use golang.org/x/image/font/opentype
This change also adds a new font "Press Start 2P".

Updates #484
2020-09-29 22:02:48 +09:00
Hajime Hoshi
b264a421ae examples/fullscreen: Use golang.org/x/image/font/opentype
Updates #484
2020-09-28 02:26:32 +09:00
Hajime Hoshi
013a42ddb8 examples/text: Use golang.org/x/image/font/opentype
Updates #484
2020-09-28 02:25:01 +09:00
Hajime Hoshi
aa9f7f7c19 examples/2048: Use golang.org/x/image/font/opentype
Updates #484
2020-09-28 02:23:17 +09:00
Hajime Hoshi
7b3294064d examples/font: Use golang.org/x/image/font/opentype
Updates #484
2020-09-28 02:20:14 +09:00
Hajime Hoshi
8cb037e902 examples/gamepad: Sort gamepad ids when showing the states 2020-09-21 17:30:28 +09:00
Hajime Hoshi
9ac7a16333 examples/camera: Add limitations to the zoom factor 2020-09-21 01:13:00 +09:00
Hajime Hoshi
8803138464 examples/airship: Bug fix: Avoid too big scaling
Fixes #1353
2020-09-21 00:43:13 +09:00
Hajime Hoshi
9906e4b882 go generate 2020-09-20 23:28:17 +09:00
Hajime Hoshi
e406ebb1aa ebiten: Rename imageSrcTextureRegion -> imageSrcRegionOnTexture
Updates #1325
2020-09-19 19:36:53 +09:00
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