Style guide notes.

This commit is contained in:
Ben Vanik 2014-07-11 18:49:49 -07:00
parent 8a6807bd92
commit 840357413c
3 changed files with 49 additions and 9 deletions

View File

@ -20,7 +20,7 @@ that.
## Status
* Some code runs. [Insert any game name here] doesn't.
* Some code runs. [Insert any game name here] doesn't. Except Frogger 2. Yep.
* Asserts! Crashes! Hangs! Blank screens!
## Disclaimer
@ -47,7 +47,8 @@ update gyp files/etc.
## Building
See [building](docs/building.md) for setup and information about the
`xenia-build` script.
`xenia-build` script. When writing code, check the [style guide](docs/style_guide.md)
and be sure to clang-format!
## Contributors Wanted!
@ -55,16 +56,10 @@ Have some spare time, know advanced C++, and want to write an emulator?
Contribute! There's a ton of work that needs to be done, a lot of which
is wide open greenfield fun.
That said, the project is currently undergoing a lot of major foundational
development and core pieces are changing rapidly and poorly documented.
It'll be difficult to casually hack things in unless you know what you're
doing.
Fixes and optimizations are always welcome (please!), but in addition to
that there are some major work areas still untouched:
* Help work through missing functionality/bugs in game [compat](https://github.com/benvanik/xenia/issues?labels=compat)
* Write an [OpenGL driver](https://github.com/benvanik/xenia/issues/59)
* Add input drivers for [OSX](https://github.com/benvanik/xenia/issues/61) and [PS4 controllers](https://github.com/benvanik/xenia/issues/60) (or anything else)
* Start [hacking on audio](https://github.com/benvanik/xenia/issues/62)
* Build a [virtual LIVE service](https://github.com/benvanik/xenia/issues/64)

View File

@ -44,7 +44,7 @@ keypresses:
#### setup
Run this on initial checkout to pull down all dependencies and setup LLVM.
Run this on initial checkout to pull down all dependencies and submodules.
xb setup

45
docs/style_guide.md Normal file
View File

@ -0,0 +1,45 @@
# Style Guide
The style guide can be summed up as 'clang-format with the Google style set'.
In addition, the [Google Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml)
is followed and cpplint is the source of truth.
Base rules:
* 80 column line length max
* LF (Unix-style) line endings
* 2-space soft tabs, no TABs!
* [Google Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) for naming/casing/etc
Code that really breaks from the formatting rules will not be accepted, as then
no one else can use clang-format on the code without also touching all your
lines.
## Tools
### clang-format
clang-format with the Google style is used to format all files. I recommend
installing/wiring it up to your editor of choice so that you don't even have to
think about tabs and wrapping and such.
#### Visual Studio
Grab the official [experimental Visual Studio plugin](http://llvm.org/builds/).
To switch to the Google style go Tools -> Options -> LLVM/Clang -> ClangFormat
and set Style to Google. Then use ctrl-r/ctrl-f to trigger the formatting.
Unfortunately it only does the cursor by default, so you'll have to select the
whole doc and invoke it to get it all done.
If you have a better option, let me know!
#### Xcode
Install [Alcatraz](http://alcatraz.io/) to get the [ClangFormat](https://github.com/travisjeffery/ClangFormat-Xcode)
package. Set it to use the Google style and format on save. Never think about
tabs or linefeeds or whatever again.
### cpplint
TODO(benvanik): write a cool script to do this/editor plugins.
In the future, the linter will run as a git commit hook and on travis.