mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/ui: refactoring: reduce theUI
This commit is contained in:
parent
83a4133577
commit
0378230b3e
@ -78,14 +78,14 @@ func (t *textInput) init() {
|
||||
e.Call("preventDefault")
|
||||
}
|
||||
if !e.Get("isComposing").Bool() {
|
||||
ui.UpdateInputFromEvent(e)
|
||||
ui.Get().UpdateInputFromEvent(e)
|
||||
}
|
||||
return nil
|
||||
}))
|
||||
t.textareaElement.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||
e := args[0]
|
||||
if !e.Get("isComposing").Bool() {
|
||||
ui.UpdateInputFromEvent(e)
|
||||
ui.Get().UpdateInputFromEvent(e)
|
||||
}
|
||||
return nil
|
||||
}))
|
||||
|
@ -223,8 +223,8 @@ func (u *UserInterface) KeyName(key Key) string {
|
||||
return n.String()
|
||||
}
|
||||
|
||||
func UpdateInputFromEvent(e js.Value) {
|
||||
theUI.updateInputFromEvent(e)
|
||||
func (u *UserInterface) UpdateInputFromEvent(e js.Value) {
|
||||
u.updateInputFromEvent(e)
|
||||
}
|
||||
|
||||
func (u *UserInterface) saveCursorPosition() {
|
||||
|
@ -65,12 +65,12 @@ func (g *graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error)
|
||||
return metal.NewGraphics()
|
||||
}
|
||||
|
||||
func SetUIView(uiview uintptr) error {
|
||||
return theUI.setUIView(uiview)
|
||||
func (u *UserInterface) SetUIView(uiview uintptr) error {
|
||||
return u.setUIView(uiview)
|
||||
}
|
||||
|
||||
func IsGL() (bool, error) {
|
||||
return theUI.isGL()
|
||||
func (u *UserInterface) IsGL() (bool, error) {
|
||||
return u.isGL()
|
||||
}
|
||||
|
||||
func (u *UserInterface) setUIView(uiview uintptr) error {
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
)
|
||||
|
||||
func SetUIView(uiview int64) error {
|
||||
return ui.SetUIView(uintptr(uiview))
|
||||
return ui.Get().SetUIView(uintptr(uiview))
|
||||
}
|
||||
|
||||
func IsGL() (bool, error) {
|
||||
return ui.IsGL()
|
||||
return ui.Get().IsGL()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user