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()
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)
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()
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()
def draw_ui(self): imgui.label_text("Speed", "%0.1fm/s" % self.speed)
def draw(self): imgui.begin("Example: text with label") imgui.label_text("my label", "my text") imgui.end()