portable GUI library that works with game libraries like SDL

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

portable GUI library that works with game libraries like SDL

Post by Petruza » Mon Jun 14, 2010 8:50 am

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?

Posts: 345
Joined: Fri Jul 29, 2005 3:40 pm
Location: near chicago

Post by mattmatteh » Mon Jun 14, 2010 9:52 am

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.

Posts: 22052
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Post by tepples » Mon Jun 14, 2010 10:05 am

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.

Founder of higan project
Posts: 1550
Joined: Mon Mar 27, 2006 5:23 pm

Post by Near » Tue Jun 15, 2010 4:49 am

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.

Post Reply