mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: remove graphicsDrivre() calls from image.go
This commit is contained in:
parent
cd57bccbfc
commit
99437944bc
@ -16,7 +16,6 @@ package ui
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/affine"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/atlas"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphics"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/mipmap"
|
||||
@ -78,7 +77,7 @@ func (i *Image) At(x, y int) (r, g, b, a byte) {
|
||||
return 0, 0, 0, 0
|
||||
}
|
||||
|
||||
r, g, b, a, err := i.mipmap.At(graphicsDriver(), x, y)
|
||||
r, g, b, a, err := theUI.imageAt(i.mipmap, x, y)
|
||||
if err != nil {
|
||||
if panicOnErrorOnReadingPixels {
|
||||
panic(err)
|
||||
@ -90,7 +89,7 @@ func (i *Image) At(x, y int) (r, g, b, a byte) {
|
||||
}
|
||||
|
||||
func (i *Image) DumpScreenshot(name string, blackbg bool) error {
|
||||
return i.mipmap.DumpScreenshot(graphicsDriver(), name, blackbg)
|
||||
return theUI.dumpScreenshot(i.mipmap, name, blackbg)
|
||||
}
|
||||
|
||||
func (i *Image) SetIndependent(independent bool) {
|
||||
@ -102,5 +101,5 @@ func (i *Image) SetVolatile(volatile bool) {
|
||||
}
|
||||
|
||||
func DumpImages(dir string) error {
|
||||
return atlas.DumpImages(graphicsDriver(), dir)
|
||||
return theUI.dumpImages(dir)
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ package ui
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/atlas"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/mipmap"
|
||||
)
|
||||
|
||||
type MouseButton int
|
||||
@ -67,3 +70,15 @@ const (
|
||||
WindowResizingModeOnlyFullscreenEnabled
|
||||
WindowResizingModeEnabled
|
||||
)
|
||||
|
||||
func (u *UserInterface) imageAt(mipmap *mipmap.Mipmap, x, y int) (r, g, b, a byte, err error) {
|
||||
return mipmap.At(graphicsDriver(), x, y)
|
||||
}
|
||||
|
||||
func (u *UserInterface) dumpScreenshot(mipmap *mipmap.Mipmap, name string, blackbg bool) error {
|
||||
return mipmap.DumpScreenshot(graphicsDriver(), name, blackbg)
|
||||
}
|
||||
|
||||
func (u *UserInterface) dumpImages(dir string) error {
|
||||
return atlas.DumpImages(graphicsDriver(), dir)
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ type UserInterface struct {
|
||||
input Input
|
||||
}
|
||||
|
||||
var theUserInterface UserInterface
|
||||
var theUI UserInterface
|
||||
|
||||
func Get() *UserInterface {
|
||||
return &theUserInterface
|
||||
return &theUI
|
||||
}
|
||||
|
||||
func (u *UserInterface) Run(game Game) error {
|
||||
@ -116,7 +116,7 @@ func (*UserInterface) SetInitFocused(focused bool) {
|
||||
}
|
||||
|
||||
func (*UserInterface) Input() *Input {
|
||||
return &theUserInterface.input
|
||||
return &theUI.input
|
||||
}
|
||||
|
||||
func (*UserInterface) Window() *Window {
|
||||
|
Loading…
Reference in New Issue
Block a user