-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Allen Ray
committed
Sep 7, 2020
1 parent
81a64e6
commit 5a8fd29
Showing
6 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pixelui | ||
|
||
import "github.com/inkyblackness/imgui-go" | ||
|
||
// Image is a helper for imgui.Image that looks up the sprite in the internal packed atlas. | ||
func (ui *UI) Image(alias interface{}, scale float64) { | ||
id := ui.packer.IdOf(alias) | ||
sprite := ui.packer.BoundsOf(alias) | ||
imgui.Image(imgui.TextureID(id), IVec(sprite.Size().Scaled(scale))) | ||
} | ||
|
||
func (ui *UI) ImageButton(alias interface{}, scale float64) bool { | ||
id := ui.packer.IdOf(alias) | ||
sprite := ui.packer.BoundsOf(alias) | ||
|
||
return imgui.ImageButton(imgui.TextureID(id), IVec(sprite.Size().Scaled(scale))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters