On 13 Oct 2007, at 20:22, Disch wrote: > I've been working on an NES emulator for quite some time. > Currently I'm just using a sloppy/temporary setup with WinAPI for > the UI, but I've always had plans to move to some sort of > crossplatform widget library (like FLTK).
OK - I'll try and avoid the obvious temptation to ask why and try and move onto your questions... Oh bother! I just did ask. Sorry! > 1) regarding the message pump. It appears the program forfeits > control over to FLTK as soon as it calls Fl::run(), Pretty much - although that isn't as much of a constraint as it first appears. You can either *not* call Fl::run() at all but simply keep fltk's heart ticking by calling Fl::check() (or maybe Fl::flush() ) periodically. Alternately, you can thread your system so that the GUI runs with Fl::run() and the emulator back-end runs in it's own threads independently, then with some simple IPC to communicate between them. Anyway - a google should find something - there are a few "worked examples" on the net of fltk being used with other toolkits is various ways. In particular you should find some fltk+SDL examples, which would probably be ideal for your needs (with SDL handling the cross-platform game-engine side of things and fltk handling the GUI aspects.) Similarly, I have seen fltk+Allegro examples, fltk+ITK, etc... > 2) Assuming #1 works out, I will need to be able to sleep. I > didn't immediately notice any function to make the program sleep > for X milliseconds. One post I saw on this board had some example > code that called system() to sleep, but I don't like that idea at all. > > Is there a sleep function included in FLTK anywhere? Did I just > miss it? If you need accurate timing you need to use the OS specific methods - fltk, as a GUI lib, doesn't care all that much about exact timing, so doesn't wrap these functions for you (although it is trivial to do so yourself with just a few #ifdef's if you want to.) All the games libs (SDL, Allegro, etc, etc...) do provide timer functions you can use, of course. > 3) I didn't see anything for joypad/gamepad support mentioned in > the docs I skimmed. This isn't really that big of a deal since I > can probably get that from another library... but it's worth asking > about here. If this library can do it, no sense in adding another > unecessary library. No, that's another thing that lies outside fltk's base footprint. But all the games libs do it, and there are lots of "standalone" joystick/ joypad libs too... > 4) Ditto for sound output (specifically, I need to be able to > constantly stream PCM). Again not much of an issue -- lots of good > sound libraries available elsewhere. (See answer for 3!) Actually, Mike did a worked example of how to do sound "by hand" for the sudoku and "Block Attack!" demos, so you could easily start with that. If it was me, I'd probably go with libPA or SDL though. > 5) Does FLTK have any kind of Unicode support? The example code I > saw seemed to use char arrays for strings everywhere. I've been > trying to make a conscious effort to make my programs as Unicode > friendly as possible. If I'm stuck using char arrays that's fine > -- it's not a huge setback -- though Unicode would be nice. Fltk-2 does. Fltk-1.1 only does through patches, separate from the mainstream (the mainstream can't be patched for backwards compatibility reasons.) The fltk-1.1.x utf8 patches date back to the 1.1.6 series, which is years old now and largely predates the fltk-2 stuff. There are also more recent fltk-1.1.8-utf8 patches circulating now. > 6) Just what is the difference between FLTK v1.1.x and v.2.0.x? > The download pages have 1.1 linked first (and in bold) as if its > still being updated despite 2.0 being available. Is 2.0 still in > beta or something? Is there any reason to use 1.1 over 2.0 when > starting a new project? Fltk-1.1 is stable, and 1.1.8 (when it comes out) may be the last development release - thereafter it'll probably go into maintenance only releases (no new features, just fixes.) Indeed, most of the recent work on the 1.1 series has been bug-fixes and maintenance. The 1.1 series is very robust though, so I expect to be using it for a long time to come. The fltk-2 story is more difficult: It has a cleaner and more flexible API, with UTF8 support etc. Unfortunately, the API isn't actually stable, and the code periodically goes through "disruptions" that break backwards compatibility as the API "evolves". You could argue that fltk-2 is still in beta. I wonder if it is really out of alpha, some days... It may be better suited to your needs going forwards, but just be prepared for the odd hiccup along the way! -- Ian _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

