forked from juzzlin/Heimer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCONTRIBUTING
154 lines (101 loc) · 3.21 KB
/
CONTRIBUTING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Contribution "instructions"
===========================
All kinds of contributions are welcome: bug fixes, graphics, new tracks, translations..
E-mail: jussi.lind@iki.fi
Getting the up-to-date source
-----------------------------
git clone https://github.com/juzzlin/Heimer.git
- master branch has the currently released stuff and is stable.
Editor
------
Make your changes against the master branch.
If you have fixed a bug or modified the game in some other acceptable way,
I most likely want to receive the changes as a GitHub pull request
OR
as a Git patch (make a commit of your changes in your working branch,
and then make a patch "git diff master > your_change.patch").
Please follow the existing coding style. Some examples and conventions below.
Adding/updating translations
----------------------------
Qt's translation source files for the editor are at:
src/translations/
You can just copy these files as a new locale and edit, but the recommended way is
to generate/update the file from source code to make sure that the source strings
are up-to-date:
$ lupdate src/*.cpp -ts src/translations/heimer_fr.ts
..as an example for French.
The .ts-files can then be opened in Qt's translation GUI, linguist.
$ linguist src/translations/heimer_fr.ts
For Qt5, the Ubuntu package for these tools is qttools5-dev-tools.
After updating the strings, create the .qm file:
$ lrelease src/translations/heimer_fr.ts -qm data/translations/heimer_fr.qm
In the case of a new locale, the new .qm file needs to be added under `data/translations` and
`data/translations/translations.qrc` needs to be modified so that the new .qm file is included.
Remember to TEST the translations. Heimer needs to be rebuilt after a .qm file is updated.
The editor and the game can be forced to given lang:
$ << In your build dir >> ./heimer --lang fr
Coding style examples
---------------------
Some conventions:
* Avoid useless comments and temp variables
* C++11 standard
* camelCase naming convention for members
* Indentation with 4 spaces
* No copy-paste code
* No public/protected member variables allowed, only private variables with getters/setters
* PascalCase naming convention for class names, namespaces, and enums
* Prefer references and smart pointers
* Use const always when possible
* Use auto
Class header example:
#ifndef MYFOOCLASS_HPP
#define MYFOOCLASS_HPP
class MyFooClass : public MyBase
{
public:
enum class MyEnum
{
This,
That
};
MyFooClass();
virtual ~MyFooClass();
bool someMember() const;
void setSomeMember(bool someMember);
protected:
void myMethod1();
private:
void myMethod2();
bool m_someMember;
int * m_somePointer;
};
typedef std::shared_ptr<MyFooClass> MyFooClassPtr;
#endif // MYFOOCLASS_HPP
Class source example:
#include "myfooclass.hpp"
namespace {
static const int MAX_CARS = 10;
}
MyFooClass::MyFooClass()
: m_someMember(false)
, m_somePointer(nullptr)
{
if (something())
{
for (int i = 0; i < MAX_CARS; i++)
{
doSomething(i);
}
}
}
bool MyFooClass::someMember() const
{
return m_someMember;
}
void setSomeMember(bool someMember)
{
m_someMember = someMember;
}
MyFooClass::~MyFooClass()
{
}