コード例 #1
0
    def draw(self):
        imgui.begin(self.title)

        for i in range(10):
            imgui.bullet()

        imgui.end()
コード例 #2
0
ファイル: coloredit4.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: color edit with alpha")

        # note: first element of return two-tuple notifies if the color was changed
        #       in currently processed frame and second element is current value
        #       of color and alpha
        _, self.color = imgui.color_edit4("Alpha",
                                          *self.color,
                                          show_alpha=True)
        _, self.color = imgui.color_edit4("No alpha",
                                          *self.color,
                                          show_alpha=False)

        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #3
0
ファイル: fontimage.py プロジェクト: kfields/arcade-imgui
 def draw(self):
     imgui.begin("Image example")
     texture_id = imgui.get_io().fonts.texture_id
     draw_list = imgui.get_window_draw_list()
     draw_list.add_image(texture_id, (128, 64), (512, 256),
                         col=imgui.get_color_u32_rgba(0.5, 0.5, 1, 1))
     imgui.end()
コード例 #4
0
    def update(self):
        bitmap = self._renderer.bitmap
        if bitmap is None:
            return

        imgui.begin("Tiny Renderer")

        imgui.image(bitmap.get_texture_id(), bitmap.get_width(),
                    bitmap.get_height())
        imgui.end()

        imgui.begin("Rendering")
        _, self._render_mode = imgui.combo("Rendering Mode", self._render_mode,
                                           self._render_mode_captions)
        _, self._light_mode = imgui.combo("Lighting Mode", self._light_mode,
                                          self._light_mode_captions)

        imgui.separator()
        if imgui.button("Render"):
            t = time.time()
            self.on_click_render()
            self._time_to_render = time.time() - t

        imgui.label_text("", f"Time to render: {self._time_to_render: .2f}s")
        imgui.separator()

        imgui.end()
コード例 #5
0
    def __enter__(self):
        glClearColor(0, 1, 0, 0)

        while not glfw.window_should_close(self.window):
            cur_time = glfw.get_time()
            elapsed = cur_time - self.prev_time
            self.prev_time = cur_time

            glfw.poll_events()
            self.impl.process_inputs()

            self._process(elapsed)

            imgui.new_frame()

            imgui.set_next_window_position(0, 0)
            imgui.set_next_window_size(280, 180)

            imgui.begin("Uniforms", False, imgui.WINDOW_NO_RESIZE)

            imgui.push_item_width(-45)

            for cont in self.program.controls:
                cont.update()

            imgui.end()

            glClear(GL_COLOR_BUFFER_BIT)
            self._draw()

            imgui.render()
            self.impl.render(imgui.get_draw_data())

            glfw.swap_buffers(self.window)
コード例 #6
0
ファイル: popupmodal.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: simple popup modal")

        if imgui.button("Open Modal popup"):
            imgui.open_popup("select-popup")

        imgui.same_line()

        if imgui.begin_popup_modal("select-popup")[0]:
            imgui.text("Select an option:")
            imgui.separator()
            imgui.selectable("One")
            imgui.selectable("Two")
            imgui.selectable("Three")
            imgui.end_popup()

        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #7
0
ファイル: cocos2d.py プロジェクト: ymm000596/pyimgui
    def draw(self, *args, **kwargs):
        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True)

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
        imgui.text("Bar")
        imgui.text_colored("Eggs", 0.2, 1., 0.)
        imgui.end()

        gl.glClearColor(1., 1., 1., 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)

        imgui.render()
コード例 #8
0
    def render_ui(self, time, rotation, translation, model):
        imgui.new_frame()
        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", '', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        # imgui.show_test_window()
        imgui.begin("Custom window", True)
        value = self.slider_value
        changed, changed_value = imgui.slider_int(
            "slide ints", value,
            min_value=0, max_value=100,
            format="%d"
        ) 
        if changed:
            self.slider_value = changed_value
        imgui.text(string("time: \n", time))
        imgui.text(string("rotation: \n", rotation))
        imgui.text(string("translation: \n", translation))
        imgui.text(string("model = translation * rotation: \n", model))
        imgui.end()

        imgui.render()
        self.imgui.render(imgui.get_draw_data())
コード例 #9
0
    def render_ui(self):
        """Render the UI"""
        imgui.new_frame()
        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True)

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
        imgui.text("Bar")
        imgui.text_colored("Eggs", 0.2, 1., 0.)
        imgui.end()

        # Create window with the framebuffer image
        imgui.begin("Custom window with Image", True)
        # Create an image control by passing in the OpenGL texture ID (glo)
        # and pass in the image size as well.
        # The texture needs to he registered using register_texture for this to work
        imgui.image(self.fbo.color_attachments[0].glo, *self.fbo.size)
        imgui.end()

        imgui.render()
        self.imgui.render(imgui.get_draw_data())
コード例 #10
0
ファイル: dnd.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: drag and drop")

        imgui.button('source')
        if imgui.begin_drag_drop_source():
            imgui.set_drag_drop_payload('itemtype', b'payload')
            imgui.button('dragged source')
            imgui.end_drag_drop_source()

        imgui.button('dest')
        if imgui.begin_drag_drop_target():
            payload = imgui.accept_drag_drop_payload('itemtype')
            if payload is not None:
                print('Received:', payload)
            imgui.end_drag_drop_target()

        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #11
0
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: item groups")

        imgui.begin_group()
        imgui.text("First group (buttons):")
        imgui.button("Button A")
        imgui.button("Button B")
        imgui.end_group()

        imgui.same_line(spacing=50)

        imgui.begin_group()
        imgui.text("Second group (text and bullet texts):")
        imgui.bullet_text("Bullet A")
        imgui.bullet_text("Bullet B")
        imgui.end_group()

        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #12
0
 def __call__(self):
     _, show = imgui.begin("LOL", True)
     if not show:
         main_frame.s1 = False
     imgui.text("BarBar")
     imgui.text_colored("Eggs", 0.7, 0.4, 0.2)
     imgui.end()
コード例 #13
0
    def render_laptimer(self):
        _, self.lap_timer = imgui.begin("lap timer", True)
        if not self.lap_timer:
            imgui.end()
            return

        # _, self.startlinexy[0] = imgui.slider_float("start line x", self.startlinexy[0], 0, 20)
        # _, self.startlinexy[1] = imgui.slider_float("top lane y", self.startlinexy[0], 0, 10)
        x = self.controlstate[:, 0]
        y = self.controlstate[:, 1]
        lapidxs = np.nonzero((x[:-1] < self.startlinexy[0])
                             & (x[1:] > self.startlinexy[0])
                             & (y[1:] > self.startlinexy[1]))[0]

        n = 0
        for i in range(1, len(lapidxs)):
            if self.i < lapidxs[i]:
                break
            dt = self.ts[lapidxs[i]] - self.ts[lapidxs[i - 1]]
            n += 1
            imgui.text("Lap %d: %d.%03d" % (n, int(dt), 1000 * (dt - int(dt))))
        if self.i > lapidxs[0]:
            dt = self.ts[self.i] - self.ts[lapidxs[n]]
            imgui.text("Lap %d: %d.%03d" % (n + 1, int(dt), 1000 *
                                            (dt - int(dt))))
        imgui.set_scroll_here(1.0)
        imgui.end()
コード例 #14
0
    def render_timeline(self):
        imgui.begin("timeline")
        tstamp = self.frame['tstamp']
        if imgui.button("<"):
            self.playing = False
            if self.i > 0:
                self.loadframe(self.i - 1)
        imgui.same_line()
        if self.playing:
            if (self.i == len(self.ts) - 1) or imgui.button("stop"):
                self.playing = False
            elif time.time() >= self.ts[self.i + 1] - self.t0:
                self.nextframe()
        elif imgui.button("play"):
            self.playing = True
            self.t0 = tstamp - time.time()
        imgui.same_line()
        if imgui.button(">"):
            self.playing = False
            self.nextframe()
        tsfrac = tstamp - int(tstamp)
        tstring = time.strftime(
            "%H:%M:%S.", time.localtime(tstamp)) + "%02d" % (tsfrac * 100)
        imgui.same_line()
        imgui.text(tstring)

        w = imgui.get_window_width()
        imgui.image(self.frametexid, w, 480 * w / 640)

        changed, i = imgui.slider_int("frame", self.i, 0,
                                      self.scanner.num_frames() - 1)
        if changed:
            self.playing = False
            self.loadframe(i)
        imgui.end()
コード例 #15
0
    def render_ui(self):
        imgui.new_frame()

        imgui.begin("Description - Logistic map ", False)
        imgui.text("R: %.2f" % self.r)
        imgui.text("FPS: %.2f" % self.fps)
        imgui.text("==========================")
        imgui.text("The top picture shows the ")
        imgui.text("Bifurcation diagram of the Logistic map.")
        imgui.text("The bottom graph shows the first")
        imgui.text("64 values with x starting at 0,5.")
        imgui.text("For R > 3, the values in the population")
        imgui.text("will approach oscilation between two values")
        imgui.text("this later changes to 4, 8 etc. values.")
        imgui.text("At roughly R > 3.57 there are no longer")
        imgui.text("oscilations with a finite period,")
        imgui.text("with the exceptions of small islands")
        imgui.text("where values oscilate, before becoming")
        imgui.text("chaotic once again.")
        imgui.end()

        imgui.begin("Controls - Logistic map", False)
        imgui.text("Press LEFT and RIGHT to")
        imgui.text("change the value of R")
        imgui.end()

        imgui.render()
        self.imgui.render(imgui.get_draw_data())
コード例 #16
0
ファイル: columns.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.begin("Example: Columns - File list")
        imgui.columns(4, 'fileList')
        imgui.separator()
        imgui.text("ID")
        imgui.next_column()
        imgui.text("File")
        imgui.next_column()
        imgui.text("Size")
        imgui.next_column()
        imgui.text("Last Modified")
        imgui.next_column()
        imgui.separator()
        imgui.set_column_offset(1, 40)

        imgui.next_column()
        imgui.text('FileA.txt')
        imgui.next_column()
        imgui.text('57 Kb')
        imgui.next_column()
        imgui.text('12th Feb, 2016 12:19:01')
        imgui.next_column()

        imgui.next_column()
        imgui.text('ImageQ.png')
        imgui.next_column()
        imgui.text('349 Kb')
        imgui.next_column()
        imgui.text('1st Mar, 2016 06:38:22')
        imgui.next_column()

        imgui.columns(1)
        imgui.end()
コード例 #17
0
 def draw(self):
     imgui.begin(self.title)
     changed, self.text_val = imgui.input_text('Text', self.text_val, 256)
     imgui.text('You wrote:')
     imgui.same_line()
     imgui.text(self.text_val)
     imgui.end()
コード例 #18
0
def create_window_dock(glfw_window, menu_bar=False):
    imgui.set_next_window_bg_alpha(0)
    imgui.push_style_var(imgui.STYLE_WINDOW_PADDING, (0, 0))
    begin_maximized_window("Background Window", glfw_window, menu_bar)
    imgui.pop_style_var(1)
    imgui.dock_space("Window Dock Space", 0., 0., 1 << 3)
    imgui.end()
コード例 #19
0
    def on_draw(self):
        imgui.create_context()

        imgui.new_frame()

        imgui.begin("FrameBuffer", True)
        fbs = [
            o for o in gc.get_referrers(FrameBuffer)
            if isinstance(o, FrameBuffer)
        ]
        gl.glClearColor(0, 0, 0, 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        clicked, self.current_framebuffer = imgui.combo(
            "FrameBuffer", self.current_framebuffer, [str(fb) for fb in fbs])

        fb = fbs[self.current_framebuffer]
        w, h = fb.size
        for name, tex in fb.textures.items():
            imgui.text(name)
            imgui.image(tex.name, 200, 200 * h / w)
        imgui.end()

        imgui.render()
        imgui.end_frame()

        data = imgui.get_draw_data()
        if data:
            self.imgui_renderer.render(imgui.get_draw_data())
コード例 #20
0
    def draw(self):
        imgui.begin("Example: collapsing header")
        expanded, self.visible = imgui.collapsing_header("Expand me!", self.visible)

        if expanded:
            imgui.text("Now you see me!")
        imgui.end()
コード例 #21
0
ファイル: checkboxflags.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: checkboxes for flags", flags=self.flags)

        clicked, self.flags = imgui.checkbox_flags(
            "No resize", self.flags, imgui.WINDOW_NO_RESIZE
        )
        clicked, self.flags = imgui.checkbox_flags(
            "No move", self.flags, imgui.WINDOW_NO_MOVE
        )
        clicked, self.flags = imgui.checkbox_flags(
            "No collapse", self.flags, imgui.WINDOW_NO_COLLAPSE
        )
        # note: it also allows to use multiple flags at once
        clicked, self.flags = imgui.checkbox_flags(
            "No resize & no move", self.flags,
            imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE
        )
        imgui.text("Current flags value: {0:b}".format(self.flags))
        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #22
0
ファイル: button.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.begin(self.title)

        if imgui.radio_button("Radio button", self.radio_active):
            self.radio_active = not self.radio_active

        imgui.end()
コード例 #23
0
    def on_gui(self):
        # ---------------------------------------------------
        # Scene Hierarchy
        # ---------------------------------------------------
        imgui.begin("Scene Hierarchy")
        # draw all entities
        for entity in self.scene:
            self._draw_entity_node(entity)

        # clear selection
        if imgui.is_mouse_down(0) and imgui.is_window_hovered():
            self.selected_entity = None

        # create new entity
        if imgui.begin_popup_context_window():
            if menu_item_clicked("Create Empty Entity"):
                self.scene.create_entity("Empty Entity")
            imgui.end_popup()
        imgui.end()

        # ---------------------------------------------------
        # Properties
        # ---------------------------------------------------
        imgui.begin("Properties")
        if self.selected_entity:
            self._draw_entity_components(self.selected_entity)
        imgui.end()
コード例 #24
0
ファイル: popup.py プロジェクト: kfields/arcade-imgui
 def draw(self):
     imgui.begin("Example: popup context view")
     imgui.text("Right-click to set value.")
     if imgui.begin_popup_context_item("Item Context Menu"):
         imgui.selectable("Set to Zero")
         imgui.end_popup()
     imgui.end()
コード例 #25
0
 def __call__(self):
     _, show = imgui.begin("Custom window1", True)
     if not show:
         main_frame.s1 = False
     imgui.text("BarBarBar")
     imgui.text_colored("Eggs", 1., 0.1, 0.2)
     imgui.end()
コード例 #26
0
def window(title: str,
           widget: Widget,
           position: Tuple[int, int] = None,
           size: Tuple[int, int] = None,
           flags: int = 0) -> Widget:
    """ Create a window with a given `widget` inside.

    Contents are drawn only if the window is opened.

    * **Window title must be unique.** Contents of windows with an identical title will appear
      inside a single window.
    * **Windows must not be nested.** Nested windows may lead to visibility feedback loops,
      which manifests as flicker on some docking operations.
    """
    while True:
        if position is not None:
            imgui.set_next_window_position(*position)
        if size is not None:
            imgui.set_next_window_size(*size)
        else:
            imgui.set_next_window_size(400, 300, imgui.FIRST_USE_EVER)
        expanded, opened = imgui.begin(title, flags=flags)
        try:
            if expanded and opened:
                next(widget)
        except StopIteration as e:
            return e.value
        finally:
            imgui.end()
        yield
コード例 #27
0
 def menu_bar(self):
     if imgui.begin_main_menu_bar():
         if imgui.begin_menu("File", True):
             clicked_quit, selected_quit = imgui.menu_item(
                 "Quit", 'Cmd+Q', False, True)
             if clicked_quit:
                 self.cleanup()
                 exit(0)
             imgui.end_menu()
         changed, value = imgui.input_text("", self.input_text, 30)
         if changed:
             imgui.set_next_window_position(imgui.get_item_rect_min().x,
                                            imgui.get_item_rect_max().y)
             imgui.set_next_window_size(imgui.get_item_rect_size().x, 0)
             if imgui.begin(
                     "##popup", False, imgui.WINDOW_NO_TITLE_BAR
                     | imgui.WINDOW_NO_MOVE | imgui.WINDOW_NO_RESIZE):
                 for index, row in self.symbol_list.iterrows():
                     if value.upper() in row[0]:
                         _, _ = imgui.selectable(row[0] + " - " + row[2])
                         if imgui.is_item_clicked():
                             self.input_text = row[0]
                             self.load_symbol(str(row[0]).lower())
             imgui.end()
         imgui.end_main_menu_bar()
コード例 #28
0
ファイル: checkbox.py プロジェクト: kfields/arcade-imgui
    def draw(self):
        imgui.new_frame()

        imgui.set_next_window_position(16, 32, imgui.ONCE)
        imgui.set_next_window_size(512, 512, imgui.ONCE)

        imgui.begin("Example: checkboxes")

        # note: first element of return two-tuple notifies if there was a click
        #       event in currently processed frame and second element is actual
        #       checkbox state.
        _, self.checkbox1_enabled = imgui.checkbox("Checkbox 1",
                                                   self.checkbox1_enabled)
        _, self.checkbox2_enabled = imgui.checkbox("Checkbox 2",
                                                   self.checkbox2_enabled)

        imgui.text("Checkbox 1 state value: {}".format(self.checkbox1_enabled))
        imgui.text("Checkbox 2 state value: {}".format(self.checkbox2_enabled))

        imgui.end()

        imgui.end_frame()

        imgui.render()

        self.renderer.render(imgui.get_draw_data())
コード例 #29
0
ファイル: imgui_ext.py プロジェクト: pthom/imgui_datascience
def show_togglable_window(window_param, window_function_code):
    global _ALL_TOGGLABLE_STATUS
    if window_param.window_title not in _ALL_TOGGLABLE_STATUS:
        _ALL_TOGGLABLE_STATUS[
            window_param.window_title] = window_param.initialShow

    this_window_open_status = _ALL_TOGGLABLE_STATUS[window_param.window_title]

    if this_window_open_status:
        toggle_button_legend = "Hide " + window_param.window_title
    else:
        toggle_button_legend = "Show " + window_param.window_title

    if imgui.button(make_unique_label(toggle_button_legend)):
        this_window_open_status = not this_window_open_status

    if this_window_open_status:
        imgui.set_next_window_size(window_param.size[0], window_param.size[1])
        if window_param.include_begin_code:
            imgui.begin(window_param.window_title)

        window_function_code()

        if window_param.include_begin_code:
            imgui.end()
コード例 #30
0
    def render_ui(self):
        imgui.new_frame()

        imgui.begin("Description - Political parties", False)
        imgui.text(
            "Visualisation of the number of mandates held by different political parties"
        )
        imgui.text("FPS: %.2f" % self.fps)
        imgui.text("Parties:")
        imgui.text_colored("ANO", 0, 1, 251 / 255)
        imgui.text_colored("ODS", 0, 0, 1)
        imgui.text_colored("Pirate party", 0.5, 0.5, 0.5)
        imgui.text_colored("SPD", 97 / 255, 75 / 255, 3 / 255)
        imgui.text_colored("Communist party", 1, 0, 0)
        imgui.text_colored("CSSD", 1, 123 / 255, 0)
        imgui.text_colored("KDU-CLS", 1, 1, 0)
        imgui.text_colored("TOP 09", 136 / 255, 0, 1)
        imgui.text_colored("STAN", 0, 158 / 255, 18 / 255)
        imgui.text_colored("Other", 1, 1, 1)
        imgui.end()

        imgui.begin("Controls - Political parties", False)
        imgui.text("Press A/D to change size horizontaly")
        imgui.text("Press W/S to change size vertically")
        imgui.text("Press UP/DOWN to change size of the points")
        imgui.end()

        imgui.render()
        self.imgui.render(imgui.get_draw_data())
コード例 #31
0
ファイル: gbdev_app.py プロジェクト: EliasFarhan/GBDev
def main():
    pygame.init()

    size = 800, 600

    pygame.display.set_mode(size, pygame.DOUBLEBUF | pygame.OPENGL)
    pygame.display.set_caption("GBDev tool window")
    io = imgui.get_io()
    io.fonts.add_font_default()
    io.display_size = size

    renderer = PygameRenderer()

    while 1:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

            renderer.process_event(event)

        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("Menu", True):
                open_gbtd, selected_none = imgui.menu_item("Open GBTD", None, False, True)
                open_gbtk, selected_none = imgui.menu_item("Open GBTK", None, False, True)
                
                export_json, selected_none = imgui.menu_item("Export Default Json", None, False, True)

                clicked_quit, selected_quit = imgui.menu_item("Quit", 'Cmd+Q', False, True)

                if clicked_quit:
                    exit(1)
                if open_gbtd:
                    os.system("wine tools/GBTD/GBTD.EXE &")
                if open_gbtk:
                    os.system("wine tools/GBTK.exe &")
                if export_json:
                    tools.json2c.default_use()
                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.begin("Data", True)

        img_path = "data/img"
        onlyfiles = [f for f in listdir(img_path) if isfile(join(img_path, f))]
        #print(onlyfiles)
        for file in onlyfiles:
            imgui_image_menu(img_path+"/"+file)

        imgui.end()

        imgui.begin("Images", True)

        imgs_id = []
        for img_filename in onlyfiles:
            if img_filename.split(".")[-1] == "png":
                imgs_id.append((img_path+"/"+img_filename, img_manager.load_image(img_path+"/"+img_filename)))

        for img in imgs_id:
            img_size = img_manager.get_image_size(img[0])
            if img[1] is not 0 and img_size is not ():
                imgui.image(img[1], img_size[0]*2, img_size[1]*2, (0,1), (1,0))
                imgui.same_line()


        imgui.end()
        # note: cannot use screen.fill((1, 1, 1)) because pygame's screen
        #       does not support fill() on OpenGL sufraces
        gl.glClearColor(1, 1, 1, 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        imgui.render()

        pygame.display.flip()
コード例 #32
0
ファイル: main_window.py プロジェクト: voodoonofx/ROAutoLoot
    def onDrawGuiCallback(self, *args, **kw):
        if self.window_visable:
            try:
                if imgui.begin('AutoLoot {0} - {1}##Entity_mainwindow'.format(autoloot.__version__, autoloot.__author__), (600,350)):
                    # button bar
                    if imgui.checkbox('Enable Auto-Loot', self.enabled_auto_loot):
                        self.enabled_auto_loot = not self.enabled_auto_loot
                    
                    if imgui.collapsingHeader('Available Loot ({0} items)'.format(len(self.bot.items))):
                        imgui.columns(4)
                        for item in self.bot.items:
                            if not item:
                                continue

                            imgui.text(item.roleName)
                            imgui.nextColumn()

                            if item.__module__ == 'DroppedItem':
                                try:
                                    imgui.text('Lootable' if item._checkPickItem(self.bot.p) else 'Not Lootable')
                                except AttributeError:
                                    imgui.text('Not _checkPickItem')
                            else:
                                imgui.text('Openable?')
                            imgui.nextColumn()

                            imgui.text('{0}'.format(self.bot.p.position.distTo(item.position)))
                            imgui.nextColumn()

                            if imgui.button('Go To {0}##NavToEntity'.format(item.__module__)):
                                nav.moveToEntityPathFind(item)
                            imgui.nextColumn()
                            imgui.separator()
                        imgui.columns(1)

                    if imgui.collapsingHeader('Debug All Entities'):
                        for entity_name, entities in sorted(self.bot.entities.iteritems()):
                            for entity in entities:
                                imgui.columns(5)
                                imgui.separator()
                                imgui.text('{0}'.format(entity_name))
                                imgui.nextColumn()
                                imgui.text('{0}'.format(entity.id))
                                imgui.nextColumn()
                                if entity_name == 'DroppedItem' and hasattr(entity, '_checkPickItem') and entity._checkPickItem(self.bot.p):
                                    imgui.text('{0}'.format('Lootable'))
                                elif not entity_name == 'DroppedItem':
                                    imgui.text('No Data Available')
                                else:
                                    imgui.text('Not your Loot!')
                                imgui.nextColumn()
                                if entity and hasattr(entity, 'position') and self.bot.p and hasattr(self.bot.p, 'position'):
                                    imgui.text('{0}'.format(self.bot.p.position.distTo(entity.position)))
                                else:
                                    imgui.text('No Position Information')
                                imgui.nextColumn()
                                if imgui.button('NavToEntity##NavToEntity'):
                                    nav.moveToEntityPathFind(entity)
                                imgui.nextColumn()
                        imgui.columns(1)
                imgui.end()
            except Exception:
                import traceback
                for line in traceback.format_exc().splitlines():
                    roplus.log(line)
                self.window_visable = False
コード例 #33
0
ファイル: minimal.py プロジェクト: chromy/cyimgui
import imgui

def my_render_function():
    print 'foo'

io = imgui.get_io()
io.display_size = 1920.0, 1280.0
io.render_draw_lists_fn = my_render_function
io.fonts.add_font_default()
io.fonts.get_tex_data_as_rgba32()


## Application main loop
while True:
    io = imgui.get_io();
    io.delta_time = 1.0/60.0;

    print 'Render'
    imgui.new_frame()
    imgui.begin("My window")
    imgui.text("Hello, world.")
    imgui.end()
    imgui.render()
    print '...done'
    #io.mouse_pos = mouse_pos;
    #io.mouse_down[0] = mouse_button_0;
    # io.KeysDown[i] = ...
#
#