Change Cafu to use wxWidgets for screen, main window and OS event queue management

Issue #34 resolved
Carsten Fuchs
created an issue

Currently, some parts of the proprietary implementation of Cafu OS-specific code come with several problems: - Current use of DirectX7 under Windows for mouse input - prevents successful linking under 64-bit Windows, - doesn't work with touch or pen tablet input, - is worse(!) in performance than using the Win32 message queue (see below for reference). - Has no support for Mac OS X yet.

Modifying Cafu to employ the wxWidgets library (just like the editor CaWE) for display, main window and event handling would resolve these problems, plus yield (or at least make available for future use) all the other benefits of wxWidgets as well.

Regarding mouse input accuracy and performance, ''not'' using DirectInput seems to be favorable as well, see [http://msdn.microsoft.com/en-us/library/ee418864.aspx Taking Advantage of High-Definition Mouse Movement] for details. So nothing is lost by replacing DirectInput under Windows, and if the need arises, it can still be re-added besides wxWidgets later.

This ticket is a (recommended) prerequisite for ticket #19.

Comments (3)

  1. Carsten Fuchs reporter

    Some resources regarding event queue processing and performance / simulating the "master game loop" in wxWidgets:

    1. Idle Events - http://wiki.wxwidgets.org/Making_a_render_loop#Using_idle_events - http://docs.wxwidgets.org/trunk/classwx_idle_event.html - Seems to give the same optimal performance than hand-written `PeekMessage()` loop, but stops when menus are opened or the window is moved (though we might simply ignore this, or help it with a timer).

    2. Own Event Loop - http://article.gmane.org/gmane.comp.lib.wxwidgets.general/66493 - A viable alternative to idle events that potentially also works when idle events don't, but is also more complex and may turn out very similar to idle events anyway. - We would have to check the implementations, idle events might in fact be even closer to what we really want:

    while (true)
    {
        while (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
        {
            ...;
        }
    
        OurCode();
    }
    

    instead of

    while (true)
    {
        while (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
        {
            ...;
            OurCode();    // This is called too frequently!
        }
    }
    
  2. Log in to comment