Menu

OnIdle

zonugata
2005-06-14
2013-03-22
  • zonugata

    zonugata - 2005-06-14

    I am developping real-time game and tools with my own window template
    framework (http://www.fakebluesky.com/tshooter/ ... sorry it's japanese),
    but my framework is obviously obsolete compared with notus, and
    game and tools code become increasingly slightly rotten,so i decided that
    rebuild game and tools using notus.

    but when I wrote a tool code, I found that theres no "OnIdle" feature.
    for example, in my code,

    http://www.fakebluesky.com/pukiwiki/index.php?MessageLoop

    like MFC's.

    I have another choise to use a thread, but if notus have "OnIdle" feature
    I will be unleashed from thread synchronization.

    Do you have plan to implement MFC like "OnIdle" feature or
    any other window loop configuration system?

     
    • Eugene

      Eugene - 2005-06-15

      There is no plans to provide OnIdle. It is exact semantic is unclear to me.
      You can consider using timers. notus has events::timer event that could be enabled by set_timer.

       
    • zonugata

      zonugata - 2005-06-15

      Not only MFC, but Borland VCL also has OnIdle mechanism,
      and we can write a idle task such as UI updating code
      (ex.Button enabling, Menu restructuring, and so on).
      both on MFC and VCL.I think writing UI updating code
      as idle task is a kind of idiom and there are men who
      want this mechanism.

      I think you can clear "OnIdle" semantic here:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CWinApp.3a3a.OnIdle.asp

      and, thank you for you advise that i should consider to use WM_TIMER,
      but I cant use WM_TIMER because it has not enough resolution
      for real-time application.

       
      • Eugene

        Eugene - 2005-06-15

        It seems like OnIdle() doesn't give you any time resolution guarantees. It's just called depending on the state of the message queue. It seems to be quite confusing to me.

        The description says.

        "OnIdle performs some processing and returns a nonzero value to indicate it should be called again to do further processing."

        Why the "further processing" cannot be done immediately if all that returning from OnIdle (with nonzero) does is calling OnIdle again?

        There are a bunch of other issues with OnIdle.

        IMHO OnIdle is yet another unsound MFC invention leading to unsound application designs.

        The idea behind notus is that the states and layouts of buttons and menu items should be driven by Model. When model is updated, notus sends a notification to all buttons and menus associated with the model and they can update they states, etc.

        If you need a trully parallel background process,  threads or timers give you a much better control over how your code gets executed.

         
        • -MyXa-

          -MyXa- - 2005-09-27

          I think notus should provide something like process_at_most_one_gui_message and process_all_awaiting_gui_messages instead of rungui.

          For example playback of two successive video files using timers or OnIdle would not look as natural:

          for_each(avi1_frames.begin(), avi1_frames.end(), &update_screen);
          for_each(avi2_frames.begin(), avi2_frames.end(), &update_screen);

          Where update_screen internally calls process_all_awaiting_gui_messages.

           
    • zonugata

      zonugata - 2005-06-15

      > It seems like OnIdle() doesn't give you any time resolution guarantees. It's just called depending on the state of the message queue. It seems to be quite confusing to me.

      Even if it is real-time game, processing window message is high priority
      compared with time-dependent issues. so I use multimedia timer or sleep
      in 'OnIdle' task and I control the timing by myself.

      but...

      > The idea behind notus is that the states and layouts of buttons and menu items should be driven by Model.

      Indeed. I decided to go thread. 

      thx.

       

Log in to post a comment.

MongoDB Logo MongoDB