Legos

Mike Willson

 

Description:

  This program provides a simple and intuitive interface for building objects with Lego blocks. Like real Legos, block sizes are measured in units so that all the pieces are guarateed to snap together. The user can create a block on the base, adjust its length and width as well as its color. The block can then be moved around, rotated, and placed. Projects can also be saved and loaded again.

User Guide:

 

The sidebar:

The sidebar is divided into three areas: The 'block' area, the 'camera' area, and the 'Load/Save' area. To start, click the 'Make Block' button to create the default block in the center of the building area. You can adjust the amounts of Red, Green, and Blue color in the block by typing in a value between 0.0 and 1.0 or using the arrows. The length and width can be adjusted the same way between values of 0 and 20. Clicking the 'Rotate' button will rotate the block. The block can be moved after it is made by clicking in the drawing area and then using the movement keys.
'e' or '8' = move up.
's' or '4' = move left.
'f' or '6' = move right.
'x' or '2' = move down.
Clicking the 'Place Block' button or pressing the '5' or 'd' keys will permanently add the block to the project.

The 'Camera' area lets you rotate, move, and zoom in and out on your project. By default, it is set to 'none.' To apply one of these transformations click and drag the mouse in the drawing area.

The 'Load/Save area handles loading and saving project files. Click either the 'load' or 'save' radio button to make your selection and then enter the filename to load or save. The request is completed by clicking the 'Load/Save' button.

The last three buttons reset the viewing, show the help screen, and quit respectively. Their keyboard equivalents are:
'q' quits.
'r' resets the viewing.
'h' prints the help screen.

Moving blocks:

You cannot explicity move blocks vertically, the program does it for you. As you move the current block, the program will check to make sure that it doesn't overlap any other blocks in the current project. When two pieces are about to overlap, the piece that is being moved is pushed up a level to be placed on top of the other piece. In this way, objects can be built vertically with ease. The opposite is true when a piece reaches the end of the piece it is on top of (i.e. it will be shifted down until it rests on the base or the next block down.

Saving Projects:

Projects are written to text files where each line corresponds to a single block. A block has a width, length, a location (x, y, z), and a color R, G, B. Thus the format for a line is the following:
Block width length x y z R G B
Note that the width, length are integers from 0 to 20; x, y, and z are even integers from -20 to 20; while R, G, B are decimals between 0.0 and 1.0

Example:
Block 3 2 0 0 -4 0.5 0.0 0.5
This line contains a block with a width of 3 units, length 2 units at a position 2 units back from the center of the building area. The color of the block is magenta.

Screenshots:

 


Initial Screen


A new 3x3 block has been created and moved. The camera has zoomed in and rotated as well.


The block has now been placed. This resets the block parameters and disables everything except for 'Make Block'


After loading the project file 'opengl.leg'