At 05:25 2002-07-24 -0800, Sean Healy wrote:
I don't know if anyone's ever heard of the Games::Worms module, but I'm attempting to make a Win32::GUI viewer for it, and I'm having a few problems.
Painting on the window control itself will only last until the window is repainted by Windows, so that's the wrong thing to do.
What you do is put a Graphic control in your window, then you put the drawing code into the Paint event handler. It will get called each time Windows thinks it needs to be repainted. If you know you changed something you can force it to repaint the control by calling InvalidateRect().
You are responsible for painting the entire area yourself.
Third, I tried placing Win32::GUI::DoEvents in the sub that draws the worm segments, but it never returns, so the script sits there forever. I'm not sure if this is a Graphic problem or not, but I've never run into it before.
Either the program main loop is handled by your game. In that case you need to call DoEvents as often as possible (from the draw sub sounds right if it gets called often by the game engine).
Or the program main loop is handled by Win32::GUI. In that case I suggest you set up a Timer control and in the Timer event handler you call the game engine so it can run the game.
/J -------- ------ ---- --- -- -- -- - - - - - Johan Lindström Sourcerer @ Boss Casinos [EMAIL PROTECTED] Latest bookmark: "Buffy the Vampire Slayer (BTVS), a recent teen..." http://www.verbatimmag.com/slayer1.html dmoz (1 of 2): /Arts/Literature/Journals