Game Developers to Consider Dedicated Files Outside the Source

Game Developers to Consider Dedicated Files Outside the Source

[TOOL BOX] Doxygen Essentials Nicholas Olsen DOCUMENTATION. THE WORD STRIKES TERROR IN THE to-day tweaking of configuration files and programmer’s soul. And for anyone who has inherited someone building documentation. I recommend else’s code, a lack of documentation (apart from the source playing around with Doxywizard to itself) can make getting productive a painful chore. figure out how to use it for building the Few game studios can divert precious resources exclusively to examples; descriptions of how to navigate the creation and maintenance of documentation, especially when the UI widgets would add too much clutter they are the sole clients for internal engine and tool development. for a quick introduction. One way to reduce the effort required for documentation is to use a documentation generator, a program that uses the source YOUR FIRST itself along with specially formatted comments to automate DOCUMENTED CLASS typesetting and page layout, which results in a final document. The programmer informs Doxygen of his or her intent to Your first documented class Assuming interfaces will be commented (and why document something via special documentation blocks and in Doxygen's Class List. wouldn’t they be?), using a documentation generator allows commands. A special documentation block is a comment documentation to become a part of the development process that is extended to inform Doxygen that it will be used for rather than a process unto itself. I’ve found Doxygen to be a generating output. good, free solution. Doxygen supports several comment styles to accommodate the various languages it understands, which can lead to GETTING STARTED WITH DOXYGEN confusion for beginners, as the samples in the manual bounce Doxygen, created by Dimitri van Heesch, is a documentation between styles seemingly at random. I will use C++ for the system for code written in C, C++, C#, Java, Objective-C, examples here, along with the triple-slash (///) to denote Python, IDL (CORBA and Microsoft flavors), Fortran, VHDL, PHP, documentation comments and @ to denote commands. and to some extent D—or so says the official literature. The Create a source file named DoxygenEssentials.h and insert commenting extensions supported by Doxygen are relatively the following comment and class declaration: low on programmer overhead but can scale from simple API references to comprehensive manuals. /// @brief A documented C++ class! To get started, the user must first download and install class Doxygenized { binaries for his platform, available from www.stack.nl/~dimitri/ }; doxygen/download.html#latestsrc. For the sake of the following examples, I will assume the user has the Doxygen executable in From a command prompt, cd to the directory that contains his PATH and available from a command-prompt, which will be DoxygenEssentials.h and issue the following commands: the case for a default Windows installation (OS X and other *nix users may need to add Doxygen to their PATH). >doxygen -g The Doxywizard GUI front-end is also available to assist in >doxygen configuring and running Doxygen, and is perhaps better for day- CONTINUED ON NEXT PAGE "NJOPSJTTVFJOUIFCFHJOOJOH 00810gd_toolbox_vIjf.indd810gd_toolbox_vIjf.indd 4433 99/17/08/17/08 33:05:13:05:13 PPMM [TOOL BOX] CONTINUED FROM PREVIOUS PAGE The first command tells Doxygen to generate a default Add the following to the body of Doxygenized and rebuild: configuration file, which will be named Doxyfile. The second command builds the documentation and places html and latex public: output in ./html and ./latex, respectively (I will ignore the /// @brief A documented method LaTeX output). /// /// The isDocumented method serves as an Opening ./html/index.html in a web browser will enable you to /// example of how to document methods, navigate to the Classes page and find the entry for Doxygenized /// along with their parameters and along with the text that followed @brief. @brief is a command /// return value. that instructs Doxygen to use the next paragraph of comment bool isDocumented(int aParameter) { text as a short description for display in the class list. return true; } ADDING A DETAILED DESCRIPTION Now that I’ve given a brief description for the class list, it The Doxygenized class reference now contains a Public would be nice to have a more comprehensive description so Member Functions section where the method and brief the next poor programmer who gets stuck in this code can description appear. There is also a Member Function figure out what the class does. A detailed description can be Documentation section with a verbose entry for isDocumented added by using an empty documentation comment followed that includes the detailed description. by a documentation block containing an arbitrary amount of In order to make the documentation more descriptive, the descriptive text: return type and parameter(s) can be documented explicitly, expanding the documentation block for isDocumented as such: /// @brief A documented C++ class! /// /// @brief A documented method /// The Doxygenized class serves as a demonstration /// /// of how to document C++ code using Doxygen /// The isDocumented method serves as an class Doxygenized { /// example of how to document methods, }; /// along with their parameters and /// return value. Upon re-running Doxygen, the user can follow the Doxygenized /// @return Always returns true, because this link in the class list to a class reference page that includes the /// is a contrived example detailed description. /// @param aParameter A documented method /// parameter. This parameter is not actually DOCUMENTING METHODS AND FUNCTIONS /// used. Its only purpose in life is to be Now that I’ve shown a reference page for Doxygenized, let’s see ///documented what happens when a method with its own brief and detailed bool isDocumented(int aParameter) { descriptions is added. return true; } Launching an MMO is a complex process. It requires skill and great fortitude, sprinkled with optimism. Each decision is dependent on the next. Before your MMO hits the crowd, the work begins to make sure your big idea is both well designed and well coded. It also has to be technically capable of coping with several thousands of concurrent players – if not, something that appears to be a minor technical issue in the beginning, can lead to a catastrophe once your game is launched. Get Help at XXX..0IPTQJUBMPSH Because you only get one chance. 00810gd_toolbox_vIjf.indd810gd_toolbox_vIjf.indd 4444 99/17/08/17/08 33:05:15:05:15 PPMM When the documentation is rebuilt, the Returns and the Doxyfile or using Doxywizard can Parameters sections can be found in isDocumented’s detailed override this behavior. description which, predictably, includes the descriptions provided for the parameter and return value. A WORD ABOUT DOXYGEN COMMANDS DOCUMENTING FIELDS Now that I’ve shown several Doxygen AND ENUMERATIONS commands, using commands and their When documenting class fields and enumerators, the parameters will be straightforward brief/detailed description pattern used in the previous and even obvious from here on out. For examples works perfectly fine. However, Doxygen also offers the sake of completeness, I will briefly A detailed function shorthand for placing a brief description on the same line as describe the conventions used by Doxygen’s manual, which I description. a declaration. will use when introducing additional commands. As I’ve already shown, commands begin with @ and have Add the following to the body of Doxygenized: one or more parameters. In Doxygen’s manual, the following conventions are used to describe parameters: /// @brief A documented enumeration! • If the parameter is enclosed in angle brackets /// (“<parameter>”) it consumes a single word. /// An example of documenting an enumeration • If the parameter is enclosed in parenthesis (“(parameter)”) /// and its members using the shorthand for it consumes text until the end of the line. /// placing documentation inline with • If the parameter is enclosed in curly brackets /// declarations (“{parameter}”) it consumes text until the end of the enum eNumbers { next paragraph, paragraphs being delimited by a blank kOne, ///< The number One comment line. kTwo, ///< The number Two • If square brackets are used as a modifier (“[{parameter}]”), kThree ///< The Number Three the parameter is optional. }; Note that these conventions only apply to how parameters int aField; ///< An example documented field are described in Doxygen’s manual, not to the arguments supplied by the developer when commenting. In the Rebuilding now will produce Public Types and Public Attributes preceding example, I used the @parameter command, sections in the Doxygenized class reference, plus a detailed which has the description @parameter <parameter-name> documentation section for eNumbers that contains the { parameter description }, to tell Doxygen which function descriptions of the enumerators. This method of providing parameter is being documented and provide a paragraph of documentation on the same line as declarations keeps headers descriptive text. Similarly, the @return command has the streamlined, and comes in handy when developers don’t feel form @return { description of return value } and uses the need to write a treatise. the paragraph that follows it as a description of possible Also note that by default Doxygen only includes public and return values. protected members in the documentation, although editing "NJOPSJTTVFDBOUVSOJOUPBTFSJPVTOJHIUNBSFJOUIFFOE CASE #623342627872

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us