Closed JoelLinn closed 4 years ago
Example script to see some of the changes in action:
import bimpy
ctx = bimpy.Context()
ctx.init(600, 600, "Hello")
str_ = bimpy.String()
f = bimpy.Float()
f2a = bimpy.Float()
f2b = bimpy.Float()
f2a.value = 1/3.0
style = bimpy.get_style()
style.window_menu_button_position = bimpy.Direction.Right
bimpy.set_style(style)
while(not ctx.should_close()):
ctx.new_frame()
bimpy.show_about_window()
bimpy.show_demo_window()
bimpy.show_metrics_window()
bimpy.set_next_window_bg_alpha(0.5)
bimpy.begin("test")
bimpy.begin_tab_bar("my tab bar")
if bimpy.begin_tab_item("Page 1"):
bimpy.text("Hello, world!")
if bimpy.button("OK"):
print(str_.value)
bimpy.input_text_with_hint('string', "type some text here and press ok to print it to console", str_, 256)
bimpy.slider_float("float", f, 0.0, 1.0)
bimpy.end_tab_item()
bimpy.push_style_var(bimpy.Style.TabRounding, 15)
if bimpy.begin_tab_item("Page 2"):
bimpy.input_float2("2 float input", f2a, f2b, "%.5f")
bimpy.end_tab_item()
bimpy.push_style_var(bimpy.Style.TabRounding, 0)
if bimpy.begin_tab_item("Page 3"):
bimpy.text("Floats from page 2:")
bimpy.text(str(f2a.value))
bimpy.text(str(f2b.value))
bimpy.end_tab_item()
bimpy.pop_style_var(2)
if bimpy.begin_tab_item("Page 4"):
if bimpy.button("ImGui light style"):
bimpy.style_colors_light()
if bimpy.button("bimpy light style"):
bimpy.themes.set_light_theme()
bimpy.end_tab_bar()
bimpy.set_scroll_y(bimpy.get_scroll_max_y() / 2)
bimpy.end()
ctx.render()
Using the new render implementations also seems to fix a bug in the draw_commands example when more circles than a specific number are drawn:
Superseeded by #30
Breaking changes (additionally to braking changes in ImGui 1.65 to 1.74):
style_color_*
functions have been renamed tostyle_colors_*
to reflect ImGui API.input_float*
functions use newer overload available in ImGui for some time (only affects optional parameters)