src/colors.h

Sun, 19 Jan 2020 02:54:48 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 19 Jan 2020 02:54:48 +0200
changeset 22
6da867fa5429
parent 21
0133e565e072
child 24
1a0faaaceb84
permissions
-rw-r--r--

commit work on GL rendering

3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "main.h"
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 struct Color
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 qint32 index;
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 };
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8
21
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
9 inline bool operator==(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
10 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
11 return one.index == other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
12 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
13
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
14 inline bool operator!=(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
15 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
16 return one.index != other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
17 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
18
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
19 inline bool operator<(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
20 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
21 return one.index < other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
22 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
23
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
24 inline bool operator<=(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
25 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
26 return one.index <= other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
27 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
28
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
29 inline bool operator>(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
30 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
31 return one.index > other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
32 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
33
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
34 inline bool operator>=(const Color& one, const Color& other)
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
35 {
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
36 return one.index >= other.index;
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
37 }
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
38
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 namespace colors
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 static constexpr Color black {0};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 static constexpr Color blue {1};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 static constexpr Color green {2};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 static constexpr Color red {4};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 static constexpr Color yellow {14};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 static constexpr Color white {15};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 static constexpr Color main {16};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 static constexpr Color edge {24};
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 }

mercurial