Skip to content
greenboxal edited this page Nov 20, 2012 · 6 revisions

Those guidelines must be respected when coding any official content, if you disagree with something drop me a message so we can discuss about it.

C++ Code

All C++ code should follow Allman Style with four spaces for indentation(tabs are not acceptable).

Each library uses just one namespace(e.g.: YADE, fclient, Awesomium) except when really needed like isolating some enumeration.

Classes, functions and public fields are CamelCase. Private fields are _CamelCase. Variables and arguments are camelCase or we_love_underscore. All fields that have default getters/setters should use the macros from YA3DE/Helpers.h.

/* That long GNU GPLv3 header */

#include <our headers>
#include <YA3DE/Helpers.h>

int ourGlobalVar = 1337;
static int our_static_variables;

namespace OurLib
{
    class OurClass
    {
    public:
        int Run()
        {
            return ourGlobalVar;
        }

        DEFPROP_RW(public, int, SomeProperty);

    private:
        int _ReallyPrivateField;
    }
};

int void main(int argc, char **argv)
{
    OurLib::OurClass instance;
    return instance.Run();
}

GUI

FimbulwinterClient uses a Awesomium, a hacked source of Chrominium that can be used to render pages in any application.

All WebKit extensions that are compatible with Chrome 18 can be used in CSS(-webkit-). All HTML5 elements compatible with Chrome 18 can be used. Don't use flash or the tag.

HTML Code

All HTML code should use two or four spaces(tabs are not acceptable) for indentation(preserve original indentation if editing some file) and should follow HTML5 rules strictly.

<!DOCTYPE HTML>
<html>
  <head>
    <title>Fimbulwinter Client</title>
  </head>
  <body>
    <p>Hello world!</p>
  </body>
</html>

CSS Code

CSS should be indented using four spaces with one selector per line and one line between each element.

html {
    margin: 0;
    padding: 0;
}

body {
    background: transparent;
}

JavaScript

JavaScript should be written using K&R style with four spaces for indentation, no tabs.

var ourInput = $("#superInput");

if (ourInput.value() == "thepassword")
    $("#status").innerHtml("WIN!");
Clone this wiki locally