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

Refactor DisplaySurface locking as used by ApiHawk (and Lua) #2575

Merged
merged 3 commits into from
Jan 17, 2021

Conversation

YoshiRulz
Copy link
Member

As before, gui.draw* draw to the "emu" surface without needing gui.DrawNew("emu"). There's a new function gui.use_surface to replace gui.DrawNew("native"). gui.DrawFinish is a no-op. I seem to be the only one who cares about ApiHawk so I won't bother explaining that.

I've tested the first commit on Windows, but not the second. The third is purely cosmetic and can be dropped.

fixes #2571 again
`gui.DrawNew("native")` now throws (I will replace this with something better).
`gui.DrawNew("emu")` and `gui.DrawFinish()` do nothing but print warning
messages, for backwards compatibility. This removes the feature which allowed
scripts to draw as soon as they became enabled. It also removes the feature to
draw without clearing the surface, though that wasn't working.
Changed surface names in APIs to "emucore" and "client" (not in DisplayManager
yet because I can't be bothered).
Via ApiHawk, `IGuiApi.WithEmuSurface(Action)` has been replaced with
`IGuiApi.WithSurface(DrawingSurfaceID, Action)`, the first param being an enum.
Via Lua (or ApiHawk), pass an extra string param (`DrawingSurfaceID` enum for
ApiHawk) to each `gui.draw*` call.
To make it less verbose, omitting the param is treated as using the default
"emucore" surface, *unless* the helper `gui.use_surface("client")` had been
called, which persists the chosen surface until Lua restarts or it's
overwritten. (The same is done when using `WithSurface` in ApiHawk, though it's
cleared once `WithSurface` returns.)
Along with the new surface names, the old names are still valid in the `surface`
params and `gui.use_surface` for now.
@adelikat adelikat merged commit 7749d02 into master Jan 17, 2021
@adelikat adelikat deleted the refactor-dispsurface-locking branch January 17, 2021 17:16
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

Successfully merging this pull request may close these issues.

2 participants