Commit Graph

42 Commits

Author SHA1 Message Date
bsski
b8df1217c3
all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi
c01ceeaa6a ebiten: replace (*Image).Dispose with Deallocate
Closes #2808
2023-11-03 17:45:39 +09:00
Hajime Hoshi
83a4133577 internal/ui: refactoring: remove globalState 2023-10-15 16:51:16 +09:00
Hajime Hoshi
20ef839e03 all: rename arguments in Fragment
Updates #2767
2023-09-21 01:35:57 +09:00
Hajime Hoshi
9ad9bc9ed9 ebiten: bug fix: wrong interpolation in the screen shader 2023-08-31 13:28:01 +09:00
Hajime Hoshi
0e1b73f94f ebiten: simplify the screen shader 2023-08-31 12:56:45 +09:00
Hajime Hoshi
ad2d8977b6 ebiten: update a comment 2023-08-31 11:50:15 +09:00
Hajime Hoshi
009fb504ed internal/builtinshader: remove adjustments for tie-breaking
This seems no longer needed with the pixel mode.

This was confirmed by this test:

```
go run . -run=TestImageLinearFilterGlitch2
```

The same change didn't work at b5ca404c42
but worked at 49582519c1, which
introduced the pixel mode.

Updates #1212
2023-08-30 23:55:44 +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
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
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
40aa35750c ebiten: bug fix: updating the input state must be protected by a mutex 2023-01-22 01:49:43 +09:00
Hajime Hoshi
b79f0394cc internal/ui: refactoring: allow slices in InputState 2023-01-22 01:28:57 +09:00
Hajime Hoshi
f054a7634a ebiten: deprecate (*Image).Size
Closes #2351
2023-01-20 01:26:37 +09:00
Hajime Hoshi
d3655940bd internal/ui: bug fix: input states must be updated before the hook
Closes #2502
2022-12-21 11:46:58 +09:00
Hajime Hoshi
d1b9a0a9a1 internal/ui: freeze the input state for each frame
After this change, the input APIs will return more consistent results
for one frame.

Closes #2496
2022-12-18 23:54:43 +09:00
Hajime Hoshi
3024e07ecc ebiten: add RunGameOptions.ScreenTransparent
Closes #2378
2022-12-09 22:50:57 +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
0d6b42fedd internal/ui: refactoring: keep screen/offscreen sizes as float64
Updates #2285
2022-11-09 01:18:41 +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
599571c7a7 ebiten: add geoM argument to DrawFinalScreen
Updates #2046
2022-10-14 23:35:58 +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
f15536e8de ebiten: refactoring: remove imageDumperGame
This enables passing the user's Game to internal/ui without wrapping.

This is necessary to check whether the user's Game implements an
optional function or not.

Updates #2046
2022-10-14 02:58:31 +09:00
Hajime Hoshi
25ae96db89 internal/ui: move screenScaleAndOffsets to the ebiten package
Updates #2046
2022-10-14 01:58:07 +09:00
Hajime Hoshi
1ff4918390 ebiten: rename receivers 2022-10-14 00:38:08 +09:00
Hajime Hoshi
4bd3a9ef8f internal/ui: refactoring: move the screen rendering logic to ebiten package
Updates #2046
2022-10-14 00:34:40 +09:00
Hajime Hoshi
d00bd1cb16 internal/ui: refactoring: move setVerticesCache to ui.Image
Updates #2362
2022-09-29 01:21:46 +09:00
Hajime Hoshi
6b23a94ae2 ebiten: bug fix: resolveSetVerticesCacheIfNeeded was not called for the offscreen
Closes #2362
2022-09-28 23:09:09 +09:00
Hajime Hoshi
bac34a4474 ebiten: add NewImageWithOptions and NewImageOptions
This change adds NewImageWithOptions, that creates a new image with
the given options.

NewImageWithOptions takes image.Rectangle instead of a width and a
height, then a user can create an image with an arbitrary bounds.
A left-upper position can be a negative number.

NewImageWithOptions can create an unmanged image, that is no longer
on an automatic internal texture atlas. A user can have finer controls
over the image.

This change also adds tests for this function.

Updates #2013
Updates #2017
Updates #2124
2022-06-15 02:20:19 +09:00
Hajime Hoshi
116e131ccf internal/atlas: rename ImageTypeIsolated -> ImageTypeUnmanaged 2022-06-10 02:11:08 +09:00
Hajime Hoshi
81f91658ff internal/atlas: refactoring: remove SetVolatile and SetIsolate
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
8e40b2562e internal/ui: remove an error returning value from Game.Draw 2022-04-01 19:10:10 +09:00
Hajime Hoshi
e78f34aa26 internal/ui: add Image
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
divVerent
ea35296be7
ebiten: provide SetScreenFilterEnabled, a way to disable the default screen filter (#1997)
Using FilterNearest rather than filterScreen or FilterLinear speeds up a
Dell E6500 from 23fps->36fps and 27fps->48fps.

Updates #1772
2022-02-24 03:46:27 +09:00
Hajime Hoshi
cc1fd437a1 ebiten: move comments 2022-02-23 02:54:14 +09:00
Hajime Hoshi
352fd76312 ebiten: optimization: use FilterNearest for an integer scale
Updates #1772
2022-02-23 02:52:51 +09:00
Hajime Hoshi
b695cb928a internal/ui: remove RunWithoutMainLoop in non-mobile environments 2022-02-13 22:31:48 +09:00
Hajime Hoshi
0529fa955e ebiten: refactoring: remove the global variable theGameForUI 2022-02-13 20:48:09 +09:00
Hajime Hoshi
82b9f7dc56 ebiten: refactoring: remove setScreenClearedEveryFrame 2022-02-13 20:40:46 +09:00
Hajime Hoshi
0c1c40995c internal/ui: rename types and members: uiContext -> gameForUI 2022-02-13 20:20:46 +09:00