Total Complexity | 2 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ |
||
2 | * PyDMXControl: A Python 3 module to control DMX using uDMX. |
||
3 | * Featuring fixture profiles, built-in effects and a web control panel. |
||
4 | * <https://github.com/MattIPv4/PyDMXControl/> |
||
5 | * Copyright (C) 2018 Matt Cowley (MattIPv4) ([email protected]) |
||
6 | """ |
||
7 | |||
8 | import pygame |
||
9 | |||
10 | from ._Part import Part |
||
11 | from .._screen import Screen |
||
12 | |||
13 | |||
14 | class Pipe(Part): |
||
15 | |||
16 | def __init__(self, size: int, x: int, y: int, rotation: int = 0): |
||
17 | super().__init__() |
||
18 | self.__rotation = rotation |
||
19 | self.__length = size |
||
20 | self.set_pos(x, y) |
||
21 | |||
22 | def design_render(self, screen: Screen): |
||
23 | # Create the surface |
||
24 | surface = pygame.Surface((self.__length * screen.block_size, screen.block_size)) |
||
25 | surface.fill([80] * 3) |
||
26 | |||
27 | # Rotate |
||
28 | surface = pygame.transform.rotate(surface, self.__rotation) |
||
29 | |||
30 | # Render |
||
31 | screen.screen.blit(surface, (self._x * screen.block_size, self._y * screen.block_size)) |
||
32 |