diff --git a/graphicscontext.go b/graphicscontext.go index 6e3cee465..27f27095a 100644 --- a/graphicscontext.go +++ b/graphicscontext.go @@ -19,7 +19,7 @@ import ( "math" "github.com/hajimehoshi/ebiten/internal/clock" - "github.com/hajimehoshi/ebiten/internal/drivers" + "github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/graphicsdriver" "github.com/hajimehoshi/ebiten/internal/hooks" "github.com/hajimehoshi/ebiten/internal/shareable" @@ -123,7 +123,7 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error { op := &DrawImageOptions{} - switch vd := drivers.Graphics().VDirection(); vd { + switch vd := driver.Graphics().VDirection(); vd { case graphicsdriver.VDownward: // c.screen is special: its Y axis is down to up, // and the origin point is lower left. diff --git a/internal/drivers/graphics_mac.go b/internal/driver/graphics_mac.go similarity index 99% rename from internal/drivers/graphics_mac.go rename to internal/driver/graphics_mac.go index b7f094733..48e978bca 100644 --- a/internal/drivers/graphics_mac.go +++ b/internal/driver/graphics_mac.go @@ -15,7 +15,7 @@ // +build darwin,!ios // +build !js -package drivers +package driver // #cgo CFLAGS: -x objective-c // #cgo LDFLAGS: -framework Foundation diff --git a/internal/drivers/graphics_notmac.go b/internal/driver/graphics_notmac.go similarity index 98% rename from internal/drivers/graphics_notmac.go rename to internal/driver/graphics_notmac.go index f1c4b7ba2..7f621ef1f 100644 --- a/internal/drivers/graphics_notmac.go +++ b/internal/driver/graphics_notmac.go @@ -14,7 +14,7 @@ // +build !darwin ios js -package drivers +package driver import ( "github.com/hajimehoshi/ebiten/internal/graphicsdriver" diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index c67afc608..c49d9398a 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/hajimehoshi/ebiten/internal/affine" - "github.com/hajimehoshi/ebiten/internal/drivers" + "github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/graphics" ) @@ -167,7 +167,7 @@ func (q *commandQueue) Flush() { nc++ } if 0 < ne { - drivers.Graphics().SetVertices(vs[:nv], es[:ne]) + driver.Graphics().SetVertices(vs[:nv], es[:ne]) es = es[ne:] vs = vs[nv:] } @@ -187,7 +187,7 @@ func (q *commandQueue) Flush() { } if 0 < nc { // Call glFlush to prevent black flicking (especially on Android (#226) and iOS). - drivers.Graphics().Flush() + driver.Graphics().Flush() } q.commands = q.commands[nc:] } @@ -233,7 +233,7 @@ func (c *drawImageCommand) Exec(indexOffset int) error { c.dst.image.SetAsDestination() c.src.image.SetAsSource() - if err := drivers.Graphics().Draw(c.nindices, indexOffset, c.mode, c.color, c.filter, c.address); err != nil { + if err := driver.Graphics().Draw(c.nindices, indexOffset, c.mode, c.color, c.filter, c.address); err != nil { return err } return nil @@ -439,7 +439,7 @@ func (c *newImageCommand) String() string { // Exec executes a newImageCommand. func (c *newImageCommand) Exec(indexOffset int) error { - i, err := drivers.Graphics().NewImage(c.width, c.height) + i, err := driver.Graphics().NewImage(c.width, c.height) if err != nil { return err } @@ -479,7 +479,7 @@ func (c *newScreenFramebufferImageCommand) String() string { // Exec executes a newScreenFramebufferImageCommand. func (c *newScreenFramebufferImageCommand) Exec(indexOffset int) error { var err error - c.result.image, err = drivers.Graphics().NewScreenFramebufferImage(c.width, c.height) + c.result.image, err = driver.Graphics().NewScreenFramebufferImage(c.width, c.height) return err } @@ -503,5 +503,5 @@ func (c *newScreenFramebufferImageCommand) CanMerge(dst, src *Image, color *affi // ResetGraphicsDriverState resets or initializes the current graphics driver state. func ResetGraphicsDriverState() error { - return drivers.Graphics().Reset() + return driver.Graphics().Reset() } diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 39ca531e6..b9cccc012 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -27,7 +27,7 @@ import ( "time" "github.com/hajimehoshi/ebiten/internal/devicescale" - "github.com/hajimehoshi/ebiten/internal/drivers" + "github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/glfw" "github.com/hajimehoshi/ebiten/internal/hooks" "github.com/hajimehoshi/ebiten/internal/input" @@ -99,7 +99,7 @@ func initialize() error { if err := glfw.Init(); err != nil { return err } - if !drivers.Graphics().IsGL() { + if !driver.Graphics().IsGL() { glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI) } glfw.WindowHint(glfw.Visible, glfw.False) @@ -604,7 +604,7 @@ func Run(width, height int, scale float64, title string, g GraphicsContext, main } u.window = window - if drivers.Graphics().IsGL() { + if driver.Graphics().IsGL() { u.window.MakeContextCurrent() } @@ -679,7 +679,7 @@ func Run(width, height int, scale float64, title string, g GraphicsContext, main w = u.nativeWindow() return nil }) - drivers.Graphics().SetWindow(w) + driver.Graphics().SetWindow(w) return u.loop(g) } @@ -834,7 +834,7 @@ func (u *userInterface) loop(g GraphicsContext) error { // swapBuffers must be called from the main thread. func (u *userInterface) swapBuffers() { - if drivers.Graphics().IsGL() { + if driver.Graphics().IsGL() { u.window.SwapBuffers() } } @@ -932,7 +932,7 @@ func (u *userInterface) forceSetScreenSize(width, height int, scale float64, ful u.window.SetTitle(u.title) } - if drivers.Graphics().IsGL() { + if driver.Graphics().IsGL() { // SwapInterval is affected by the current monitor of the window. // This needs to be called at least after SetMonitor. // Without SwapInterval after SetMonitor, vsynch doesn't work (#375). @@ -946,7 +946,7 @@ func (u *userInterface) forceSetScreenSize(width, height int, scale float64, ful glfw.SwapInterval(0) } } - drivers.Graphics().SetVsyncEnabled(vsync) + driver.Graphics().SetVsyncEnabled(vsync) u.toChangeSize = true }