Skip to content

Commit

Permalink
Merge pull request #73 from tim-rex/support_imgui_v1.61
Browse files Browse the repository at this point in the history
Support imgui v1.61
  • Loading branch information
swistakm committed May 22, 2018
2 parents 427ead5 + 20e11d9 commit a02c9b8
Show file tree
Hide file tree
Showing 13 changed files with 1,466 additions and 573 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![completion](https://img.shields.io/badge/completion-66%25%20%28270%20of%20409%29-blue.svg)](https://github.com/swistakm/pyimgui)
[![completion](https://img.shields.io/badge/completion-66%25%20%28294%20of%20442%29-blue.svg)](https://github.com/swistakm/pyimgui)
[![Coverage Status](https://coveralls.io/repos/github/swistakm/pyimgui/badge.svg?branch=master)](https://coveralls.io/github/swistakm/pyimgui?branch=master)
[![Documentation Status](https://readthedocs.org/projects/pyimgui/badge/?version=latest)](https://pyimgui.readthedocs.io/en/latest/?badge=latest)

Expand Down
17 changes: 16 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,25 @@ def runtest(self):
self.exec_snippet(self.code)

def exec_snippet(self, source):

# Strip out new_frame/end_frame from source
lines = [
line
if all([
"imgui.new_frame()" not in line,
"imgui.render()" not in line,
"imgui.end_frame()" not in line
]) else ""
for line in
source.split('\n')
]
source = "\n".join(lines)

code = compile(source, '<str>', 'exec')
frameinfo = getframeinfo(currentframe())

imgui.create_context()
io = imgui.get_io()
io.render_callback = lambda *args, **kwargs: None
io.delta_time = 1.0 / 60.0
io.display_size = 300, 300

Expand All @@ -73,6 +87,7 @@ def exec_snippet(self, source):
lines = source.split('\n')
lines.insert(sys.exc_info()[2].tb_next.tb_lineno, "^^^")
self.code = "\n".join(lines)
imgui.end_frame()
raise

imgui.render()
Expand Down
1 change: 1 addition & 0 deletions doc/examples/glfw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def main():
gl.glClear(gl.GL_COLOR_BUFFER_BIT)

imgui.render()
impl.render(imgui.get_draw_data())
glfw.swap_buffers(window)

impl.shutdown()
Expand Down
1 change: 1 addition & 0 deletions doc/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Cython>=0.24,<=0.28.2
click
wheel
# note: sphinx and docutils are for collecting tests
Sphinx==1.4.8
docutils<0.13.1
Expand Down
7 changes: 4 additions & 3 deletions doc/source/gen_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import imgui
from imgui.integrations.glfw import GlfwRenderer


imgui.create_context()
io = imgui.get_io()


Expand Down Expand Up @@ -70,7 +70,8 @@ def render_snippet(
line
if all([
"imgui.new_frame()" not in line,
"imgui.render()" not in line
"imgui.render()" not in line,
"imgui.end_frame()" not in line
]) else ""
for line in
source.split('\n')
Expand Down Expand Up @@ -145,7 +146,7 @@ def render_snippet(

if auto_layout:
imgui.set_next_window_size(width - 10, height - 10)
imgui.set_next_window_centered()
imgui.set_next_window_position(impl.io.DisplaySize.x * 0.5, implio.DisplaySize.y * 0.5, 1, pivot_x = 0.5, pivot_y = 0.5)

exec(code, locals(), globals())

Expand Down
1 change: 1 addition & 0 deletions doc/source/guide/first-steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ commands.
# pass all drawing comands to the rendering pipeline
# and close frame context
imgui.render()
imgui.end_frame()


Of course this is not enough to create fully working GUI application with
Expand Down
20 changes: 1 addition & 19 deletions doc/source/guide/window-flags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ so many different flags can be joined together with ``|`` operator.
imgui.set_next_window_position(10, 0)
imgui.begin(
"Custom window",
flags=imgui.WINDOW_MENU_BAR | imgui.WINDOW_SHOW_BORDERS
flags=imgui.WINDOW_MENU_BAR
)
imgui.text("Custom window with menu bar and borders")
imgui.end()
Expand Down Expand Up @@ -56,23 +56,6 @@ Window flags are also available for new scrollable child regions created with

imgui.end()

Note that in case of scrollable regions it is possible to override the
``border`` argument with the :any:`imgui.WINDOW_SHOW_BORDERS` flag.

.. visual-example::
:width: 310
:height: 100
:title: Child region flags override border
:auto_layout:

imgui.begin("Region border override")
imgui.begin_child(
"Child region", border=False,
flags=imgui.WINDOW_SHOW_BORDERS
)
imgui.end_child()
imgui.end()

List of all available window flags (click to see documentation):

.. _window-flag-options:
Expand All @@ -84,7 +67,6 @@ List of all available window flags (click to see documentation):
* :py:data:`imgui.WINDOW_NO_SCROLL_WITH_MOUSE`
* :py:data:`imgui.WINDOW_NO_COLLAPSE`
* :py:data:`imgui.WINDOW_ALWAYS_AUTO_RESIZE`
* :py:data:`imgui.WINDOW_SHOW_BORDERS`
* :py:data:`imgui.WINDOW_NO_SAVED_SETTINGS`
* :py:data:`imgui.WINDOW_NO_INPUTS`
* :py:data:`imgui.WINDOW_MENU_BAR`
Expand Down
2 changes: 1 addition & 1 deletion imgui-cpp
Submodule imgui-cpp updated 117 files

0 comments on commit a02c9b8

Please sign in to comment.