Ebiten 2.2 Release Notes
v2.2.0
Nintendo Switch™
Ebiten now supports Nintendo Switch. For more information, please see Nintendo Developer Portal, the portal site for Nintendo platform developers.
Audio reimplementation
(#1549)
The audio implementaiton was much improved to have a bigger buffer for each player. Delays and noises should be reduced.
Standard gamepad layout mappings
(#1557)
Until v2.1, Ebiten's gamepad button and axis assignments varied among gamepads and environments. For example, a gamepad button number 1 might indicate a different physical button in another environment. It was hard to keep poratbility with gamepads.
Ebiten v2.2 adopted the standard gamepad layout in the Web standard. The standard gamepad layout is a model for modern gamepads like Xbox, PlayStation and Nintendo Switch. The standard gamepad layout assumes these buttons or axes:
- Two sticks
- Four buttons on the left hand (usually for arrows or D-pad)
- Four buttons on the right hand
- Four buttons on the front
- Three buttons on the center
If the standard gamepad layout is available for your gamepad in your environment, you can use APIs for standard gamepads like StandardGamepadButton
. You don't have to worry about the button/axis assignment differences.
On desktops, SDL's gamepad database is used. On browsers, browsers' standard mappings are used. On mobiles, mappings are not available yet.
type ebiten.StandardGamepadAxis
type ebiten.StandardGamepadButton
ebiten.IsStandardGamepadButtonPressed
ebiten.IsStandardGamepadLayoutAvailable
ebiten.StandardGamepadAxisValue
ebiten.StandardGamepadButtonValue
ebiten.UpdateStandardGamepadLayoutMappings
Unfortunately, not all gamepads have mappings for the standard gamepad layout. Use the existing APIs for unsupported gamepads.
For actual usages, see examples/gamepad
.
New vector graphics APIs
(#1684)
Vector graphics APIs in Ebiten were redesigned and reimplemented with stencil buffers.
A member FillMode
is added to ebiten.DrawTrianglesOptions
. The fill mode ebiten.EvenOdd
indicates a rule how an overlapped region is rendered. By combining this and a new function AppendVerticesAndIndicesForFilling
in vector
package, you can render complex shapes.
These APIs are added to vector
package:
For actual usages, see examples/vector
.
macOS's native fullscreen
(#1506)
On macOS, now fullscreening a window creates a new independent space and resizes the window to fit with the space.
Handling window-closing
(#1574)
You can prevent the window from being closed and do something when the window is being closed.
For actual usages, see examples/windowclosing
.
New vsync mode for static applications
(#1556)
In addition to vsync on and vsync off, Ebiten v2.2 added a new mode: FPSModeVsyncOffMinimum
. This indicates that the game doesn't sync with vsync, and the game is updated only when necessary like an input is detected. This is useful for a static application.
Append*
functions
There are some Ebiten functions that return a new slice for each call. Creating a new slice for each call allocates memory and is not efficient. To mitigate this issue, new functions were added to accept a slice and append new elements. These work like the built-in function append
. If the given slice has enough capacity, the functions don't allocate memory. If the given slice is empty or nil, a new slice is created.
ebiten.AppendGamepadIDs
ebiten.AppendInputChars
ebiten.AppendTouchIDs
inpututil.AppendJustConnectedGamepadIDs
inpututil.AppendJustPressedTouchIDs
inpututil.AppendPressedKeys
Performance improvements
- Memory usage at
ReplacePixels
was improved (#1681). - Allocating color matrices for scaling was improved (#1658).
- Reduced allocations of color matrix values (#1796).
- Ensured to free memory for image pixels soon after they were no longer used (#1803).
Other new functions
(*ebiten.Image).RGBA64At
(#1769).(*audio.Context).NewPlayer
: replacesaudio.NewPlayer
(#1708).(*audio.Context).NewPlayerFromBytes
: replacesaudio.NewPlayerFromBytes
(#1708).text.DrawWithOptions
(#1461).
Others
- A constant
ebiten.SyncWithFPS
was added to replaceebiten.UncappedTPS
(#1726). - In
audio/mp3
,audio/vorbis
,audio/wav
packages,Decode
andDecodeWithSampleRate
now takesio.Reader
instead ofio.ReadSeeker
(#1621). - Fixed an issue that
dfdx
and some functions in non-main function failed to compile in Kage (#1701). - Fixed the device scale factor on Linux and Unix desktops (Thank you, divVerent!) (#1774).
v2.2.1
Bug fix
- The screen was scaled wrongly with multiple and various scaling monitors on Windows (#1844).
- The screen was sometimes too small on Linux KDE (#1847).
v2.2.2
Bug fix
- Crashed on pressing the green button of a transparent window on macOS (#1857).
- Unexpected memory allocations happened (#1860).
v2.2.3
Bug fix
- Crash with multiple monitors (#1878).
- The screen was not resized correcly when restoring from fullscreen by the green button on macOS (#1884).
- Vsync didn't work on macOS 12 Monterey (#1885).
v2.2.4
Bug fix
v2.2.5
Bug fix
- On macOS, the green button kept active unexpectedly when the window was resizable at startup and unresizable later (#1987).
v2.2.6
Bug fix
- The constant
ebiten.KeyKPAdd
was missing (#2025).