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).ReplacePixelsand put them into the cache if necessary + Draw them onto the destination by(*ebiten.Image).DrawImageCacheGlyphs= Create glyphs by(*ebiten.Image).ReplacePixelsand put them into the cache if necessary
Constants
For system cursors, a new type CursorShapeType and these constants were added (#995):
CursorShapeDefaultCursorShapeTextCursorShapeCrosshairCursorShapePointer
These key constants were added (#1382, #1561):
KeyAltLeftKeyAltRightKeyControlLeftKeyControlRightKeyMetaKeyMetaLeftKeyMetaRightKeyShiftLeftKeyShiftRight
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
SubImagecan now callFill,DrawImageand so on as a receiver (#1255, #1461). With this, you can render an image with clipping. CursorModeCapturedbecame available on some of browsers (#1572).constbecame available in the shading language Kage (#1192).- A function
capwas added to Kage (#1361). - A function
imageDstOnTexturewas 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
SubImageas 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)
CursorPositioncould return an extremely small number (#1587).GamepadNameandGamepadSDLIDcould return wrong values on browsers (#1472).SetWindowIconcrashed when an*ebiten.Imagewas given (#1468).- In fullscreen, icons disappeared when calling
SetWindowIcon(#1587). NewInfiniteLoopandNewInfiniteLoopWithIntrodidn't work with a buffer whose size was not in multiples of 4 (#1503).- In the shading language Kage, functions
dfdx,dfdy,fwidthdidn'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
ReplacePixelsmight be slow in Metal (#1418, #1517). - Used
DrawImageinstead ofReplacePixelswhen extending an internal texture (#1022, #1414). - Used
DrawImageinstead ofReplacePixelswhen 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
inpututilis 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
ebitenmobilecommand didn't work with the environment variableEBITENMOBILE_GOMOBILE(#1667).ebitenmobiledidn't clean temporary directories up (#1668).- Too many calls of
SetWindowSizemight cause crash on Windows (#1672).
v2.1.3
Bug fix
(*ebiten.Image).Fillon a sub-image might have an unexpected result (#1691).- Memory leak on macOS (#1698).
v2.1.4
Bug fix
- Screenshots by
EBITEN_SCREENSHOT_KEYincluded 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
Shaderafter disposing aShadermight 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
MinimizeWindoworMaximizeWindowis called for a native fullscreen application on macOS (#1810).
Ebiten 2.1 リリースノート
v2.1.0
新機能
関数
次の関数が追加されました (#770、 #995、#1385、 #1561):
ebiten.CursorShape: 現在のカーソルの形を取得する。ebiten.SetCursorShape: 現在のカーソルの形を設定する。ebiten.SetWindowSizeLimits: ウィンドウの大きさ制限を設定する。ebiten.WindowSizeLimits: ウィンドウの大きさ制限を取得する。inpututil.PressedKeys: 現在押されているすべてのキーを取得する。
カーソルについては新しいサンプル examples/cursor を参照してください。
関数 (audio)
次の関数が追加されました (#1460):
mp3.DecodeWithSampleRate: MP3 を与えられたサンプルレートでデコードする。vorbis.DecodeWithSampleRate: Ogg/Vorbis を与えられたサンプルレートでデコードする。wav.DecodeWithSampleRate: WAV を与えられたサンプルレートでデコードする。
関数 (text)
text.CacheGlyphs が追加されました (#1413)。
与えられた文字列とフォントから、グリフの事前キャッシュを作ります。
キャッシュは text.Draw と共有されます。グリフは LRU 方式でキャッシュされます。キャッシュ容量には上限があるので、 CacheGlyphs で与えられた文字のグリフすべてがキャッシュされる保証はありません。
Draw は自動的にグリフを作成しキャッシュするので、通常 CacheGlyphs を明示的に呼ぶ必要はありません。しかし、例えば、大きなテキストの 1 文字ずつに対して Draw を呼ぶ場合、 Draw はグリフを作って描画を作るということを 1 文字ずつに対して行います。これはとても非効率的です。なぜならばグリフの画像を作るのとそれを描画するのは異なる操作で ((*ebiten.Image).ReplacePixels と (*ebiten.Image).DrawImage)、 1 つのドローコールとしてマージされないからです。 CacheGlyphs は必要なグリフを描画せずに作るので、文字列の大きさに関わりなく、高確率で操作がマージされて 1 つのドローコールになります。 2 つの関数は次のように実装されています:
Draw= 必要ならばグリフを(*ebiten.Image).ReplacePixelsで作り、それらをキャッシュする +(*ebiten.Image).DrawImageで描画先上に描画するCacheGlyphs= 必要ならばグリフを(*ebiten.Image).ReplacePixelsで作り、それらをキャッシュする
定数
システムカーソルのために、型 CursorShapeType 及び次の定数が追加されました (#995):
CursorShapeDefaultCursorShapeTextCursorShapeCrosshairCursorShapePointer
次のキー定数が追加されました (#1382、 #1561):
KeyAltLeftKeyAltRightKeyControlLeftKeyControlRightKeyMetaKeyMetaLeftKeyMetaRightKeyShiftLeftKeyShiftRight
キー定数の命名規則変更に伴い、次のキー定数が既存キーの置き換えとして追加されました (#1394)。置き換わり元のキー定数は互換性のために残しています:
KeyArrowDown(元:KeyDown)KeyArrowLeft(元:KeyLeft)KeyArrowRight(元:KeyRight)KeyArrowUp(元:KeyUp)KeyBackquote(元:KeyGraveAccent)KeyBracketLeft(元:KeyLeftBracket)KeyBracketRight(元:KeyRightBracket)KeyContextMenu(元:KeyMenu)KeyDigit0(元:Key0)KeyDigit1(元:Key1)KeyDigit2(元:Key2)KeyDigit3(元:Key3)KeyDigit4(元:Key4)KeyDigit5(元:Key5)KeyDigit6(元:Key6)KeyDigit7(元:Key7)KeyDigit8(元:Key8)KeyDigit9(元:Key9)KeyNumpad*(元:KeyKP*)KeyQuote(元:KeyApostrophe)
ビルドタグ
新しいビルドタグ ebitensinglethread が追加されました (#1367)。有効にすると、内部のスレッドが 1 つになり、パフォーマンスの向上が期待されます。副作用として、すべてのコンカレントセーフな Ebiten の関数が、コンカレントセーフでなくなります。
その他
- Go を C++ に変換するツールである、 go2cpp に対応しました (#744)。これにより、 Go が本来コンパイルできない環境でも Ebiten を動かす事ができるようになります。環境に合わせてバインディングの実装が必要です。詳細については、今後発表していく予定です。
- ウィンドウを拡大縮小しても、描画が止まらなくなりました (#1204)。
SubImageで作られた部分画像に対してFillやDrawImageなどが呼べるようになりました (#1255、 #1461)。これにより、クリッピングを使った描画ができるようになりました。CursorModeCapturedが一部ブラウザでも動くようになりました (#1572)。- シェーディング言語 Kage で
constが使えるようになりました (#1192)。 - シェーディング言語 Kage に
cap関数が追加されました (#1361)。 - シェーディング言語 Kage に
imageDstOnTexture関数が追加されました (#1428)。 - ブラウザにおけるオーディオを再実装しました (#1458)。オーディオバッファに余裕ができ、ノイズが減ることが期待されます。
後方互換性
- 「負のミップマップ」が廃止されました (#1400)。これにより、大きな拡大率で描画した場合、端の描画の結果が v2.0 と比べて変わることがあります。端を含めて確実に描画したい場合は、描画元画像に
SubImageを用いて、大きな画像の一部として描画してください。
バグ修正
このリリースには、 v2.0.x にあるすべてのバグ修正が含まれます。
- TPS の値が極端に小さい場合にうまく動かなかった問題の修正 (#1417)
- TPS の値が極端に大きい場合にうまく動かなかった問題の修正 (#1443、 #1444)
CursorPositionが極端に小さい値を返すことがあった問題を修正 (#1587)。GamepadNameおよびGamepadSDLIDがブラウザで間違った値を返す可能性があった問題の修正 (#1472)。SetWindowIconに*ebiten.Imageを与えるとクラッシュした問題の修正 (#1468)。- フルスクリーン時に
SetWindowIconを呼ぶとアイコンが消えてしまう問題の修正 (#1587)。 NewInfiniteLoopおよびNewInfiniteLoopWithIntroに 4 の倍数でない長さのバッファを与えたときにうまく動かなかった問題の修正 (#1503)。- シェーディング言語 Kage で
dfdx、dfdy、fwidth関数がブラウザで動かなかった問題の修正 (#1404)。 - シェーディング言語 Kage で同名の関数が重複してもエラーにならなかった問題の修正 (#1430)。
パフォーマンス改善
- スレッドのコンテキストスイッチの削減 (#1358)。
(*ColorM).Scaleの結果をキャッシュするように修正 (#1474)。- Metal において
ReplacePixelsが遅くなることがあった問題の改善 (#1418、 #1517)。 - 内部テクスチャアトラス拡大時に
ReplacePixelsではなくDrawImageを使用するように変更 (#1022、 #1414)。 - 独立内部テクスチャを内部テクスチャアトラス上に乗せるときに
ReplacePixelsではなくDrawImageを使用するように変更 (#1508)。 - JavaScript オブジェクト生成を削減 (#1426)。
- JavaScript 文字列生成を削減 (#1437、 #1438)。
- WebGL2 関数の使用 (#1435)
inpututilパッケージ使用時のオブジェクト生成を削減 (#1473)。
v2.1.1
バグ修正
- ブラウザで、画面のフォーカスが外れてもオーディオが止まらなかった問題の修正 (#1630)。
- ブラウザで、オーディオの長さが正確に内部バッファサイズの倍数だったときにクラッシュした問題の修正 (#1635)。
v2.1.2
バグ修正
ebitenmobileが環境変数EBITENMOBILE_GOMOBILEを指定したときにうまく動かなかった問題の修正 (#1667)。ebitenmobileが一時ディレクトリを削除しなかった問題の修正 (#1668)。- Windows で
SetWindowSizeを呼びすぎるとクラッシュすることがある問題の修正 (#1672)。
v2.1.3
バグ修正
v2.1.4
バグ修正
EBITEN_SCREENSHOT_KEYによるスクリーンショットが 1px のボーダーを含んでしまっていた問題の修正 (#1736)。- WebGL2 が動かないときの WebGL1 フォールバックが動かないことがあった問題の修正 (#1738)。
v2.1.5
バグ修正
- 一部のゲームパッドが使われていたときにクラッシュする問題の修正 (#1229)。
- 32bit Windows においてクラッシュする問題の修正 (#1750)。
Shaderを破棄したあとにShaderを作成したときに、予期しない描画結果になることがある問題の修正 (#1753)。- Windows でシェーダーが期待通りに動かないことがある問題の修正 (#1754)。
v2.1.6
バグ修正
- Windows でフルスクリーンになるときに Vsync モードが予期せずリセットされる問題の修正 (#1787)。
v2.1.7
バグ修正
- macOS のネイティブなフルスクリーン時に、
MinimizeWindowまたはMaximizeWindowを呼ぶとフリーズする問題の修正 (#1810)。