From: Sean Healy <jalopeura@ho...> - 2002-07-24 13:26:35
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
First, I can't get the DC::BackColor function to work. I've tried [0,0,0]
and 0, but neither seems to work.
Second, every so often the current picture disappears, resulting in a gray
background again, and things pick up again where they left, but everything
I've drawn before is just gone. I have a border around the graphic control,
and it doesn't appear at first, but as soon as the first picture blanking
occurs, the border appears.
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.
I don't use _Paint, because the Worms calls a sub named draw, which I have
to override in my class. I thought perhaps that was my problem, so I set up
a _Paint sub that simply gets the DC and then validates, but it made no
If nobody recognizes these problems, I'll try to reproduce them in a
standalone script, since probably nobody else has Games::Worms.
MSN Photos is the easiest way to share and print your photos:
From: Johan Lindstrom <johanl@ba...> - 2002-07-24 14:04:12
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.
-------- ------ ---- --- -- -- -- - - - - -
Johan Lindström Sourcerer @ Boss Casinos johanl@...
Latest bookmark: "Buffy the Vampire Slayer (BTVS), a recent teen..."
dmoz (1 of 2): /Arts/Literature/Journals