diff --git a/internal/graphicsdriver/monogame/graphics.go b/internal/graphicsdriver/monogame/graphics.go index d8965aa20..f5f4c5fb2 100644 --- a/internal/graphicsdriver/monogame/graphics.go +++ b/internal/graphicsdriver/monogame/graphics.go @@ -114,8 +114,8 @@ type screen struct { game *monogame.Game } -func (s *screen) SetAsDestination() { - s.game.ResetDestination() +func (s *screen) SetAsDestination(viewportWidth, viewportHeight int) { + s.game.ResetDestination(viewportWidth, viewportHeight) } func (s *screen) SetAsSource() { diff --git a/internal/graphicsdriver/monogame/image.go b/internal/graphicsdriver/monogame/image.go index 32aac530a..ef6c96328 100644 --- a/internal/graphicsdriver/monogame/image.go +++ b/internal/graphicsdriver/monogame/image.go @@ -21,7 +21,7 @@ import ( ) type RenderTarget2D interface { - SetAsDestination() + SetAsDestination(viewportWidth, viewportHeight int) SetAsSource() ReplacePixels(args []*driver.ReplacePixelsArgs) Dispose() @@ -48,7 +48,7 @@ func (*Image) Pixels() ([]byte, error) { } func (i *Image) SetAsDestination() { - i.v.SetAsDestination() + i.v.SetAsDestination(i.width, i.height) } func (i *Image) SetAsSource() { diff --git a/internal/monogame/monogame.go b/internal/monogame/monogame.go index f798c495f..b88d99ffd 100644 --- a/internal/monogame/monogame.go +++ b/internal/monogame/monogame.go @@ -110,8 +110,8 @@ func (g *Game) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, co g.binding.Call("Draw", indexLen, indexOffset) } -func (g *Game) ResetDestination() { - g.binding.Set("Dst", nil) +func (g *Game) ResetDestination(viewportWidth, viewportHeight int) { + g.binding.Call("SetDestination", nil, viewportWidth, viewportHeight) } type RenderTarget2D struct { @@ -132,10 +132,10 @@ func (r *RenderTarget2D) ReplacePixels(args []*driver.ReplacePixelsArgs) { } } -func (r *RenderTarget2D) SetAsDestination() { - r.binding.Set("Dst", r.v) +func (r *RenderTarget2D) SetAsDestination(viewportWidth, viewportHeight int) { + r.binding.Call("SetDestination", r.v, viewportWidth, viewportHeight) } func (r *RenderTarget2D) SetAsSource() { - r.binding.Set("Src", r.v) + r.binding.Call("SetSource", r.v) }