Commit Graph

1094 Commits

Author SHA1 Message Date
Hajime Hoshi
9c95b4accc examples/block: use text/v2 2023-11-15 22:38:28 +09:00
Hajime Hoshi
acd5207142 examples/text: use GoTextFace 2023-11-15 22:01:29 +09:00
Hajime Hoshi
b2c45a369a text/v2: remove the suffix 'InPixels'
Now all the units are pixels, the suffix is redundant.

Updates #2454
2023-11-15 21:53:58 +09:00
Hajime Hoshi
586a4b6d6e all: rename sizeInPoints -> sizeInPixels 2023-11-15 14:03:22 +09:00
Hajime Hoshi
f2180a5dc5 text/v2: rename SizeInPoints -> SizeInPixels 2023-11-15 13:14:36 +09:00
Hajime Hoshi
5fa2c00014 examples/texti18n: adjust positions and texts 2023-11-15 12:46:06 +09:00
Hajime Hoshi
5354ccc44f examples/2048: use text/v2
Also, this changes fixes a bug in (*text/v2.GoTextFace).Metrics.

Updates #2454
2023-11-15 12:28:39 +09:00
Hajime Hoshi
3080d361ec examples/texti18n: remove unnecessary variables 2023-11-15 03:54:19 +09:00
Hajime Hoshi
c24ade7af9 examples/texti18n: bug fix: wrong language was specified 2023-11-15 03:43:27 +09:00
Hajime Hoshi
fe35180b78 text/v2: implement GoTextFace
Closes #675
Updates #2143
Updates #2454
2023-11-15 03:40:45 +09:00
Hajime Hoshi
46600b42f9 text/v2: swap the arguments of Advance for consistency 2023-11-15 03:18:23 +09:00
Hajime Hoshi
ea1d9dde4e text/v2: add LayoutOptions
Now AppendGlyphs can treat multiple lines and alignments.
2023-11-13 23:47:37 +09:00
Hajime Hoshi
cca4e78651 examples/text: add an example to use alignments of text/v2
Closes #2143
2023-11-13 23:02:15 +09:00
Hajime Hoshi
56faf34932 examples/text: adjust the rendering position
text/v2's Draw uses the given position as the upper-left position
of the bounds by default, while text (v1) uses the given position
as the origin position. In order to approximate the same result of
the original text version, adjust the Y values.

Updates #2454
2023-11-13 01:37:36 +09:00
Hajime Hoshi
b8b8b16098 all: add text/v2
This change adds some basic APIs incuding StdFace.

GoTextFace will be added later.

Updates #2454
2023-11-12 17:04:25 +09:00
Hajime Hoshi
3ca6184294 ebiten: add a new FillRule: NonZero
Closes #2782
2023-11-06 12:11:38 +09:00
Hajime Hoshi
c01ceeaa6a ebiten: replace (*Image).Dispose with Deallocate
Closes #2808
2023-11-03 17:45:39 +09:00
Hajime Hoshi
f6ffd86ca8 examples/drag: refactoring 2023-10-28 00:10:15 +09:00
Hajime Hoshi
a7b87fddb4 examples/drag: use image.Alpha to detect user interaction 2023-10-27 10:04:11 +09:00
Hajime Hoshi
630789757f all: add files for PlayStation 5
The implementation is WIP.

Updates #2799
2023-10-16 00:54:08 +09:00
Hajime Hoshi
dce18d7c23 internal/ui: bug fix: SetWindowIcon(nil) didn't reset the window icon
Closes #2796
2023-09-30 02:46:40 +09:00
Hajime Hoshi
a269cf3785 ebiten: remove (*Monitor).Bounds()
Now the unit of Bounds is device-dependent pixels, and this is useless
and Ebitengine API always treat device-independent pixels. Rather,
this might confuse users.

Until we find a good solution, let's remove Bounds() for v2.6.
MonitorType itself is still useful to specify a monitor to show a
window.
2023-09-23 18:24:03 +09:00
Hajime Hoshi
67b3bc14da examples/monitor: use DebugPrint to simplify the sample 2023-09-23 15:56:41 +09:00
Hajime Hoshi
20ef839e03 all: rename arguments in Fragment
Updates #2767
2023-09-21 01:35:57 +09:00
Hajime Hoshi
d7a8f73a37 examples/textinput: add a log message about environments
Updates #2735
Updates #2736
2023-09-20 22:25:13 +09:00
Hajime Hoshi
14f2ee198e ebiten: add SetWindowMousePassthrough and IsWindowMousePassthrough
Closes #2511
2023-09-18 18:31:22 +09:00
Ketchetwahmeegwun T. Southall
60b7de6a3c
ebiten: add APIs to treat monitors (#2597)
This change adds these APIs:

* `type MonitorType`
* `func (*MonitorType) Bounds() image.Rectangle`
* `func (*MonitorType) Name() string`
* `func Monitor() *MonitorType`
* `func SetMonitor(*MonitorType)`
* `func AppendMonitors([]*MonitorType) []*MonitorType`

Closes #1835
2023-08-30 21:02:04 +09:00
Hajime Hoshi
db34930ae8 internal/graphics: add built-in Kage functions
This change adds these Kage functions:

* imageDstOrigin
* imageDstSrc
* imageSrcNOrigin
* imageSrcNSrc

and deprecates these functions:

* imageDstRegionOnTexture
* imageSrcRegionOnTexture

Closes #1870
2023-08-28 15:06:45 +09:00
Hajime Hoshi
101c9cbf5c examples/flappy: use the pixels mode 2023-08-28 03:52:52 +09:00
David Poirier
7fe89b173b
examples/gamepad: bug fix: correct iteration start button in gamepad example (#2730)
Start iterating at zero instead of gamepad id (which is usually 0).
2023-08-24 16:27:35 +09:00
Hajime Hoshi
2b03637b52 examples/textinput: bug fix: reset the state after committing 2023-08-02 18:09:55 +09:00
Hajime Hoshi
af5edf136d examples/textinput: add a comment 2023-08-02 18:02:42 +09:00
Hajime Hoshi
fbea792fe4 audio: rename Seek -> SetPosition and Current -> Position
Seek and Current are not removed but marked as deprecated.

Closes #2698
2023-08-02 01:24:52 +09:00
Hajime Hoshi
b3851839f9 examples/life: change the license to Apache License 2.0
Updates #2695
2023-08-01 23:36:02 +09:00
Hajime Hoshi
63df6168d9 internal/shader: use plural forms for Kage compiler directives
This change renames

```
//kage:unit texel
//kage:unit pixel
```

to

```
//kage:unit texels
//kage:unit pixels
```

.

Closes #2717
2023-08-01 11:41:38 +09:00
Mathieu Champlon
f3023ae88e
examples/lines: remove duplicated code (#2713) 2023-07-29 13:29:19 +09:00
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
58f1415cac examples/texti18n: use Jpan as a Japanese script 2023-07-09 15:17:25 +09:00
Hajime Hoshi
f8d8d7a231 examples/life, internal/graphicsdriver/opengl/gl: format copyright texts 2023-07-08 02:50:54 +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
1d143ffccb examples/texti18n: add comments
Updates #2454
2023-07-01 19:57:45 +09:00
Hajime Hoshi
198bd4788e examples/texti18n: bug fix: space characters were ignored 2023-07-01 18:17:01 +09:00
Hajime Hoshi
3ab50c91df examples: add examples/texti18n
This example shows how to render complex glyphs like Thai and Arabic.

Updates #675
2023-07-01 18:04:05 +09:00
Hajime Hoshi
1514749041 examples/text: remove a dependency on math/rand 2023-06-25 01:33:25 +09:00
Hajime Hoshi
569f472475 examples: replace BoundString with MeasureString and Metrics 2023-06-11 04:26:16 +09:00
Hajime Hoshi
7791ae3029 examples/text: bug fix: go-vet error 2023-06-10 19:29:14 +09:00
Hajime Hoshi
911cf0c48c text: deprecate BoundString
After we found a correct definition of the term 'dot', BoundString seems
less useful than expected. In order to adjust the position of a text, we
should use a face's Metrics and a string's advance (font.MeasureString).
2023-06-10 19:21:04 +09:00
Hajime Hoshi
41906115f4 examples/blend: use the face's metrics to calculate the position
For centering, using bounds is slightly inaccurate as the bounds
don't consider left/right-side bearings. Also, using bounds for
heights is slightly inaccurate as baselines for texts on the same
line would not be the same.

Updates #2143
2023-06-02 01:58:21 +09:00
Hajime Hoshi
f446288e0c update bitmapfont to v3 2023-05-30 11:17:36 +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
01bb42526a examples/shader: refactoring 2023-04-23 16:29:23 +09:00
Eric H
1fdc45e652
example: add a mouse capture example (#2642)
Closes #2641
2023-04-19 13:02:02 +09:00
Hajime Hoshi
bf18a5e998 examples/shader: bug fix: normalize pos correctly 2023-04-17 22:36:31 +09:00
Hajime Hoshi
820548ed68 example/shader: make default.go more deterministic 2023-04-17 22:27:27 +09:00
Hajime Hoshi
1c14ba8eeb examples/shader: add comments
Updates #1431
2023-04-13 14:16:55 +09:00
Hajime Hoshi
0776a54712 examples/shader: remove comments 2023-04-13 14:10:34 +09:00
Hajime Hoshi
2d6e13cda4 examples/shader: bug fix: wrong usages of position
Closes #2638
Updates #1431
2023-04-13 02:02:15 +09:00
Hajime Hoshi
3564a44638 examples/windowsize: add a new flag -runnableonunfocused 2023-04-01 03:13:47 +09:00
Hajime Hoshi
cbff3555db internal/graphicsdriver/opengl: drop WebGL 1 support
Closes #2191
2023-03-18 22:50:09 +09:00
Hajime Hoshi
8bd7ce5c20 vector: add anti-alias options to the utility functions
Closes #2606
2023-03-18 11:01:48 +09:00
Hajime Hoshi
e4aace6c40 examples/blend: shrink the window for small displays 2023-03-14 22:21:35 +09:00
Hajime Hoshi
3951df05c8 examples/audiopanning: fix the initial panning 2023-03-14 21:30:55 +09:00
Hajime Hoshi
84a86c86e4 examples/blend: disable resizing the window 2023-03-14 21:22:27 +09:00
Hajime Hoshi
903b5ab046 examples/blend: clean up 2023-03-13 02:11:05 +09:00
Hajime Hoshi
80cbf7cbae examples: bug fix: wrong sample rate 2023-03-13 00:23:57 +09:00
Hajime Hoshi
597fe171a4 examples/additive: remove examples/additive
This is duplicated with examples/blend.
2023-03-12 23:44:53 +09:00
Hajime Hoshi
c568668149 examples/subimage: add a comment
Updates #2471
2023-02-17 02:06:40 +09:00
Hajime Hoshi
68775cf065 examples/vector: specify alpha values explicitly 2023-02-14 19:26:14 +09:00
Hajime Hoshi
cb61633b70 examples/lines: specify color values explicitly 2023-02-14 19:14:38 +09:00
Hajime Hoshi
10f022e129 examples/lines: specify alpha values explicitly 2023-02-14 19:12:26 +09:00
Artem Sedykh
da54f19df5
add blend modes example (#2563) 2023-02-07 11:59:49 +09:00
quasilyte
ce36527d16
examples/camera: fix window title (#2564) 2023-02-06 17:31:23 +09:00
Hajime Hoshi
38a6583438 examples/audio: change the sample rate from 32000 -> 48000 2023-01-27 14:58:17 +09:00
Hajime Hoshi
0c76a0cbd7 examples/dropfile: bug fix: handle errors correctly 2023-01-25 15:25:06 +09:00
Hajime Hoshi
f009dd8dd2 ebiten: implement DroppedFiles to replace AppendDroppedFiles
Closes #2552
2023-01-25 14:27:11 +09:00
Hajime Hoshi
e03cb0d4df examples/dropfile: bug fix: go vet failed 2023-01-22 17:31:24 +09:00
Hajime Hoshi
8c25fac860 ebiten: add AppendDroppedFiles
Closes #1868
2023-01-22 17:22:25 +09:00
Hajime Hoshi
f054a7634a ebiten: deprecate (*Image).Size
Closes #2351
2023-01-20 01:26:37 +09:00
Hajime Hoshi
95f1ef0fb9 internal/ui: bug fix: recover the cursor shape when the cursor is visible
Closes #2527
2023-01-07 20:03:21 +09:00
Hajime Hoshi
dd7e125d9c ebiten: add KeyName for desktops and browsers
Updates #1904
2022-12-25 03:37:29 +09:00
Hajime Hoshi
0bec1e65fa ebiten: add RunGameOptions.SkipTaskbar
Closes #1518
2022-12-13 02:00:44 +09:00
Hajime Hoshi
8e5ae88738 examples/mascot: use RunGameWithOptions
Updates #2378
2022-12-13 01:06:48 +09:00
Hajime Hoshi
3024e07ecc ebiten: add RunGameOptions.ScreenTransparent
Closes #2378
2022-12-09 22:50:57 +09:00
Hajime Hoshi
d31b0189a2 ebiten: add RunGameOptions.InitUnfocused
Updates #2378
2022-12-09 21:27:32 +09:00
Hajime Hoshi
bb68ebfcad ebiten: add RunGameWithOptions to specify graphics library
This also adds mobile.SetGameWithOptions.

Updates #2378
2022-12-09 21:27:31 +09:00
Hajime Hoshi
760e6b9ebd examples/shader: bug fix: use pixels instead of texels for offsets
Closes #2483
2022-12-03 22:46:10 +09:00
Hajime Hoshi
746fbc7b5c examples/fontvector: refactoring 2022-11-25 23:44:48 +09:00
Hajime Hoshi
881d3b2018 examples/fontvector: adjust width 2022-11-25 23:29:28 +09:00
Hajime Hoshi
477bff3f62 add examples/vectorfont
Updates #1937
2022-11-25 18:49:26 +09:00
Hajime Hoshi
a042af98b1 text: improve rendering quality with HintingVertical
When HintingVertical is used, the interval between two glyphs is not
quantized (i.e. not a whole pixel). The text package didn't consider
this situation.

This change improves the quality by using more various glyph images
with 1/4 pixels granularity in vertical direction.

Closes #2469
2022-11-25 16:45:37 +09:00
Hajime Hoshi
f4b12462e6 ebiten: rename FloatLayouter -> LayoutFer
Updates #2285
2022-11-09 02:00:23 +09:00
Hajime Hoshi
8567c3c654 ebiten: add FloatLayouter
Closes #2285
2022-11-09 01:52:48 +09:00
Hajime Hoshi
156c34a316 ebiten: separate a package for ColorM: colorm
Closes #2171
2022-11-08 23:50:04 +09:00
Hajime Hoshi
d73e8f785d internal/graphicsdriver: render various destination regions as one command
Closes #2232
2022-11-04 20:49:44 +09:00
Artem Yadelskyi
86e694941f
examples: remove example build tag (#2433)
Closes #1462
2022-11-03 20:24:09 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
ac6843639d ebiten: undeprecate SetVsyncEnabled / IsVsyncEnabled
This change deprecates FPSMode and SetFPSMode.

Closes #2342
2022-10-29 01:16:08 +09:00
Hajime Hoshi
b019a3723a internal/ui: optimize GPU usages when the screen doesn't have to be updated
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).

Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
6ba14fdb00 vector: rename functions
Fill* was confusing especially when the color is a transparent color.

Closes #2403
2022-10-22 20:29:31 +09:00
Hajime Hoshi
c34c072efa vector: change the specificatino of Path.ArcTo
Closes #2401
2022-10-22 02:03:27 +09:00
Hajime Hoshi
5e15bafde8 vector: add FillCircle and StrokeCircle
Updates #2387
2022-10-22 01:24:51 +09:00
Hajime Hoshi
6f7b1a81d7 vector: add StrokeLine, FillRect, and StrokeRect
Updates #2387
2022-10-21 22:35:01 +09:00
Hajime Hoshi
a75472b524 vector: add (*Path).Close
Updates #2387
2022-10-21 18:16:48 +09:00
Hajime Hoshi
f04e391cb4 all: rename emptyImage -> whiteImage 2022-10-21 15:26:56 +09:00
Hajime Hoshi
9ec23ddeb4 ebiten: add DrawTrianglesOptions.AntiAlias and DrawTrianglesShaderOptions.AntiAlias
Closes #2385
2022-10-21 02:07:41 +09:00
Hajime Hoshi
885a3fa7cc examples/vector: bug fix: wrong offscreen resetting 2022-10-20 14:13:06 +09:00
Hajime Hoshi
e4b056bac6 examples/vector: fill the background with a solid color 2022-10-18 23:45:52 +09:00
Hajime Hoshi
b79495761e ebiten: add Blend and deprecate CompositeMode
Updates #2382
2022-10-16 22:47:00 +09:00
Hajime Hoshi
bcc5dc1703 examples/lines: show FPS/TPS 2022-10-15 02:23:26 +09:00
Hajime Hoshi
d2f6d8593b vector: add LineCap
Closes #1843
2022-10-15 00:40:28 +09:00
Hajime Hoshi
599571c7a7 ebiten: add geoM argument to DrawFinalScreen
Updates #2046
2022-10-14 23:35:58 +09:00
Hajime Hoshi
596efc86fe examples/lines: more dynaic effect 2022-10-14 23:26:15 +09:00
Hajime Hoshi
225bf1bbb4 vector: add StrokeOptions.MiterLimit 2022-10-14 23:25:59 +09:00
Hajime Hoshi
a1a598471b vector: add LineJoin
Updates #1843
2022-10-14 22:11:00 +09:00
Hajime Hoshi
d2eeca3067 examples/flappy: typo 2022-10-14 16:51:32 +09:00
Hajime Hoshi
30cc36b1ba ebiten: add FinalScreenDrawer
FinalScreenDrawer is an interface for a custom screen rendering. If a
game implements FinalScreenDrawer and is passed to RunGame, its
DrawFinalScreen is called after Draw.

Also this adds `-crt` option to examples/flappy.

Closes #2046
2022-10-14 16:49:32 +09:00
Hajime Hoshi
0803342d01 examples/shader: remove the CRT effect 2022-10-14 16:14:46 +09:00
Hajime Hoshi
93c09633ee examples/shader: bug fix: wrong function usages
The tex-coord should have been modified by the source texture
region/size, rather than the destination texture's.
2022-10-14 16:04:09 +09:00
Hajime Hoshi
69c8fd745b vector: add AppendVerticesAndIndicesForStroke
Updates #1843
2022-10-10 23:19:29 +09:00
Hajime Hoshi
010bf69f5a examples/vector: improve readability of the debug message 2022-10-10 00:22:57 +09:00
Hajime Hoshi
5d9acfe7ec examples/vector: add switching anti-alias
This change is a proof-of-concept of anti-alias with a pseudo MSAA
effect.

Updates #663
2022-10-09 21:27:16 +09:00
Hajime Hoshi
cda6fa156f examples/flappy: reorder build tags 2022-09-20 23:56:27 +09:00
Hajime Hoshi
67400d242b examples/resource: use go:embed for images
Closes #1258
2022-09-17 23:27:45 +09:00
Hajime Hoshi
5305735055 examples/resource: use go:embed for audio and fonts
Updates #1258
2022-09-17 22:15:40 +09:00
Hajime Hoshi
289129c9e5 examples/shader: use go:embed
Updates #1258
2022-09-15 23:18:49 +09:00
Hajime Hoshi
d57cd39bb9 examples/resources/images/keyboard: fix comment 2022-09-15 23:18:49 +09:00
Hajime Hoshi
6e6145541d examples/keyboard/keyboard: use go:embed
Updates #1258
2022-09-15 22:58:57 +09:00
Hajime Hoshi
5404e4d68a all: replace io/ioutil with io and os
Closes #1770
2022-09-15 02:54:25 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis (#2293)
Closes #2287
2022-09-10 01:52:46 +09:00
Hajime Hoshi
6b1502ee71 examples/audio: handle errors
Updates #2287
2022-09-09 16:52:03 +09:00
Hajime Hoshi
f7c44f086f replace Ebiten with Ebitengine in comments 2022-08-29 11:17:17 +09:00
Hajime Hoshi
610e9ce14c gofmt -s -w 2022-08-28 00:04:32 +09:00
Terra Brown
de35a5a6f1
ebiten: add Termination for a regular termination (#2272)
Closes #2266
2022-08-27 21:33:40 +09:00
Hajime Hoshi
b858f36d54 remove the dependency on file2byteslice
Specify the version explicitly instead.
2022-08-23 16:34:55 +09:00
Hajime Hoshi
4d03b9fd98 examples/audio: use ebitenutil.DrawCircle
Updates #2250
2022-08-18 15:42:45 +09:00
Hajime Hoshi
bcba362e7e inpututil: add AppendJustReleasedTouchIDs and TouchPreviousPosition
Closes #2057
2022-08-16 02:21:55 +09:00
Hajime Hoshi
e21c881644 examples/paint: refactoring: avoid calling input functions in Draw 2022-08-16 01:06:22 +09:00
Hajime Hoshi
1c548c0641 examples/keyboard: refactoring 2022-08-13 13:37:01 +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
05baee51d2 examples/highdpi: remove an old comment 2022-08-12 00:16:08 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
0217ed0544 ebiten: add WritePixels replacing ReplacePixels
Closes #2236
2022-08-08 03:50:27 +09:00
Hajime Hoshi
05dd36ec7b examples/fullscreen: enable to test on mobile browsers
Closes #2060
2022-08-07 19:31:56 +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
e41a8be9e4 add tools.go 2022-07-30 02:16:53 +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
ca8c36499d ebiten: recommend errors.Is instead of comparing the returned value directly
Closes #2152
2022-07-24 23:25:48 +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