mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: remove RunWithoutMainLoop in non-mobile environments
This commit is contained in:
parent
0529fa955e
commit
b695cb928a
@ -72,13 +72,13 @@ func (c *gameForUI) Update() error {
|
||||
return c.game.Update()
|
||||
}
|
||||
|
||||
func (c *gameForUI) Draw(screenScale float64, offsetX, offsetY float64, needsClearingScreen bool, framebufferYDirection graphicsdriver.YDirection, screenClearedEveryFrame bool) error {
|
||||
c.offscreen.mipmap.SetVolatile(screenClearedEveryFrame)
|
||||
func (c *gameForUI) Draw(screenScale float64, offsetX, offsetY float64, needsClearingScreen bool, framebufferYDirection graphicsdriver.YDirection, clearScreenEveryFrame bool) error {
|
||||
c.offscreen.mipmap.SetVolatile(clearScreenEveryFrame)
|
||||
|
||||
// Even though updateCount == 0, the offscreen is cleared and Draw is called.
|
||||
// Draw should not update the game state and then the screen should not be updated without Update, but
|
||||
// users might want to process something at Draw with the time intervals of FPS.
|
||||
if screenClearedEveryFrame {
|
||||
if clearScreenEveryFrame {
|
||||
c.offscreen.Clear()
|
||||
}
|
||||
c.game.Draw(c.offscreen)
|
||||
|
@ -58,10 +58,6 @@ func (u *UserInterface) Run(game Game) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (*UserInterface) RunWithoutMainLoop(game Game) {
|
||||
panic("ui: RunWithoutMainLoop is not implemented")
|
||||
}
|
||||
|
||||
func (*UserInterface) DeviceScaleFactor() float64 {
|
||||
return deviceScaleFactor
|
||||
}
|
||||
|
@ -642,10 +642,6 @@ func init() {
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
|
||||
func (u *UserInterface) RunWithoutMainLoop(game Game) {
|
||||
panic("ui: RunWithoutMainLoop is not implemented")
|
||||
}
|
||||
|
||||
// createWindow creates a GLFW window.
|
||||
//
|
||||
// width and height are in GLFW pixels (not device-independent pixels).
|
||||
|
@ -600,10 +600,6 @@ func (u *UserInterface) Run(game Game) error {
|
||||
return <-u.loop(game)
|
||||
}
|
||||
|
||||
func (u *UserInterface) RunWithoutMainLoop(game Game) {
|
||||
panic("ui: RunWithoutMainLoop is not implemented")
|
||||
}
|
||||
|
||||
func (u *UserInterface) updateScreenSize() {
|
||||
switch {
|
||||
case document.Truthy():
|
||||
|
@ -250,7 +250,11 @@ func (u *UserInterface) Run(game Game) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UserInterface) RunWithoutMainLoop(game Game) {
|
||||
func RunWithoutMainLoop(game Game) {
|
||||
theUI.runWithoutMainLoop(game)
|
||||
}
|
||||
|
||||
func (u *UserInterface) runWithoutMainLoop(game Game) {
|
||||
go func() {
|
||||
if err := u.run(game, false); err != nil {
|
||||
u.errCh <- err
|
||||
|
@ -29,5 +29,5 @@ import (
|
||||
//
|
||||
// TODO: Remove this. In order to remove this, the gameForUI should be in another package.
|
||||
func RunGameWithoutMainLoop(game Game) {
|
||||
ui.Get().RunWithoutMainLoop(newGameForUI(game))
|
||||
ui.RunWithoutMainLoop(newGameForUI(game))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user