podgorskiy / bimpy

imgui for python
https://podgorskiy.github.io/bimpy/
MIT License
202 stars 33 forks source link

Experimental #15

Open njazz opened 5 years ago

njazz commented 5 years ago

added Context.IsActive() to be able determine if the window is currently focused. this is a workaround for some cases on OS X when the window that is not focused causes high CPU usage of windowserver process

added: drag_int() drag_float() add_bezier_curve() is_window_focused() is_window_hovered()

fixed: menu_item() image() color_edit() color_picker()

podgorskiy commented 5 years ago

Could you please explain what keep_frame does?

njazz commented 5 years ago

Hello! Sorry for late reply

The idea behind these additions was to have the reduced framerate on macOS when the app is in the background. It seems that otherwise it runs the main new_frame()-render() loop as fast as possible instead of usual screen-synced 60 fps.

i've made this 'keep_frame()' as fast workaround. maybe there can be a better option for this.

now i'm actually not using this and just making the slower frame rate with code like this:

ctx.new_frame()
# draw commands ...
if not ctx.is_active():
    sleep(0.1)
ctx.render()

it would be better to be able to skip all drawing commands

Thanks!

Regards, Alex