Wiki Page Content

Differences between revisions 9 and 10
Revision 9 as of 2011-02-03 21:51:42
Size: 3438
Editor: SheenaSmith
Comment: minor change
Revision 10 as of 2011-02-04 20:53:56
Size: 4320
Editor: SheenaSmith
Comment: update formatting
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
'''The Code Examples section should provide simple examples of real-world applications of the API.''' ''The Code Examples section should provide simple examples of real-world applications of the API.''
Line 16: Line 16:
Please post code examples showing how you have used the API that may benefit other users. '''Please post code examples showing how you have used the API that may benefit other users.
Line 18: Line 18:
 * Code examples should have adequate comments to make them clear and useful.
 * Please remember to keep it simple and easy to understand.'''
<<BR>>
<<BR>>
<<BR>>
== Adding Your Code Examples ==
 1. Begin by going to the page you wish to edit and selecting <<Color2(blue,Edit (Text))>> or <<Color2(blue,Edit (GUI))>> in the left column to begin editing.
  ~-Reminder: Markup info provided here is specifically for use in the Text editor but should work in both.-~
 1. Scroll down in the edit window to the section that begins with {{{== Code Examples ==}}}. Add your content below this header following the conventions in this style guide.
 1. Find information relevant to your content in the style guide sections [[#formatting|below]] and apply the appropriate formatting as you create your content.
 1. Preview your work as you go by clicking <<Color2(blue,Preview)>> in the left column.
 1. Save your work when you are satisfied with your edits by clicking <<Color2(blue,Save Changes)>> in the left column.
For additional assistance with editing, saving, or wiki-appropriate markup see the [[http://wiki.libsdl.org/moin.cgi/SGWikiBasics|Wiki Basics]] Style Guide.
<<BR>>
<<BR>>
<<BR>>
<<Anchor(formatting)>>
== Formatting Your Code Examples ==
Line 19: Line 37:
 * Code examples should have adequate comments to make them clear and useful.

 * Please remember to keep it simple and easy to understand.

For assistance with editing, saving, or wiki-appropriate markup see the [[http://wiki.libsdl.org/moin.cgi/SGWikiBasics|Wiki Basics]] Style Guide.


== Adding Your Code Examples ==
Place your code example in the {{{== Code Examples ==}}} section:
||<width="30%" bgcolor="#EDEDED">If...||<bgcolor="#EDEDED">Then...||
||<|2>your code example is the __first on the page__||replace the following with your code<<BR>>{{{You can add your code example here}}}||
||Note: Do not change or remove any of the markup immediately above or below that line||
||<|4>there are __existing code examples__ on the page||add a new code box with your code to the end of the Code Examples section,<<BR>>or to a related grouping if there are existing code examples covering the same topic||
=== Location ===
||<( |3 30%>''If'' your code example is the __first on the page__||''Action'': Replace the following text with your code<<BR>>{{{You can add your code example here}}}||
||''Note'': Do not change or remove any of the markup immediately above or below that line||
||''Example'': [[SDL_StopTextInput]]()<<BR>> ~-(Code Examples were empty at the time this was selected.-~)||
||<( |4>''If'' there are __existing code examples__ on the page||''Action'': Add a new code box with your code to the end of the Code Examples section, or to a related grouping if there are existing code examples covering the same topic||
Line 33: Line 43:
||<<MiniPage({{{#!highlight cpp<<BR>><<BR>>}}})>>|| ||''Note'': Do not change or remove any of the existing content.||
Line 35: Line 45:

For more information on markup see the [[http://wiki.libsdl.org/moin.cgi/SGWikiBasics|Wiki Basics]] Style Guide.

DRAFT

Style Guide: Code Examples

All API pages in this wiki contain a section for code examples. This guide provides instructions for adding your own content to the Code Examples section of these pages.

General Guidelines

The Code Examples section should provide simple examples of real-world applications of the API.

Please post code examples showing how you have used the API that may benefit other users.

  • Do not post anything that you do not have permission to post publicly.
  • Code examples should have adequate comments to make them clear and useful.
  • Please remember to keep it simple and easy to understand.




Adding Your Code Examples

  1. Begin by going to the page you wish to edit and selecting blue

    or blue in the left column to begin editing.

    • Reminder: Markup info provided here is specifically for use in the Text editor but should work in both.

  2. Scroll down in the edit window to the section that begins with == Code Examples ==. Add your content below this header following the conventions in this style guide.

  3. Find information relevant to your content in the style guide sections below and apply the appropriate formatting as you create your content.

  4. Preview your work as you go by clicking blue in the left column.

  5. Save your work when you are satisfied with your edits by clicking blue in the left column.

For additional assistance with editing, saving, or wiki-appropriate markup see the Wiki Basics Style Guide.


Formatting Your Code Examples

Location

If your code example is the first on the page

Action: Replace the following text with your code
You can add your code example here

Note: Do not change or remove any of the markup immediately above or below that line

Example: SDL_StopTextInput()
(Code Examples were empty at the time this was selected.)

If there are existing code examples on the page

Action: Add a new code box with your code to the end of the Code Examples section, or to a related grouping if there are existing code examples covering the same topic

Markup: Insert the following into the spot where your example will be located and place your content on the blank line between the markup:
{{{#!highlight cpp

}}}

Note: Do not change or remove any of the existing content.

Example: SDL_Init()

Return to Table of Contents


Resources

Our goal is to create accurate, consistent, helpful, user-friendly documentation. We appreciate your efforts to make your additions fit into the existing framework and retain the same look and feel as much as possible.

If you have questions that aren't addressed here:

  1. Search for another page that contains something similar to what you want to do and copy all the basics as much as applicable.
  2. Check the other SDL Style Guides.

  3. Post a question to Feedback and include a way to contact you.

  4. Post a question to the Mailing List

  5. Send a comment or question to <ANTI SPAM wiki AT libsdl DOT org> for clarification.

If you have suggestions for changes or additions to this document or any other portion of the wiki please don't hesitate to contact us with your thoughts. We are happy to have the participation!


Disclaimer

All content modifications are subject to review for consistency and quality. We reserve the right to remove or modify any content added to this wiki at any time. You may direct questions or concerns to <ANTI SPAM wiki AT libsdl DOT org>.

None: SGCodeExamples (last edited 2011-12-15 22:23:14 by SheenaSmith)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit