Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
impl.render(imgui.get_draw_data())
glfw.swap_buffers(window)
impl.shutdown()
glfw.terminate()
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()
imgui.render()
self.imgui.render(imgui.get_draw_data())
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()
SDL_GL_SwapWindow(window)
renderer.shutdown()
SDL_GL_DeleteContext(gl_context)
SDL_DestroyWindow(window)
SDL_Quit()
imgui.text_colored("Parse Error: " + rule_error, 1, 0, 0, 1)
imgui.pop_font()
imgui.pop_text_wrap_pos()
for n in to_delete:
del DB.rules[n]
to_delete = []
if imgui.button("New Rule"):
imgui.open_popup("new-rule")
new_name = draw_ok_cancel_popup("new-rule", "New Rule Name:")
if new_name:
if len(new_name) > 0:
DB.add_rule(new_name.lower().replace(" ", "_").replace("-", "_"))
imgui.end()
imgui.end_group()
imgui.end()
if ERROR:
imgui.set_next_window_size(width, height)
imgui.set_next_window_position(0, 0)
imgui.begin("ERROR",
flags=imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE | imgui.WINDOW_NO_SAVED_SETTINGS
)
imgui.text(str(ERROR))
if imgui.button("OK", width=200, height=60):
ERROR = ""
imgui.end()
imgui.render()
renderer.render()
renderer.shutdown()
for name, value in DB.global_binds.items():
const_expanded[name], closed = imgui.collapsing_header(name.replace("*", ""), True)
if const_expanded[name]:
imgui.indent()
change = draw_eav_value(DB, "CONST", name, value)
if change:
(_, _, new_val) = change
if new_val:
DB.global_binds[name] = new_val
imgui.unindent()
if imgui.button("New Constant"):
imgui.open_popup("new-data")
draw_data_popup(DB, True)
imgui.end()
if auto_layout:
imgui.set_next_window_size(width - 10, height - 10)
imgui.set_next_window_centered()
if auto_window:
imgui.set_next_window_size(width - 10, height - 10)
imgui.set_next_window_centered()
# note: title may be unicode and since we are building docs on py27
# there is a need for encoding it.
imgui.begin("Example: %s" % title.encode())
exec(code, locals(), globals())
if auto_window:
imgui.end()
# retrieve pixels from framebuffer and write to file
pixels = gl.glReadPixels(0, 0, width, height, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE)
image = Image.frombytes('RGBA', (width, height), pixels)
# note: glReadPixels returns lines "bottom to top" but PIL reads bytes
# top to bottom
image = image.transpose(Image.FLIP_TOP_BOTTOM)
image_list.append(image)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, offscreen_fb)
gl.glClearColor(1, 1, 1, 0)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
imgui.render()
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()