Documentation ¶
Index ¶
- Variables
- func AfterCreateContext() unsafe.Pointer
- func AfterRender() unsafe.Pointer
- func BeforeDestroyContext() unsafe.Pointer
- func BeforeRender() unsafe.Pointer
- func ImageToRgba(img image.Image) *image.RGBA
- func LoadImage(imgPath string) (*image.RGBA, error)
- func LoopCallback() unsafe.Pointer
- type Backend
- type DropCallback
- type KeyCallback
- type SizeChangeCallback
- type Texture
- type TextureManager
- type WindowCloseCallback
Constants ¶
This section is empty.
Variables ¶
View Source
var CExposerError error = errors.New("CreateBackend was unable to extract C API Exposer from your backend. This is an error if you want to use C-related backend.")
Functions ¶
func AfterCreateContext ¶
func AfterRender ¶
func BeforeDestroyContext ¶
func BeforeRender ¶
func ImageToRgba ¶
ImageToRgba converts image.Image to *image.RGBA.
func LoopCallback ¶
Types ¶
type Backend ¶
type Backend[BackendFlagsT ~int] interface { SetAfterCreateContextHook(func()) SetBeforeDestroyContextHook(func()) SetBeforeRenderHook(func()) SetAfterRenderHook(func()) SetBgColor(color imgui.Vec4) Run(func()) Refresh() SetWindowPos(x, y int) GetWindowPos() (x, y int32) SetWindowSize(width, height int) SetWindowSizeLimits(minWidth, minHeight, maxWidth, maxHeight int) SetWindowTitle(title string) DisplaySize() (width, height int32) SetShouldClose(bool) ContentScale() (xScale, yScale float32) SetTargetFPS(fps uint) SetDropCallback(DropCallback) SetCloseCallback(WindowCloseCallback[BackendFlagsT]) SetKeyCallback(KeyCallback) SetSizeChangeCallback(SizeChangeCallback) // SetWindowFlags selected hint to specified value. // ATTENTION: This method is able to set only one flag per call. SetWindowFlags(flag BackendFlagsT, value int) SetIcons(icons ...image.Image) SetSwapInterval(interval BackendFlagsT) error SetCursorPos(x, y float64) SetInputMode(mode BackendFlagsT, value BackendFlagsT) CreateWindow(title string, width, height int) TextureManager }
Backend is a special interface that implements all methods required to render imgui application.
func CreateBackend ¶
func CreateBackend[BackendFlagsT ~int](backend Backend[BackendFlagsT]) (sameBackend Backend[BackendFlagsT], err error)
CreateBackend should to be called before using any cimgui methods. This enables the following features:
- C-related callbacks: if your backend implements C functions, this will export some methods from your backend to C.
- Advanced Texture Loading stuff. GL texture loading is a little complex. texture.go has some high-level logic.
Error:
- Error could be CExposerError when your backend does not support C. THIS MAY STILL WORK CORRECTLY. Specificly, this may happen if you use some backend that is not part of cimgui-go. In such a case just ignore the error.
type DropCallback ¶
type DropCallback func([]string)
type KeyCallback ¶
type KeyCallback func(key, scanCode, action, mods int)
type SizeChangeCallback ¶
type SizeChangeCallback func(w, h int)
type Texture ¶
Texture implements a simple texture loader. It wraps backend's methods to allow creating textures easily. IMPORTANT: as the texture is mainly handled by C OpenGL, it is not covered by Garbae Collector (GC).
Remember to call (*Texture).Release when you no longer need it.
func NewTextureFromRgba ¶
type TextureManager ¶
type TextureManager interface { CreateTexture(pixels unsafe.Pointer, width, Height int) imgui.TextureID CreateTextureRgba(img *image.RGBA, width, height int) imgui.TextureID DeleteTexture(id imgui.TextureID) }
TextureManager is a part of Backend.
Why I separate it? Current impl of local texture.go needs to store this somewhere, and I don't want to make Texture relate on BackendFlagsT.
type WindowCloseCallback ¶
Directories ¶
Path | Synopsis |
---|---|
Package ebitenbackend contains a renderer of ImGui for Ebitengine along with cimgui.Backend implementation.
|
Package ebitenbackend contains a renderer of ImGui for Ebitengine along with cimgui.Backend implementation. |
Click to show internal directories.
Click to hide internal directories.