Esempio n. 1
0
    def draw(self):
        width = 20
        height = 100

        imgui.begin(self.title)
        changed, self.value = imgui.v_slider_int("vertical slider int",
                                                 width,
                                                 height,
                                                 self.value,
                                                 min_value=0,
                                                 max_value=100,
                                                 format="%d")
        imgui.text("Changed: %s, Values: %s" % (changed, self.value))
        imgui.end()
Esempio n. 2
0
    def draw(self):
        width = 20
        height = 100

        imgui.set_next_window_size(160, 160, imgui.ONCE)

        imgui.begin("Sin")
        self.mark_output(self.output)
        changed, self.value = imgui.v_slider_int("output",
                                                 width,
                                                 height,
                                                 self.value,
                                                 min_value=0,
                                                 max_value=100,
                                                 format="%d")
        imgui.end()
Esempio n. 3
0
    def draw(self):
        width = 20
        height = 100

        imgui.set_next_window_size(160, 160, imgui.ONCE)

        imgui.begin("Volume")

        changed, self.value = imgui.v_slider_int(
            "volume",
            width, height, self.value,
            min_value=0, max_value=100,
            format="%d"
        )
        imgui.same_line(spacing=16)
        self.begin_output(self.output)
        imgui.button('output')
        self.end_output()

        imgui.end()
Esempio n. 4
0
    def draw(self):
        width = 20
        height = 100

        imgui.set_next_window_size(160, 160, imgui.ONCE)

        imgui.begin("Sin")
        imgui.begin_group()
        changed, self.value = imgui.v_slider_int(
            "value",
            width, height, self.value,
            min_value=0, max_value=100,
            format="%d"
        )
        imgui.end_group()
        imgui.same_line(spacing=16)
        imgui.begin_group()
        imgui.text('output')
        self.mark_output(self.output)
        imgui.end_group()
        imgui.end()
Esempio n. 5
0
def render_color_editor(orig, color):
    r, g, b, a = color

    io = imgui.get_io()

    delta = 0
    imgui.push_id("R")
    # TODO find a less verbose way to do something like this:
    # imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND, r/255, 0, 0)
    # imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND_HOVERED, r/255, 0, 0)
    # imgui.push_style_color(imgui.COLOR_FRAME_BACKGROUND_ACTIVE, r/255, 0, 0)
    # imgui.push_style_color(imgui.COLOR_SLIDER_GRAB, 1, 1, 1)
    # imgui.push_style_color(imgui.COLOR_SLIDER_GRAB_ACTIVE, 1, 1, 1)
    _, r = imgui.v_slider_int("", 30, 255, r, min_value=0, max_value=255)
    # imgui.pop_style_color()
    # imgui.pop_style_color()
    # imgui.pop_style_color()
    # imgui.pop_style_color()
    # imgui.pop_style_color()
    if imgui.is_item_hovered():
        delta = int(io.mouse_wheel)
        if not io.key_shift:
            r = _change_channel(r, delta)
    imgui.pop_id()
    imgui.same_line()
    imgui.push_id("G")
    _, g = imgui.v_slider_int("", 30, 255, g, min_value=0, max_value=255)
    if imgui.is_item_hovered():
        delta = int(io.mouse_wheel)
        if not io.key_shift:
            g = _change_channel(g, delta)
    imgui.pop_id()
    imgui.same_line()
    imgui.push_id("B")
    _, b = imgui.v_slider_int("", 30, 255, b, min_value=0, max_value=255)
    if imgui.is_item_hovered():
        delta = int(io.mouse_wheel)
        if not io.key_shift:
            b = _change_channel(b, delta)
    imgui.pop_id()

    if delta and io.key_shift:
        r = _change_channel(r, delta)
        g = _change_channel(g, delta)
        b = _change_channel(b, delta)

    if imgui.checkbox("Transp.", a == 0)[1]:
        a = 0
    else:
        a = 255

    imgui.color_button("Current color", *as_float(orig))
    imgui.same_line()
    imgui.text("->")
    imgui.same_line()
    imgui.color_button("Current color", *as_float(color))

    if imgui.button("OK"):
        imgui.close_current_popup()
        return True, False, (r, g, b, a)
    imgui.same_line()
    if imgui.button("Cancel"):
        imgui.close_current_popup()
        return False, True, (r, g, b, a)
    return False, False, (r, g, b, a)