mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
mipmap, shareable: Refactoring: Remove SetGraphicsDriver
This commit is contained in:
parent
4c42a26464
commit
b2d618c2be
4
init.go
4
init.go
@ -16,14 +16,10 @@ package ebiten
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicscommand"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/mipmap"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shareable"
|
||||
)
|
||||
|
||||
var _ = __EBITEN_REQUIRES_GO_VERSION_1_12_OR_LATER__
|
||||
|
||||
func init() {
|
||||
mipmap.SetGraphicsDriver(uiDriver().Graphics())
|
||||
shareable.SetGraphicsDriver(uiDriver().Graphics())
|
||||
graphicscommand.SetGraphicsDriver(uiDriver().Graphics())
|
||||
}
|
||||
|
@ -718,3 +718,8 @@ func (c *newShaderCommand) CanMergeWithDrawTrianglesCommand(dst *Image, src [gra
|
||||
func ResetGraphicsDriverState() error {
|
||||
return theGraphicsDriver.Reset()
|
||||
}
|
||||
|
||||
// MaxImageSize returns the maximum size of an image.
|
||||
func MaxImageSize() int {
|
||||
return theGraphicsDriver.MaxImageSize()
|
||||
}
|
||||
|
@ -26,12 +26,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||
)
|
||||
|
||||
var graphicsDriver driver.Graphics
|
||||
|
||||
func SetGraphicsDriver(graphics driver.Graphics) {
|
||||
graphicsDriver = graphics
|
||||
}
|
||||
|
||||
func BeginFrame() error {
|
||||
return buffered.BeginFrame()
|
||||
}
|
||||
|
@ -275,6 +275,11 @@ func InitializeGraphicsDriverState() error {
|
||||
return graphicscommand.ResetGraphicsDriverState()
|
||||
}
|
||||
|
||||
// MaxImageSize returns the maximum size of an image.
|
||||
func MaxImageSize() int {
|
||||
return graphicscommand.MaxImageSize()
|
||||
}
|
||||
|
||||
// OnContextLost is called when the context lost is detected in an explicit way.
|
||||
func OnContextLost() {
|
||||
if !canDetectContextLostExplicitly {
|
||||
|
@ -34,12 +34,6 @@ const (
|
||||
paddingSize = 1
|
||||
)
|
||||
|
||||
var graphicsDriver driver.Graphics
|
||||
|
||||
func SetGraphicsDriver(graphics driver.Graphics) {
|
||||
graphicsDriver = graphics
|
||||
}
|
||||
|
||||
var (
|
||||
minSize = 0
|
||||
maxSize = 0
|
||||
@ -673,7 +667,7 @@ func BeginFrame() error {
|
||||
panic("shareable: all the images must be not-shared before the game starts")
|
||||
}
|
||||
minSize = 1024
|
||||
maxSize = max(minSize, graphicsDriver.MaxImageSize())
|
||||
maxSize = max(minSize, restorable.MaxImageSize())
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user