ebitenbackend

package
v0.0.0-...-e7caca3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package ebitenbackend implements the render package's backend interfaces (Canvas, FontFace, Image and Driver) on top of EBiten. It is the only package in the framework that imports EBiten; everything above it depends solely on the render and geom packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFont

func DefaultFont(size float64) render.FontFace

DefaultFont returns the bundled Go font at the given size as a render.FontFace. It panics only if the embedded font asset fails to parse, which would be a build-time corruption rather than a runtime condition.

func LoadImageBytes

func LoadImageBytes(data []byte) (render.Image, error)

LoadImageBytes decodes PNG/JPEG/GIF data into a render.Image.

func New

func New() render.Driver

New returns an EBiten-backed render.Driver.

func NewFontFace

func NewFontFace(ttf []byte, size float64) (render.FontFace, error)

NewFontFace parses a TrueType/OpenType font from ttf and returns a render.FontFace at the given size.

func NewImage

func NewImage(img *ebiten.Image) render.Image

NewImage wraps an existing *ebiten.Image as a render.Image.

func NewRenderTarget

func NewRenderTarget(width, height int) render.RenderTarget

NewRenderTarget allocates an offscreen drawable surface of the given pixel size. It returns nil for non-positive dimensions.

Types

type Driver

type Driver struct{}

Driver implements render.Driver on top of EBiten. Construct one with New and hand it to the framework's App; the framework never touches EBiten directly.

func (*Driver) Run

func (d *Driver) Run(cfg render.Config, hooks render.Hooks) error

Run configures the host window and runs the EBiten game loop, invoking the framework's hooks each frame. It blocks until the window closes or a hook returns an error.

func (*Driver) SetCloseHandled

func (d *Driver) SetCloseHandled(handled bool)

SetCloseHandled satisfies render.CloseInterceptor. With it on, EBiten stops closing the window itself and reports the request through IsWindowBeingClosed, which Update turns into the framework's CloseRequested hook. EBiten accepts this before RunGame as well as during the loop, and it is a no-op off the desktop.

func (*Driver) SetIMEEnabled

func (d *Driver) SetIMEEnabled(on bool)

SetIMEEnabled and SetIMERect satisfy render.IMEController. EBiten (v2.9.9) exposes no API to toggle the IME or position the candidate window, and does not surface preedit text, so these are no-ops today: only committed IME text flows (via AppendInputChars in pollInput). The methods exist so the framework can light up IME support once a backend provides it, without API churn above.

func (*Driver) SetIMERect

func (d *Driver) SetIMERect(r geom.Rect)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL