Design a deck plan space ship in eclipse

Assignment Help C/C++ Programming
Reference no: EM1372160

Computer Graphics

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls, shielding/insulation/reinforcement (SIR) areas, walkable areas, interior walls, hull windows and interior doors. The deck could contain some simple pieces of furniture, hardware (power plant, shield generator, computer, etc.), and pods. Your program will allow the user to create the hull walls, SIR areas, walkable areas, interior walls, hull windows and interior doors; to place and size objects such as furniture and hardware on the deck; and to delete any object no longer wanted.

For simplicity a hull wall could consist of a thick straight line segment (instead of a curved line segment); thin straight line segments could be used for interior walls and hull windows. Shielding/insulation/reinforcement (SIR) areas could be suitably filled polygons; walkable areas of the deck could be polygons filled with an appropriate stipple pattern.

As a starting point for your work you could use the program contained in DeckPlan.zip. Compile, build and execute this program. Notice that it displays a screen window containing some aligned rectangles (that is, rectangles whose sides are aligned with the coordinate axes). The large rectangle on the left is the drawing region in which the deck plan could be created. On the right hand side appears a button containing a small square: this button allows the user to select a piece of furniture (represented by an aligned rectangle of fixed width and height to begin with) as the current object to be drawn. The following parts ask you to extend this program. A sketch which indicates roughly what your final program GUI, together with a simple hypothetical deck plan layout in its drawing region, might look is provided to you in DeckPlan.pdf. Your GUI does *not* have to be exactly the same as the one suggested in the diagram. In particular, your choice of colours could be different. Note that the upper diagram was obtained from the internet, and served as a kind of inspiration for the sketch below it.

Notice that the program is organised as three files. You could keep the same basic file (and class) structure throughout your extension work if you like. However it is up to you if you wish to add more files or otherwise change the structure of the program. (If you redesign it radically, it would be appreciated if you include some rationale in your Readme.html file.)

1. Draw a grid (equally spaced horizontal and vertical lines) for the drawing region. This will facilitate the creation of a deck plan.

2. Add a button which allows the user to create a hull wall (thick straight line) of desired length. Left mouse button press, drag and release could specify the endpoints. Add a button which allows the user similarly to create an interior wall or hull window (thin line) of desired length. No "rubber line" is requested yet.

3. Add a button which allows the user to create an SIR area (appropriately filled polygon). A succession of left mouse button clicks could specify the corners, with some "finish" action, such as a right mouse button click, indicating completion of the polygon. Add a button which allows the user similarly to create a walkable area (polygon filled with an appropriate stipple pattern).

4. For your furniture (light coloured rectangle with border) creation tool, now allow the user to enter the opposite corners of the desired rectangle using the mouse (with left button press, drag and release). Add a button which allows the user simlarly to create hardware (dark coloured rectangle with border) of desired size. No "rubber rectangle" is requested yet.

5. Add a button which allows the user to create an interior door (thick/thin straight line) of desired length. Left mouse button press, drag and release could specify the endpoints. Add a button which allows the user to create a pod (coloured circle).

6. Currently, drawn objects can extend beyond the drawing region. Arrange for drawn objects to be *clipped* against the drawing region.
Hint. Look at Example 3.2.5 on pages 101 and 102 of Hill and Kelley (or see pages 89 and 90 of the 2nd edition).

7. For the wall, furniture and hardware objects only, provide the user with feedback during the process of drawing an object by displaying a "rubber object" outline that changes shape as the user moves the mouse. Use the XOR logical operation, as described in Section 9.3.3 of Hill and Kelley 3rd edn (Section 10.3.3 of the 2nd edn) in which relevant theory is described and implementation details are outlined.

8. A sigificant disadvantage with the deck plan editor as it currently exists is that objects are drawn and then forgotten, so to speak. Consequently, if the screen window is partially covered by another window, and subsequently exposed by moving the other window away, then the objects which were drawn by the user disappear as the redraw event triggers a call to the display function.
Eliminate this problem by having your program build a model (list) of all the deck objects (walls, deck areas, furniture, etc.) drawn by the user.
A nice way to do this is to use a global vector of deck objects. Let's call our global vector DeckModel. The mouse function should draw and append to DeckModel each new deck object created. The display function should traverse DeckModel, drawing each object stored.
After doing this, move the call to glClear() and the command to fill the drawing region from init() to display(). (They really belongs in display().)

9. Add a button labelled "File". Clicking on this button should cause a pop-up File menu to appear. This menu should provide at least three options: Save (write to file), Open (read from file), Quit. In case Save is selected, the contents of DeckModel should be saved in (written to) the text file DeckPlan.txt. In case Open is selected, the contents of the text file DeckPlan.txt should be read intoDeckModel and displayed.
Details concerning the text file format you are requested to use are found below in a separate section.

10. Add two buttons for select and delete. Provide functionality for these buttons. Selection of an object could result in a simple selection box (rectangle, say) being drawn around the object.

11. Add a small row of 4 different colour buttons and provide the functionality for them.

12. One mark is awarded for an impressive professional looking user interface. One mark is awarded for good programming style.

Reference no: EM1372160

Questions Cloud

Determine the optimal price of product : After a 10 percent price discount, a company found that its weekly sales increased by 30 percent. If the marginal cost (MC) of this product is $40 each, determine the optimal price for this product?
Estimating profit : Your supervisor recently instituted a plan that encourages her managers to share non private demographic characteristics voluntarily provided by those who buy your company's final product.
How can a firm gain by reducing competition : Price higher in monopoly market. Bigger quantity in perfect competition. How can a firm gain by reducing competition.
How did this impact competition in many markets : f P falls below AC, what is result for firm? Firm loses money 16. In late-19th century, both firms and markets expanded. How did this impact competition in many markets.
Design a deck plan space ship in eclipse : Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.
Does currency-board regime was a mistake. : with monetary policy for closed, it is hard for authorities to stimulate demand. Interior design does this show that currency-board regime was a mistake.
Calculate the profit-maximizing level of outpu : Use the following data to answer the questions given below; Calculate the profit-maximizing level of output and price if the company sells all of its tickets at one price.
Is this firm able to earn a positive profit : Suppose that C (q) = 10q + 3,500,000 (for which MC (q) = 10 ). Use Inverse Elasticity Pricing Rule in order to determine profit maximizing price and level of output for this firm. Is this firm able to earn a positive profit.
Which limits amount of goods they can purchase : which limits amount of goods they can purchase. Preference Consumers always choose goods which give most pleasure. So how do we measure about pleasure.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Assessment system of a university

Write a program for Assessment system of a University

  Write c program that prompts for variable number of integers

Write a C program that prompts for a variable number of integers, adds them up, averages them, and prints out the average.

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  Operating system and cpu scheduling

Operating System and CPU Scheduling

  Prepare a linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM

  Design a nested program

How many levels of nesting are there in this design?

  Pros and cons of choosing two servers

Classify the two alternatives in terms of what type of application architecture they use. b. Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better.

  Draws a single level for a "rogue­like" computer game

You will write a program that draws a single level for a "Rogue­like" computer game. The program will parse a line of input text from an input file (room.txt), use the parsed text to determine the shape of the room and its contents and then draw the ..

  Develop a two dimensional interactive game

The player starts as a disk, but can "morph" (that is expand and contract) in selected directions

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Write a program to calculate students average test scores

Write a program to calculate students average test scores

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd