mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Rename files
This commit is contained in:
parent
df836df45e
commit
10104b95b4
@ -24,7 +24,7 @@ type UI struct {
|
|||||||
initialEventSent bool
|
initialEventSent bool
|
||||||
textureFactory *textureFactory
|
textureFactory *textureFactory
|
||||||
graphicsDevice *opengl.Device
|
graphicsDevice *opengl.Device
|
||||||
uiEvents
|
windowEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentUI *UI
|
var currentUI *UI
|
||||||
@ -69,7 +69,7 @@ func (u *UI) PollEvents() {
|
|||||||
C.PollEvents()
|
C.PollEvents()
|
||||||
if !u.initialEventSent {
|
if !u.initialEventSent {
|
||||||
e := ui.ScreenSizeUpdatedEvent{u.screenWidth, u.screenHeight}
|
e := ui.ScreenSizeUpdatedEvent{u.screenWidth, u.screenHeight}
|
||||||
u.uiEvents.notifyScreenSizeUpdated(e)
|
u.windowEvents.notifyScreenSizeUpdated(e)
|
||||||
u.initialEventSent = true
|
u.initialEventSent = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ func (u *UI) Draw(f func(graphics.Canvas)) {
|
|||||||
func ebiten_ScreenSizeUpdated(width, height int) {
|
func ebiten_ScreenSizeUpdated(width, height int) {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
e := ui.ScreenSizeUpdatedEvent{width, height}
|
e := ui.ScreenSizeUpdatedEvent{width, height}
|
||||||
u.uiEvents.notifyScreenSizeUpdated(e)
|
u.windowEvents.notifyScreenSizeUpdated(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
//export ebiten_InputUpdated
|
//export ebiten_InputUpdated
|
||||||
@ -131,7 +131,7 @@ func ebiten_InputUpdated(inputType C.InputType, cx, cy C.int) {
|
|||||||
|
|
||||||
if inputType == C.InputTypeMouseUp {
|
if inputType == C.InputTypeMouseUp {
|
||||||
e := ui.InputStateUpdatedEvent{-1, -1}
|
e := ui.InputStateUpdatedEvent{-1, -1}
|
||||||
u.uiEvents.notifyInputStateUpdated(e)
|
u.windowEvents.notifyInputStateUpdated(e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,5 +149,5 @@ func ebiten_InputUpdated(inputType C.InputType, cx, cy C.int) {
|
|||||||
y = u.screenHeight - 1
|
y = u.screenHeight - 1
|
||||||
}
|
}
|
||||||
e := ui.InputStateUpdatedEvent{x, y}
|
e := ui.InputStateUpdatedEvent{x, y}
|
||||||
u.uiEvents.notifyInputStateUpdated(e)
|
u.windowEvents.notifyInputStateUpdated(e)
|
||||||
}
|
}
|
@ -1,44 +0,0 @@
|
|||||||
package cocoa
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hajimehoshi/go-ebiten/ui"
|
|
||||||
)
|
|
||||||
|
|
||||||
type uiEvents struct {
|
|
||||||
screenSizeUpdated chan ui.ScreenSizeUpdatedEvent // initialized lazily
|
|
||||||
inputStateUpdated chan ui.InputStateUpdatedEvent // initialized lazily
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *uiEvents) ScreenSizeUpdated() <-chan ui.ScreenSizeUpdatedEvent {
|
|
||||||
if u.screenSizeUpdated != nil {
|
|
||||||
return u.screenSizeUpdated
|
|
||||||
}
|
|
||||||
u.screenSizeUpdated = make(chan ui.ScreenSizeUpdatedEvent)
|
|
||||||
return u.screenSizeUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *uiEvents) notifyScreenSizeUpdated(e ui.ScreenSizeUpdatedEvent) {
|
|
||||||
if u.screenSizeUpdated == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
go func() {
|
|
||||||
u.screenSizeUpdated <- e
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *uiEvents) InputStateUpdated() <-chan ui.InputStateUpdatedEvent {
|
|
||||||
if u.inputStateUpdated != nil {
|
|
||||||
return u.inputStateUpdated
|
|
||||||
}
|
|
||||||
u.inputStateUpdated = make(chan ui.InputStateUpdatedEvent)
|
|
||||||
return u.inputStateUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *uiEvents) notifyInputStateUpdated(e ui.InputStateUpdatedEvent) {
|
|
||||||
if u.inputStateUpdated == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
go func() {
|
|
||||||
u.inputStateUpdated <- e
|
|
||||||
}()
|
|
||||||
}
|
|
44
ui/cocoa/window_events.go
Normal file
44
ui/cocoa/window_events.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package cocoa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hajimehoshi/go-ebiten/ui"
|
||||||
|
)
|
||||||
|
|
||||||
|
type windowEvents struct {
|
||||||
|
screenSizeUpdated chan ui.ScreenSizeUpdatedEvent // initialized lazily
|
||||||
|
inputStateUpdated chan ui.InputStateUpdatedEvent // initialized lazily
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *windowEvents) ScreenSizeUpdated() <-chan ui.ScreenSizeUpdatedEvent {
|
||||||
|
if w.screenSizeUpdated != nil {
|
||||||
|
return w.screenSizeUpdated
|
||||||
|
}
|
||||||
|
w.screenSizeUpdated = make(chan ui.ScreenSizeUpdatedEvent)
|
||||||
|
return w.screenSizeUpdated
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *windowEvents) notifyScreenSizeUpdated(e ui.ScreenSizeUpdatedEvent) {
|
||||||
|
if w.screenSizeUpdated == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
w.screenSizeUpdated <- e
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *windowEvents) InputStateUpdated() <-chan ui.InputStateUpdatedEvent {
|
||||||
|
if w.inputStateUpdated != nil {
|
||||||
|
return w.inputStateUpdated
|
||||||
|
}
|
||||||
|
w.inputStateUpdated = make(chan ui.InputStateUpdatedEvent)
|
||||||
|
return w.inputStateUpdated
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *windowEvents) notifyInputStateUpdated(e ui.InputStateUpdatedEvent) {
|
||||||
|
if w.inputStateUpdated == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
w.inputStateUpdated <- e
|
||||||
|
}()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user