View Single Post
Old 10-05-2005, 10:38 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,031

You can use FloodFill or ExtFloodFill to fill outlines, or solid colors, but I thing for creating your mask I would just use the polygon function.
You can search for polygon to find a number of examples.
A fairly simple example that might be adapted to your situation can be found in post #3 of this thread.

I don't think the following code is necessaryily ready for public consumption, it is just some code I worked on some time back playing around with ideas of doing isometric type drawing, but being allowed to rotate and tilt the view.
It uses both polygon and plgblt.

Since plgblt doesn't work on Win9x machines I'm not sure what will happen if you pick that option on a Win9x machine. It may draw nothing, or maybe it will do a poly.

This has been sitting around on my disk for quite awhile now, so I might as will post it for what it's worth, but be aware that the comments and code might not match. Originally I was drawing a single cube, then I drew four cubes (2x2), and added a grid of lines. That was when I added the comments. But I later made it 4x4 and instead of cubes varied the size (width, length, and height) so that it would be more like buildings on a square.
I then added the checkbox options to switch between using plgblt or polygon to draw the faces of the boxes.
I didn't update the comments so some of them are out of sync at this point.

As I said, this was just my experimental code, and so isn't really meant to do much of anything practical, and doesn't limit the tilt so that you don't go under or upside down, and you might run far enough away to loose where the boxes are.

The command button should reset everything back.
The mouse, I guess I left it where if you click, the circle moves toward the mouse (front and back) or spins towards the mouse (left and right) until you click it again.
The arrow keys will also do the motion. The A and Z key will tilt around the X Axis, as will the top skinny picturebox.
The four skinny pictureboxes are meant to be dragged on (like scrollbars) to rotate around the X and Y axis. (and "move" the circle).

A bit of a mess, but I didn't intend on anyone seeing this particular code.
On the other hand, I'm so busy now, I won't be doing anything with it for awhile and maybe it can serve at least as another example of using the polygon function.
Attached Files
File Type: zip (50.3 KB, 47 views)
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.

Last edited by passel; 10-05-2005 at 11:36 PM.
Reply With Quote