mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
driver: Use framebuffer's Y directions
This commit is contained in:
parent
c43ba6e17d
commit
8029dc352a
@ -32,7 +32,7 @@ type Graphics interface {
|
|||||||
Reset() error
|
Reset() error
|
||||||
Draw(indexLen int, indexOffset int, mode CompositeMode, colorM *affine.ColorM, filter Filter, address Address) error
|
Draw(indexLen int, indexOffset int, mode CompositeMode, colorM *affine.ColorM, filter Filter, address Address) error
|
||||||
SetVsyncEnabled(enabled bool)
|
SetVsyncEnabled(enabled bool)
|
||||||
VDirection() VDirection
|
FramebufferYDirection() YDirection
|
||||||
NeedsRestoring() bool
|
NeedsRestoring() bool
|
||||||
IsGL() bool
|
IsGL() bool
|
||||||
HasHighPrecisionFloat() bool
|
HasHighPrecisionFloat() bool
|
||||||
@ -59,9 +59,9 @@ type ReplacePixelsArgs struct {
|
|||||||
Height int
|
Height int
|
||||||
}
|
}
|
||||||
|
|
||||||
type VDirection int
|
type YDirection int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VUpward VDirection = iota
|
Upward YDirection = iota
|
||||||
VDownward
|
Downward
|
||||||
)
|
)
|
||||||
|
@ -684,8 +684,8 @@ func (g *Graphics) SetVsyncEnabled(enabled bool) {
|
|||||||
g.view.setDisplaySyncEnabled(enabled)
|
g.view.setDisplaySyncEnabled(enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) VDirection() driver.VDirection {
|
func (g *Graphics) FramebufferYDirection() driver.YDirection {
|
||||||
return driver.VUpward
|
return driver.Downward
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) NeedsRestoring() bool {
|
func (g *Graphics) NeedsRestoring() bool {
|
||||||
|
@ -91,8 +91,8 @@ func (g *Graphics) SetVsyncEnabled(enabled bool) {
|
|||||||
panic("monogame: SetVsyncEnabled is not implemented yet")
|
panic("monogame: SetVsyncEnabled is not implemented yet")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) VDirection() driver.VDirection {
|
func (g *Graphics) FramebufferYDirection() driver.YDirection {
|
||||||
return driver.VUpward
|
return driver.Downward
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) NeedsRestoring() bool {
|
func (g *Graphics) NeedsRestoring() bool {
|
||||||
|
@ -129,8 +129,8 @@ func (g *Graphics) SetVsyncEnabled(enabled bool) {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) VDirection() driver.VDirection {
|
func (g *Graphics) FramebufferYDirection() driver.YDirection {
|
||||||
return driver.VDownward
|
return driver.Upward
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) NeedsRestoring() bool {
|
func (g *Graphics) NeedsRestoring() bool {
|
||||||
|
@ -307,14 +307,14 @@ func (c *uiContext) draw() {
|
|||||||
op := &DrawImageOptions{}
|
op := &DrawImageOptions{}
|
||||||
|
|
||||||
s := c.screenScale()
|
s := c.screenScale()
|
||||||
switch vd := uiDriver().Graphics().VDirection(); vd {
|
switch vd := uiDriver().Graphics().FramebufferYDirection(); vd {
|
||||||
case driver.VDownward:
|
case driver.Upward:
|
||||||
// c.screen is special: its Y axis is down to up,
|
// c.screen is special: its Y axis is down to up,
|
||||||
// and the origin point is lower left.
|
// and the origin point is lower left.
|
||||||
op.GeoM.Scale(s, -s)
|
op.GeoM.Scale(s, -s)
|
||||||
_, h := c.offscreen.Size()
|
_, h := c.offscreen.Size()
|
||||||
op.GeoM.Translate(0, float64(h)*s)
|
op.GeoM.Translate(0, float64(h)*s)
|
||||||
case driver.VUpward:
|
case driver.Downward:
|
||||||
op.GeoM.Scale(s, s)
|
op.GeoM.Scale(s, s)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("ebiten: invalid v-direction: %d", vd))
|
panic(fmt.Sprintf("ebiten: invalid v-direction: %d", vd))
|
||||||
|
Loading…
Reference in New Issue
Block a user