diff --git a/ReflectiveBoundTexture.go b/ReflectiveBoundTexture.go index 4bc90273..f4ee5ff1 100644 --- a/ReflectiveBoundTexture.go +++ b/ReflectiveBoundTexture.go @@ -54,6 +54,11 @@ func (i *ReflectiveBoundTexture) commit() (*ReflectiveBoundTexture, bool) { return i, has_changed } +func (i *ReflectiveBoundTexture) SetSurfaceFn(fn func() *image.RGBA, commit bool) error { + img := fn() + return i.SetSurfaceFromRGBA(img, commit) +} + func (i *ReflectiveBoundTexture) SetSurfaceFromFillRect(width int, height int, c color.Color, commit bool) error { img := newImage(width, height, c) return i.SetSurfaceFromRGBA(img, commit) @@ -98,6 +103,22 @@ func (i *ReflectiveBoundTexture) GetImGuiImageVDefaultOptionsStruct() ImguiImage Border_col: imgui.Vec4{0, 0, 0, 0}, } } +func (i *ReflectiveBoundTexture) ImguiImage(width float32, height float32, options ImguiImageVOptionStruct) { + size := imgui.Vec2{X: width, Y: height} + + if size.X == -1 { + rect := imgui.ContentRegionAvail() + size.X = rect.X + } + + if size.Y == -1 { + rect := imgui.ContentRegionAvail() + size.Y = rect.Y + } + + imgui.Image(i.Texture().ID(), size) +} + func (i *ReflectiveBoundTexture) ImguiImageV(width float32, height float32, options ImguiImageVOptionStruct) { size := imgui.Vec2{X: width, Y: height}