portable GUI library that works with game libraries like SDL

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
portable GUI library that works with game libraries like SDL
by on (#62946)
I implemented the CPU and a basic PPU and arrived to a phase where I need to build a debugger to watch machine code, memory and PPU state to see what's happening and fine tune the emulator. ( it renders a static-background demo, but games don't output anything to the screen )

I'm using SDL, mainly because I want to make my emulator portable.
But for the debugger I need some GUI, as the debugger needs not be distributed with the first public version of the emu, so the debugger doesn't need to be cross-platform, I'd still like to make it portable.

What do you recommend for the GUI? Libs like QT take control of main() as SDL does, so I'm not sure if they can work well together. There are some GUI libs built on top of SDL, but I'm nor sure they're good, and not many seem updated lately.

For portable emulators, which I know SDL is a popular choice, are GUIs commonly programmed natively for each platform? or are they programmed on a portable GUI library?

by on (#62948)
if you want your app to be cross platform i suggest you build it and test it on as many platforms as you can as often as you can. for example, i test mine on x86, x86_64, ppc, linux, bsd, mac, and a some time ago on the ps2.

i am working toward the same goal as you kinda. currently working on my core written in C as a lib, then i can use what ever UI i want, sdl, qt, opengl, what ever. while coding all my debugging was dumped to stdout. you should be able to do the same thing with a funtion call and have it return what ever debug data you want and have it set break points, all without gui code embedded in the core.

by on (#62949)
I know little about SDL, though I really need to learn it because Ubuntu developers care more when it breaks than when Allegro breaks. But Allegro has a basic GUI framework that apps can use if they choose, and Allegro alert boxes (as seen in freepuzzlearena) and the Allegro file chooser (as seen in 8TED, 8name, and the replayl in Lockjaw) are built on this framework.

by on (#62971)
The way you get around Qt being message based is to setup a QTimer that fires every 0ms. Your program won't ever go to sleep as a result, and you just treat your timer as the main loop of your program.

Also, don't use QApplication::processEvents() in place of QApplication::run(), as that breaks the OS X port.

I would personally target Qt and then embed SDL into that using SDL_WINDOWID; but you can do it any way you want. Just don't make your core dependent upon any API you don't have to.