mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
parent
33e850a6d4
commit
7ad3343e9c
@ -124,6 +124,10 @@ func (s *screen) SetAsSource() {
|
||||
panic("monogame: SetAsSource on screen is forbidden")
|
||||
}
|
||||
|
||||
func (s *screen) Pixels(width, height int) ([]byte, error) {
|
||||
panic("monogame: Pixels on screen is forbidden")
|
||||
}
|
||||
|
||||
func (s *screen) ReplacePixels(args []*driver.ReplacePixelsArgs) {
|
||||
panic("monogame: ReplacePixels on screen is forbidden")
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
type RenderTarget2D interface {
|
||||
SetAsDestination(viewportWidth, viewportHeight int)
|
||||
SetAsSource()
|
||||
Pixels(width, height int) ([]byte, error)
|
||||
ReplacePixels(args []*driver.ReplacePixelsArgs)
|
||||
Dispose()
|
||||
IsScreen() bool
|
||||
@ -44,9 +45,8 @@ func (*Image) IsInvalidated() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (*Image) Pixels() ([]byte, error) {
|
||||
panic("monogame: Pixels is not implemented yet")
|
||||
return nil, nil
|
||||
func (i *Image) Pixels() ([]byte, error) {
|
||||
return i.v.Pixels(i.width, i.height)
|
||||
}
|
||||
|
||||
func (i *Image) SetAsDestination() {
|
||||
|
@ -126,7 +126,14 @@ type RenderTarget2D struct {
|
||||
|
||||
func (r *RenderTarget2D) Dispose() {
|
||||
runtime.SetFinalizer(r, nil)
|
||||
r.v.Call("Dispose")
|
||||
r.binding.Call("Dispose", r.v)
|
||||
}
|
||||
|
||||
func (r *RenderTarget2D) Pixels(width, height int) ([]byte, error) {
|
||||
v := r.binding.Call("Pixels", r.v, width, height)
|
||||
bs := make([]byte, v.Length())
|
||||
js.CopyBytesToGo(bs, v)
|
||||
return bs, nil
|
||||
}
|
||||
|
||||
func (r *RenderTarget2D) ReplacePixels(args []*driver.ReplacePixelsArgs) {
|
||||
|
Loading…
Reference in New Issue
Block a user