Пример #1
0
    def __init__(self):
        pos = (renderer.mid[0], renderer.mid[1])
        font = typing.retro_8x10
        message = 'button text'
        super().__init__(pos, font, 'standard button')
        self.message = message
        self.size_x = (typing.fonts[font][typing.size_x] + 5) * len(message)
        self.hit_box = HitBox(0, 0, 0, 0)

        self.selected_colour = colour.Colour((200, 200, 200))
        self.outside_colour = colour.Colour((180, 180, 180))
        self.inside_colour = colour.Colour(renderer.background_colour)
Пример #2
0
    def __init__(self):
        pos = (renderer.mid[0], renderer.mid[1])
        font = typing.retro_8x10

        super().__init__(pos, font, 'switch button')

        self.states = ['Type 1', 'Type 2']  # list of messages
        self.current_state = 0  # number to start on
        self.number_of_states = len(self.states)

        self.size_x = 0
        self.hit_box = HitBox(0, 0, 0, 0)

        self.selected_colour = colour.Colour((200, 200, 200))
        self.outside_colour = colour.Colour((180, 180, 180))
        self.inside_colour = colour.Colour(renderer.background_colour)
Пример #3
0
    def __init__(self):
        pos = renderer.mid
        font = typing.retro_8x10

        initial_message = 'text box'
        max_length = len(initial_message)
        self.message = initial_message
        self.initial_message = initial_message

        super().__init__(pos, font, 'text box')

        self.size_x = (typing.fonts[font][typing.size_x] + 5) * max_length
        self.hit_box = HitBox(
            self.x - self.size_x / 2 - 5, self.y - typing.fonts[self.font][typing.size_y] / 2 - 5, self.size_x + 10,
            typing.fonts[self.font][typing.size_y] + 10)

        self.selected_colour = colour.Colour((200, 200, 200))
        self.outside_colour = colour.Colour((180, 180, 180))
        self.inside_colour = colour.Colour(renderer.background_colour)

        self.selected = False
        self.max_length = max_length
Пример #4
0
def get_average(c0, c1, c2):
    red = (c0.red + c1.red + c2.red) / 3
    green = (c0.green + c1.green + c2.green) / 3
    blue = (c0.blue + c1.blue + c2.blue) / 3
    return colour.Colour(red, green, blue)
Пример #5
0
def get_current_colour(bus):
    current_values = get_current_rgb_values(bus)
    return colour.Colour(values[0], values[1], values[2])