Skip to content

Commit

Permalink
setsurfacesn
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbrigato committed Sep 24, 2024
1 parent 223aa46 commit 0383f0d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ReflectiveBoundTexture.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check failure on line 62 in ReflectiveBoundTexture.go

View workflow job for this annotation

GitHub Actions / Lint

paramTypeCombine: func(width int, height int, c color.Color, commit bool) error could be replaced with func(width, height int, c color.Color, commit bool) error (gocritic)
img := newImage(width, height, c)
return i.SetSurfaceFromRGBA(img, commit)
Expand Down Expand Up @@ -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) {

Check failure on line 106 in ReflectiveBoundTexture.go

View workflow job for this annotation

GitHub Actions / Lint

paramTypeCombine: func(width float32, height float32, options ImguiImageVOptionStruct) could be replaced with func(width, height float32, options ImguiImageVOptionStruct) (gocritic)
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) {

Check failure on line 122 in ReflectiveBoundTexture.go

View workflow job for this annotation

GitHub Actions / Lint

paramTypeCombine: func(width float32, height float32, options ImguiImageVOptionStruct) could be replaced with func(width, height float32, options ImguiImageVOptionStruct) (gocritic)

size := imgui.Vec2{X: width, Y: height}
Expand Down

0 comments on commit 0383f0d

Please sign in to comment.