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