Open main menu

CDOT Wiki β

Changes

BTP300 Student Resources

3,546 bytes added, 18:04, 11 October 2011
Student Resources
{{BTP300 Index | 20113}}
=Student Resources=
The purpose of this page is to share useful information that can help groups with their game projects.==Pseudo Code==This should help you with your designs of some of the classes. Not all functions are included. The simpler ones are omitted.===CFrame===* CFrame::Constructor** initialize instance variables** determine if full screen*** if full screen set width and height to console width and height** initialize covered area to nothing* CFrame::Destructor** release the covered area* CFrame::setLine** do this yourself* CFrame::absRow** start with the row value for this frame - call row()** add the row value for the parent frame if any** add the row value for the parent's parent frame if any** continue until you run out of parents* CFrame::absCol** same as absRow except for columns* CFrame::goMiddle** calculate the absolute row and column position of the middle accounting for the border if any** set the cursor position to these absolute values* CFrame::display** remember to account for a border if any and is on** calculate the width of the frame with a border if any** reduce width if frame extends beyond the border of the parent frame** calculate the absolute position of the frame** call your display function to display the string* CFrame::edit** remember to account for a border if any and is on** calculate the width of the frame with a border if any** reduce width if frame extends beyond the border of the parent frame** calculate the absolute position of the frame** call your edit function to edit the string* CFrame::draw** allocate dynamic memory for string to hold a single line of the frame** capture the rectangle of characters that will be hidden by the drawing of the frame** if the frame is bordered and the parameter does not hold the no frame value** create the top line of the frame** position the cursor for the top line** insert the top line into the output stream (<<)** create an interior line of the frame** for each interior line*** position the cursor for the interior line*** insert the interior line into the output stream (<<)** create the bottom line of the frame** position the cursor for the bottom line** insert the bottom line into the output stream (<<)** deallocate dynamic memory* CFrame::move** hide the frame** switch on direction received*** increment or decrement row or column value*** ensure that frame does not move outside parent frame or console space** draw the frame* CFrame::hide** restore the hidden rectangle of characters at the current position of the frame** release the dynamic memory used to store the hidden characters* move** create pointer to meesage for moving** capture the characters hidden by the message** for each move request*** insert the message into the output stream (<<)*** extract the key pressed from the console (>>)*** switch on the key press**** move the frame referred to in the parameter as requested**** exit moving operations on Escape*** restore the characters hidden by the message*** release the dynamic memory for the message*** may need to draw the frame after removing the message===CField===* CField::Constructor** pass parameter data to CFrame** store the address of the field data in the instance pointer* CField::Destructor** nothing* CField::display** call CFrame::display with the offest received* CField::edit** call CFrame::edit with the address of the data belonging to the field* CField::pdata** return the address of the data belonging to the field* CField::data** return the address of the pointer that holds the address of the data belonging to the field
==Useful diagrams==