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

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  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.

  Implement the tronomino tiling algorithm

Implement the tronomino tiling algorithm,  our program should take an arbitrary input positive integer  k  in the Linux command line and generate a 2 k  * 2 k  board.

  Create program to input miles driven and gallons used

Create a program in C++ which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display the miles per gallon

  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 c program which compute acceleration of jet fighter

Write a C++ program which compute the acceleration (m/s 2) of jet fighter launched from aircraft-carrier based catapult, provided jet's takeoff speed in km/hr

  Write a program to read a data file and extract parameters

Write a C/C++ program to read a data file and extract parameters. The program must obtain the filename via a command-line argument.

  Program to enter number of values to be processed

Write c++ statements to permit the user to enter n, the number of values to be processed; then assign the anonymous array of n double values, storing its address in doublPtr.

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  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 ..

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

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