Results 1 to 5 of 5

Thread: request_repaint()

  1. #1
    Peasant
    Join Date
    Jul 2009
    Location
    China Xi'An
    Posts
    8

    Default request_repaint()

    Hi,
    I'm writing a chess game, but it has repainting problem. I use the GUI module, and set_constant_repaint(false). It calls request_repaint() after each step, the local input is OK, but when receiving command from network, the window doesn't update immediately, it updates when I move the mouse, or trigger other event. It seems request_repaint() doesn't make the window update immediately, how it works? Is there any way to update window immediately at any time with GUI module?

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I think that I understand what the problem is:

    You are using gui.exec();

    Can you try the following:

    while (!gui.exec(false)) { }

    If that works, it is because:

    A network event has been received (and processed).
    But the CL_KeepAlive::process(timeout); (called in gui.process_messages())
    Is not breaking out of the KeepAlive loop

  3. #3
    Peasant
    Join Date
    Jul 2009
    Location
    China Xi'An
    Posts
    8

    Default works

    Thanks very much, it works.

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    That probably means there is a bug in clanlib somewhere.

    It is a fix, not a solution. You will notice the cpu usage will now be 100%

    When you say:

    but when receiving command from network
    How are you receiving a command from the network. Your own class, or which clanlib class?

    If you are using your own class (your own network stack), you will need to inherit http://clanlib.org/docs/clanlib-2.0....iveObject.html

  5. #5
    Peasant
    Join Date
    Jul 2009
    Location
    China Xi'An
    Posts
    8

    Default

    The cpu usage is about 10%, not 100%, so it is a solution for me now.
    I use libjingle(to use XMPP service, http://code.google.com/intl/zh-CN/ap...gle/index.html) to receive command from network, it works in another thread, this is the problem?.
    When receiving a piece of xml stanza, a appropriate XmppTask(which I inherit from, not a thread, just a state machine) will be waken and call functions I overrided.
    It works fine now, but I will check CL_KeepAliveObject some day.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •