Exemplo n.º 1
0
 def gui(self):
     if imgui.begin_popup(self.name):
         imgui.label_text(self.name, self.name)
         if imgui.button('Ok'):
             self.callback()
             imgui.close_current_popup()
             imgui.end_popup()
    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()
Exemplo n.º 3
0
 def drawUi(self):
     # height scale is read-only as it is not run-time changable (since we use it to compute normals at load-time)
     imgui.label_text("terrainHeightScale", "%0.2f" % self.heightScale)
     #_,self.heightScale = imgui.slider_float("terrainHeightScale", self.heightScale, 1.0, 100.0)
     _, self.textureXyScale = imgui.slider_float("terrainTextureXyScale",
                                                 self.textureXyScale, 0.01,
                                                 10.0)
     _, self.renderWireFrame = imgui.checkbox("WireFrame",
                                              self.renderWireFrame)
Exemplo n.º 4
0
    def gui(self):
        imgui.begin_child(self.name)
        for item, remove_button in zip(self.items, self.remove_buttons):
            if isinstance(item, Widget):
                item.gui()
            else:
                text = getattr(item, 'name', str(item))
                imgui.label_text(text, text)
            imgui.same_line()
            remove_button.gui()

        imgui.end_child()
Exemplo n.º 5
0
    def draw(self):
        imgui.begin(self.title)

        #imgui.text(str(imgui.is_mouse_down(0)))
        imgui.label_text(str(imgui.get_mouse_pos()), "position")
        imgui.label_text(str(imgui.is_mouse_down(0)), "left button")
        imgui.label_text(str(imgui.is_mouse_down(1)), "right button")
        imgui.label_text(str(imgui.is_mouse_down(2)), "middle button")

        imgui.end()
Exemplo n.º 6
0
 def draw_ui(self):
     imgui.label_text("Speed", "%0.1fm/s" % self.speed)
Exemplo n.º 7
0
 def draw(self):
     imgui.begin("Example: text with label")
     imgui.label_text("my label", "my text")
     imgui.end()