-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodingRules.txt
executable file
·59 lines (47 loc) · 3.09 KB
/
CodingRules.txt
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
----CODING RULES:----
1) When starting a new curly brace, start on same line, and end curly should be at same level as the line which started it. EG:
if(some_statement){
code_goes_here();
}
2) When using if-statements, even for single statements, always use curly braces. No letting any confusing sameline ifs.
DO THIS:
if(some_statement){
single_line();
}
NOT THIS:
if(some_statement) do_this();
NOR THIS:
if(some_statement)
do_this();
3) camelCase or under_score is acceptable, but be consistent in a sourcefile.
4) Source files are also known as Modules, and Directories are Systems. Subdirectories are thus subsystems.
5) Feel free to use Global Variables, but ONLY if they are static and in a single file/module. The only exception to this rule will be main.c and the entire game directory/system, since they are all a tightlybound subsystem anyway.
----REGARDING GenericList.h----
DO NOT USE IT. Instead, Use Collections-C/src/list.h. It's a lot more robust, and better in every way.
_deprecated_
When defining a list, use define_list(item), but only use it where the list you are defining the item to have a list made out of it. Thatway, to use a list of that type, you only have to import the item.h file.
When defining a type, it has to be one word. So if the type is a struct, enum, or other sort of multi-word types, you need to typedef them.
_end_
----REGARDING COLORS----
Since Ncurses allows us to use the colors on the terminal, colors need to be
paired and maped to integers. The Following is that mapping:
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|F/B |BLACK |RED |GREEN |YELLOW |BLUE |MAGENTA|CYAN |WHITE |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|BLACK |01 |02 |03 |04 |05 |06 |07 |08 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|RED |09 |10 |11 |12 |13 |14 |15 |16 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|GREEN |17 |18 |19 |20 |21 |22 |23 |24 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|YELLOW |25 |26 |27 |28 |29 |30 |31 |32 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|BLUE |33 |34 |35 |36 |37 |38 |39 |40 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|MAGENTA|41 |42 |43 |44 |45 |46 |47 |48 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|CYAN |49 |50 |51 |52 |53 |54 |55 |56 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|WHITE |57 |58 |59 |60 |61 |62 |63 |64 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+
While Modern Curses does support up to 256 Colors, Not every terminal does, so the basic 8x8 color pairings will hold until further notice.