-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathcommon_types.py
More file actions
45 lines (31 loc) · 1.07 KB
/
common_types.py
File metadata and controls
45 lines (31 loc) · 1.07 KB
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
"""Module containing types that are common to other modules."""
# pylint: disable=too-few-public-methods
from typing import NamedTuple
class Color(NamedTuple):
"""Represents an RGBA color value as a four value Tuple.
Attributes:
red: Red value, between 0 and 255.
green: Green value, between 0 and 255.
blue: Blue value, between 0 and 255.
alpha: Alpha value, between 0 and 255.
"""
red: int
green: int
blue: int
alpha: int
class Size(NamedTuple):
"""Represents a two dimensional size as a two value Tuple.
Attributes:
width: The width of the object. Can be in either pixels or number of tiles.
height: The height of the object. Can be in either pixels or number of tiles.
"""
width: float
height: float
class OrderedPair(NamedTuple):
"""Represents a two dimensional position as a two value Tuple.
Attributes:
x: X coordinate. Can be in either pixels or number of tiles.
y: Y coordinate. Can be in either pixels or number of tiles.
"""
x: float
y: float