mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-09-20 05:12:18 +02: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")
|
e.Call("preventDefault")
|
||||||
}
|
}
|
||||||
if !e.Get("isComposing").Bool() {
|
if !e.Get("isComposing").Bool() {
|
||||||
ui.UpdateInputFromEvent(e)
|
ui.Get().UpdateInputFromEvent(e)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
t.textareaElement.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) any {
|
t.textareaElement.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
if !e.Get("isComposing").Bool() {
|
if !e.Get("isComposing").Bool() {
|
||||||
ui.UpdateInputFromEvent(e)
|
ui.Get().UpdateInputFromEvent(e)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
@ -223,8 +223,8 @@ func (u *UserInterface) KeyName(key Key) string {
|
|||||||
return n.String()
|
return n.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateInputFromEvent(e js.Value) {
|
func (u *UserInterface) UpdateInputFromEvent(e js.Value) {
|
||||||
theUI.updateInputFromEvent(e)
|
u.updateInputFromEvent(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) saveCursorPosition() {
|
func (u *UserInterface) saveCursorPosition() {
|
||||||
|
@ -65,12 +65,12 @@ func (g *graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error)
|
|||||||
return metal.NewGraphics()
|
return metal.NewGraphics()
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetUIView(uiview uintptr) error {
|
func (u *UserInterface) SetUIView(uiview uintptr) error {
|
||||||
return theUI.setUIView(uiview)
|
return u.setUIView(uiview)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsGL() (bool, error) {
|
func (u *UserInterface) IsGL() (bool, error) {
|
||||||
return theUI.isGL()
|
return u.isGL()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) setUIView(uiview uintptr) error {
|
func (u *UserInterface) setUIView(uiview uintptr) error {
|
||||||
|
@ -19,9 +19,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SetUIView(uiview int64) error {
|
func SetUIView(uiview int64) error {
|
||||||
return ui.SetUIView(uintptr(uiview))
|
return ui.Get().SetUIView(uintptr(uiview))
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsGL() (bool, error) {
|
func IsGL() (bool, error) {
|
||||||
return ui.IsGL()
|
return ui.Get().IsGL()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user