Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FinalScreenDrawer is not called #10

Open
sedyh opened this issue Oct 1, 2024 · 3 comments
Open

FinalScreenDrawer is not called #10

sedyh opened this issue Oct 1, 2024 · 3 comments

Comments

@sedyh
Copy link

sedyh commented Oct 1, 2024

It is necessary to call interfaces that game can optionally implement, like FinalScreenDrawer.

func (s *SceneManager[T]) Update() error {
	return s.current.Update()
}

func (s *SceneManager[T]) Draw(screen *ebiten.Image) {
	s.current.Draw(screen)
}

func (s *SceneManager[T]) Layout(w, h int) (int, int) {
	return s.current.Layout(w, h)
}

I've implemented quick fix for this:

func (s *SceneManager[T]) DrawFinalScreen(screen ebiten.FinalScreen, offscreen *ebiten.Image, geoM ebiten.GeoM) {
	if v, ok := s.current.(ebiten.FinalScreenDrawer); ok {
		v.DrawFinalScreen(screen, offscreen, geoM)
		return
	}
	screen.DrawImage(offscreen, nil)
}

However, there are still some bugs with it. Like it turns off just before the transition.

@joelschutz
Copy link
Owner

What is the purpose of this interface?

@joelschutz
Copy link
Owner

I had missed this interface. This easy to add, will do it as soon as possible. Never even knew this interface existed and what is used for.

@sedyh
Copy link
Author

sedyh commented Nov 4, 2024

What is the purpose of this interface?

This is workaround in order to solve the problem of drawing a shader on the same input and output image (otherwise we will get a panic due to some implementation features).

This easy to add, will do it as soon as possible.

Thanks. However, I'm not so sure about this. It should be tricky cause it exposes some scaling internals.
As far as I remember, noppikinatta had to push to fix the existing ebitentine api for this.
hajimehoshi/ebiten#3139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants