PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Problem scaling surface

Might be brainfart time, but I don't get it...

Code:

// counter is an int set to 0 when this starts
// player_pos is a POINT set to something like 100,100
// The player_image surface being blitted is 22x41
// This is in ProcessNextFrame...
GDBLTFX gdbltfx;
gdbltfx.dwRotationScale = 100 - (counter * 2);
backbuffer.Blt(CRect(player_pos.x, player_pos.y, player_pos.x + 22, player_pos.y + 41),
player_image, NULL, GDBLT_KEYSRC | GDBLT_ROTATIONSCALE, &gdbltfx;);
counter = counter + 2;
if (counter > 50) {
resetGame();
}

My expectation is simply that the image should shrink to nothingness in 50 frames time. Instead, I see no change. What obvious mistake am I making?!? Thanks all.
I'm assuming you aren't resetting the counter each frame??
Nope, the counter isn't the problem. Interestingly enough, it seems you HAVE to turn on the GDBLT_ROTATIONANGLE flag to enable the scaling, otherwise the scale remains at 100%. You'll probably want to set nRotationAngle (which is incorrectly called dwRotationAngle in the docs) or your image will be placed at a random angle because its not initialized.
Yes, that was in fact the problem, thank you! Good call about settingt nRotationAngle as well, that's exactly what happened.

Johan, I would list this as a minor bug... I would expect to be able to do a scale without setting the rotation flag, right?
Actually it's a feature.. :) I'll just update the documentation. The same accounts for rotation centre, it doesn't work unless you specify a rotation angle..

I guess it should work even if you don't specify rotationangle... It's a simple fix though...
Yeah, I certainly wouldn't say it's a big deal either way... As long as the documentation says it I can certainly live with it.

As an aside, I had a system that a guy I worked with wrote about five years ago... When he left, the source was zapped (by accident he said, but I think we know the deal) and I was asked to decompile it and work on it (a Java app). Well, needless to say, the source I got out of the decompiler wasn't so hot, so working on it was a total nightmare. The thing was actually causing the JVM to GPF on Win98 boxes believe it or not! Well, after a couple of days of not being able to figure out why, I finally told the user base it was a feature, since every hour or so they got to take a break from work to restart the app (which took about a minute!).
:D