Passed
Push — design ( fcd95c )
by Matt
02:23
created

Pipe.design_render()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 2
dl 0
loc 10
rs 10
c 0
b 0
f 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