mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
parent
de8707f6a1
commit
de02bcf19f
@ -129,3 +129,7 @@ func (s *screen) ReplacePixels(args []*driver.ReplacePixelsArgs) {
|
||||
func (s *screen) Dispose() {
|
||||
// Do nothing?
|
||||
}
|
||||
|
||||
func (s *screen) IsScreen() bool {
|
||||
return true
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ type RenderTarget2D interface {
|
||||
SetAsSource()
|
||||
ReplacePixels(args []*driver.ReplacePixelsArgs)
|
||||
Dispose()
|
||||
IsScreen() bool
|
||||
}
|
||||
|
||||
type Image struct {
|
||||
@ -49,7 +50,10 @@ func (*Image) Pixels() ([]byte, error) {
|
||||
}
|
||||
|
||||
func (i *Image) SetAsDestination() {
|
||||
w, h := graphics.InternalImageSize(i.width), graphics.InternalImageSize(i.height)
|
||||
w, h := i.width, i.height
|
||||
if !i.v.IsScreen() {
|
||||
w, h = graphics.InternalImageSize(w), graphics.InternalImageSize(h)
|
||||
}
|
||||
i.v.SetAsDestination(w, h)
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ func (g *Game) SetVertices(vertices []float32, indices []uint16) {
|
||||
}
|
||||
|
||||
func (g *Game) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, colorM *affine.ColorM, filter driver.Filter, address driver.Address) {
|
||||
// TODO: Implement this
|
||||
g.binding.Call("Draw", indexLen, indexOffset)
|
||||
src, dst := mode.Operations()
|
||||
g.binding.Call("Draw", indexLen, indexOffset, int(src), int(dst))
|
||||
}
|
||||
|
||||
func (g *Game) ResetDestination(viewportWidth, viewportHeight int) {
|
||||
@ -139,3 +139,7 @@ func (r *RenderTarget2D) SetAsDestination(viewportWidth, viewportHeight int) {
|
||||
func (r *RenderTarget2D) SetAsSource() {
|
||||
r.binding.Call("SetSource", r.v)
|
||||
}
|
||||
|
||||
func (r *RenderTarget2D) IsScreen() bool {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user