Ebiten 2.1 Release Notes
v2.1.0
New features
Functions
These functions were added (#770, #995, #1385, #1561):
ebiten.CursorShape
: gets the current cursor shape.ebiten.SetCursorShape
: sets the current cursor shape.ebiten.SetWindowSizeLimits
: sets the window size limits.ebiten.WindowSizeLimits
: gets the window size limits.inpututil.PressedKeys
: returns all the pressed keys.
See the new example examples/cursor
for the cursors.
Functions (audio)
These functions were added (#1460):
mp3.DecodeWithSampleRate
: decodes decodes an MP3 data with the give sample rate.vorbis.DecodeWithSampleRate
: decodes decodes an Ogg/Vorbis data with the give sample rate.wav.DecodeWithSampleRate
: decodes decodes a WAV data with the give sample rate.
Functions (text)
text.CacheGlyphs
was added (#1413).
text.CacheGlyphs
precaches the glyphs for the given text and the given font face into the cache.
The cache is shared with text.Draw
. Glyphs are cached in a LRU way. As the cache's capacity has limit, it is not guaranteed that all the glyphs for runes given at CacheGlyphs
are cached.
Draw
automatically creates and caches necessary glyphs, so usually you don't have to call CacheGlyphs
explicitly. However, for example, when you call Draw
for each rune of one big text, Draw
tries to create the glyph cache and render it for each rune. This is very inefficient because creating a glyph image and rendering it are different operations ((*ebiten.Image).ReplacePixels
and (*ebiten.Image).DrawImage
) and can never be merged as one draw call. CacheGlyphs
creates necessary glyphs without rendering them so that these operations are likely merged into one draw call regardless of the size of the text. The two functions are implemented like this:
Draw
= Create glyphs by(*ebiten.Image).ReplacePixels
and put them into the cache if necessary + Draw them onto the destination by(*ebiten.Image).DrawImage
CacheGlyphs
= Create glyphs by(*ebiten.Image).ReplacePixels
and put them into the cache if necessary
Constants
For system cursors, a new type CursorShapeType
and these constants were added (#995):
CursorShapeDefault
CursorShapeText
CursorShapeCrosshair
CursorShapePointer
These key constants were added (#1382, #1561):
KeyAltLeft
KeyAltRight
KeyControlLeft
KeyControlRight
KeyMeta
KeyMetaLeft
KeyMetaRight
KeyShiftLeft
KeyShiftRight
As the key name convention has changed, these key constants were added to replace some of the existing keys (#1394). The key constants to be replaced are kept for compatibility:
KeyArrowDown
(replaces:KeyDown
)KeyArrowLeft
(replaces:KeyLeft
)KeyArrowRight
(replaces:KeyRight
)KeyArrowUp
(replaces:KeyUp
)KeyBackquote
(replaces:KeyGraveAccent
)KeyBracketLeft
(replaces:KeyLeftBracket
)KeyBracketRight
(replaces:KeyRightBracket
)KeyContextMenu
(replaces:KeyMenu
)KeyDigit0
(replaces:Key0
)KeyDigit1
(replaces:Key1
)KeyDigit2
(replaces:Key2
)KeyDigit3
(replaces:Key3
)KeyDigit4
(replaces:Key4
)KeyDigit5
(replaces:Key5
)KeyDigit6
(replaces:Key6
)KeyDigit7
(replaces:Key7
)KeyDigit8
(replaces:Key8
)KeyDigit9
(replaces:Key9
)KeyNumpad*
(replaces:KeyKP*
)KeyQuote
(replaces:KeyApostrophe
)
Build tag
A new build tag ebitensinglethread
was added (#1367). If this is enabled, the number of the internal threads becomes one and you can expect performance improvement. As a side effect, all Ebiten's concurrent-safe functions become concurrent-unsafe.
Others
- A tool to convert Go to C, go2cpp, was supported (#744). With this tool, Ebiten will work in an environment where Go is supposed not to work. Implmenting a binding for the targetted environment is necessary. We plan to announce the details later.
- Rendering no longer stops when a user resizes the window (#1204).
- A sub-image created by
SubImage
can now callFill
,DrawImage
and so on as a receiver (#1255, #1461). With this, you can render an image with clipping. CursorModeCaptured
became available on some of browsers (#1572).const
became available in the shading language Kage (#1192).- A function
cap
was added to Kage (#1361). - A function
imageDstOnTexture
was added to Kage (#1428). - Audio for browsers was reimplemented (#1458). A buffer size became bigger and you can expect less noises.
Backward compatibility
- "Negative mipmap" was abandoned (#1400). By this, rendering results of edges with a big scale might be different from those in v2.0. If you want to make sure edges are rendreed, you have to render a sub-image created by
SubImage
as a part of a big image.
Bug fix
This release includes all the bug fixes in v2.0.x.
- Too low TPS didn't work (#1417)
- Too high TPS didn't work (#1443, #1444)
CursorPosition
could return an extremely small number (#1587).GamepadName
andGamepadSDLID
could return wrong values on browsers (#1472).SetWindowIcon
crashed when an*ebiten.Image
was given (#1468).- In fullscreen, icons disappeared when calling
SetWindowIcon
(#1587). NewInfiniteLoop
andNewInfiniteLoopWithIntro
didn't work with a buffer whose size was not in multiples of 4 (#1503).- In the shading language Kage, functions
dfdx
,dfdy
,fwidth
didn't work on browsers (#1404). - In the shading language Kage, duplicated functions were not error (#1430).
Performance improvement
- Reduced thread context switchings (#1358).
- Made cache for the results of
(*ColorM).Scale
(#1474). - Fixed the problem that
ReplacePixels
might be slow in Metal (#1418, #1517). - Used
DrawImage
instead ofReplacePixels
when extending an internal texture (#1022, #1414). - Used
DrawImage
instead ofReplacePixels
when putting an idependent internal texture onto an internal texture atlas (#1508). - Reduced JavaScript object creations (#1426).
- Reduced JavaScript string creations (#1437, #1438).
- Used WebGL2 functions (#1435).
- Reduced object creations when the package
inpututil
is used (#1473).
v2.1.1
Bug fix
- Audio didn't stop when the screen unfocused on browsers (#1630).
- Crashed when the audio length was exactly multiples of the internal buffer size on browsers (#1635).
v2.1.2
Bug fix
ebitenmobile
command didn't work with the environment variableEBITENMOBILE_GOMOBILE
(#1667).ebitenmobile
didn't clean temporary directories up (#1668).- Too many calls of
SetWindowSize
might cause crash on Windows (#1672).
v2.1.3
Bug fix
(*ebiten.Image).Fill
on a sub-image might have an unexpected result (#1691).- Memory leak on macOS (#1698).
v2.1.4
Bug fix
- Screenshots by
EBITEN_SCREENSHOT_KEY
included unexpected 1px border (#1736). - Fallback to WebGL1 might not work when WebGL2 didn't work (#1738).
v2.1.5
Bug fix
- Crash when some gamepads were used (#1229).
- Crash on 32bit Windows (#1750).
- Creating a
Shader
after disposing aShader
might cause unexpected rendering (#1753). - Shaders might not work correctly on Windows (#1754).
v2.1.6
Bug fix
- The vsync mode was unexpectedly reset when going fullscreen on Windows (#1787).
v2.1.7
Bug fix
- Freeze when
MinimizeWindow
orMaximizeWindow
is called for a native fullscreen application on macOS (#1810).