development:player:code-formatting-conventions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
development:player:code-formatting-conventions [2011/09/25 16:47] – fdelapena | development:player:code-formatting-conventions [2013/06/30 23:40] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 15: | Line 15: | ||
Braces in your code should look like the following example: | Braces in your code should look like the following example: | ||
- | < | + | < |
[...] | [...] | ||
} | } | ||
Line 34: | Line 34: | ||
==Conventional operators surrounded by a space character== | ==Conventional operators surrounded by a space character== | ||
- | < | + | < |
==C++ reserved words separated from opening parentheses by a white space== | ==C++ reserved words separated from opening parentheses by a white space== | ||
- | < | + | < |
==Commas followed by a white space== | ==Commas followed by a white space== | ||
- | < | + | < |
- | < | + | < |
==Semicolons followed by a space character, if there is more on a line== | ==Semicolons followed by a space character, if there is more on a line== | ||
- | < | + | < |
- | < | + | < |
==When declaring class inheritance and in a ? construct, colons should be surrounded by white space== | ==When declaring class inheritance and in a ? construct, colons should be surrounded by white space== | ||
- | < | + | < |
- | < | + | < |
==Array delete operator has no whitespace before []== | ==Array delete operator has no whitespace before []== | ||
- | < | + | < |
==STD library and <>== | ==STD library and <>== | ||
No whitespaces before or after <, and whitespaces only after >. | No whitespaces before or after <, and whitespaces only after >. | ||
- | < | + | < |
- | < | + | < |
==Operator overloading== | ==Operator overloading== | ||
Operator keyword is not separated from the name, except for type conversion operators where it is required. | Operator keyword is not separated from the name, except for type conversion operators where it is required. | ||
- | < | + | < |
void operator()() { | void operator()() { | ||
// ... | // ... | ||
Line 73: | Line 73: | ||
==Pointers and casts== | ==Pointers and casts== | ||
No whitespace after a cast; and in a pointer, we write a whitespace after it but not before it. Consider " | No whitespace after a cast; and in a pointer, we write a whitespace after it but not before it. Consider " | ||
- | < | + | < |
==References== | ==References== | ||
Unlike pointers, use a whitespace before the "&" | Unlike pointers, use a whitespace before the "&" | ||
- | < | + | < |
int &ref = i;</ | int &ref = i;</ | ||
- | < | + | < |
====Switch / Case constructs==== | ====Switch / Case constructs==== | ||
---- | ---- | ||
- | < | + | < |
case 0: // New Game | case 0: // New Game | ||
CommandNewGame(); | CommandNewGame(); | ||
Line 98: | Line 98: | ||
==Constants== | ==Constants== | ||
All upper case, with underscores as name separators, but no leading/ | All upper case, with underscores as name separators, but no leading/ | ||
- | < | + | < |
'' | '' | ||
- | < | + | < |
#define _WINDOW_COMMAND_H_</ | #define _WINDOW_COMMAND_H_</ | ||
==Type names== | ==Type names== | ||
We use RPG Maker XP/VX RGSS and scripts as our API base. Normally classes should be named in UpperCamelCase, | We use RPG Maker XP/VX RGSS and scripts as our API base. Normally classes should be named in UpperCamelCase, | ||
- | < | + | < |
class Game_CommonEvent { | class Game_CommonEvent { | ||
class Window_MenuStatus : public Window_Selectable { | class Window_MenuStatus : public Window_Selectable { | ||
Line 112: | Line 112: | ||
==Functions== | ==Functions== | ||
Functions should be UpperCamelCase. | Functions should be UpperCamelCase. | ||
- | < | + | < |
Property methods should start with Get or Set: | Property methods should start with Get or Set: | ||
- | < | + | < |
public: | public: | ||
int GetThatInt() { return that_int; } | int GetThatInt() { return that_int; } | ||
Line 124: | Line 124: | ||
==Variables== | ==Variables== | ||
Variables should be lower case with underscores as word separators. | Variables should be lower case with underscores as word separators. | ||
- | < | + | < |
====Headers includes==== | ====Headers includes==== | ||
---- | ---- | ||
Use the following format: | Use the following format: | ||
- | < | + | < |
// Headers | // Headers | ||
//////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////// |
development/player/code-formatting-conventions.txt · Last modified: 2015/10/03 09:54 by 127.0.0.1