mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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 (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicscommand"
|
"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__
|
var _ = __EBITEN_REQUIRES_GO_VERSION_1_12_OR_LATER__
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
mipmap.SetGraphicsDriver(uiDriver().Graphics())
|
|
||||||
shareable.SetGraphicsDriver(uiDriver().Graphics())
|
|
||||||
graphicscommand.SetGraphicsDriver(uiDriver().Graphics())
|
graphicscommand.SetGraphicsDriver(uiDriver().Graphics())
|
||||||
}
|
}
|
||||||
|
@ -718,3 +718,8 @@ func (c *newShaderCommand) CanMergeWithDrawTrianglesCommand(dst *Image, src [gra
|
|||||||
func ResetGraphicsDriverState() error {
|
func ResetGraphicsDriverState() error {
|
||||||
return theGraphicsDriver.Reset()
|
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"
|
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||||
)
|
)
|
||||||
|
|
||||||
var graphicsDriver driver.Graphics
|
|
||||||
|
|
||||||
func SetGraphicsDriver(graphics driver.Graphics) {
|
|
||||||
graphicsDriver = graphics
|
|
||||||
}
|
|
||||||
|
|
||||||
func BeginFrame() error {
|
func BeginFrame() error {
|
||||||
return buffered.BeginFrame()
|
return buffered.BeginFrame()
|
||||||
}
|
}
|
||||||
|
@ -275,6 +275,11 @@ func InitializeGraphicsDriverState() error {
|
|||||||
return graphicscommand.ResetGraphicsDriverState()
|
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.
|
// OnContextLost is called when the context lost is detected in an explicit way.
|
||||||
func OnContextLost() {
|
func OnContextLost() {
|
||||||
if !canDetectContextLostExplicitly {
|
if !canDetectContextLostExplicitly {
|
||||||
|
@ -34,12 +34,6 @@ const (
|
|||||||
paddingSize = 1
|
paddingSize = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
var graphicsDriver driver.Graphics
|
|
||||||
|
|
||||||
func SetGraphicsDriver(graphics driver.Graphics) {
|
|
||||||
graphicsDriver = graphics
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
minSize = 0
|
minSize = 0
|
||||||
maxSize = 0
|
maxSize = 0
|
||||||
@ -673,7 +667,7 @@ func BeginFrame() error {
|
|||||||
panic("shareable: all the images must be not-shared before the game starts")
|
panic("shareable: all the images must be not-shared before the game starts")
|
||||||
}
|
}
|
||||||
minSize = 1024
|
minSize = 1024
|
||||||
maxSize = max(minSize, graphicsDriver.MaxImageSize())
|
maxSize = max(minSize, restorable.MaxImageSize())
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user