Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<<<<<<< HEAD
[![completion](https://img.shields.io/badge/completion-72%25%20%28327%20of%20450%29-blue.svg)](https://github.com/swistakm/pyimgui)
=======
[![completion](https://img.shields.io/badge/completion-65%25%20%28269%20of%20409%29-blue.svg)](https://github.com/swistakm/pyimgui)
>>>>>>> 4faa959b2e3efcd1f069d21bc7f0a3eb1cce616f
[![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 All @@ -19,7 +23,7 @@ Documentation: [pyimgui.readthedocs.io](https://pyimgui.readthedocs.io/en/latest
# Installation

**pyimgui** is available on PyPI so you can easily install it with `pip`:

pip install imgui[full]

Above command will install `imgui` package with additional dependencies for all
Expand Down Expand Up @@ -49,7 +53,7 @@ ImGui library. The *completion badge* shows up-to-date status of that goal.

# Project distribution

This project has working build pipeline on Appveyor and Travis and builds
This project has working build pipeline on Appveyor and Travis and builds
succesfully for all major operating systems with different architectures:

* Windows (32bit & 64bit)
Expand Down Expand Up @@ -92,8 +96,8 @@ activated virtual environment using `virtualenv` or `python -m venv` (for newer
Python releases). Then you can just run:

make build
This command will bootstrap whole environment (pull git submodules, install

This command will bootstrap whole environment (pull git submodules, install
dev requirements etc.) and build the project. `make` will automatically install
`imgui` in the *development/editable* mode. Then you can run some examples
found in the `doc/examples` directory in order to verify if project is working.
Expand Down
89 changes: 89 additions & 0 deletions doc/examples/scope_manager_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# -*- coding: utf-8 -*-
import glfw
import OpenGL.GL as gl

import imgui
from imgui.integrations.glfw import GlfwRenderer

def main():
window = impl_glfw_init()
impl = GlfwRenderer(window)

box1 = box2 = box3 = True

while not glfw.window_should_close(window):
glfw.poll_events()
impl.process_inputs()

imgui.new_frame()

if imgui.begin_main_menu_bar():
if imgui.begin_menu("File", True):

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.begin("Scope Test")

box1 = imgui.checkbox("Checkbox", box1)[1]

with imgui.scope(2):
imgui.new_line()
imgui.text("Same name, different scope:")
box2 = imgui.checkbox("Checkbox", box2)[1]

imgui.new_line()
imgui.text("Same name, same scope:")
imgui.text("(This will not work right)")
box3 = imgui.checkbox("Checkbox", box3)[1]

imgui.end()

gl.glClearColor(1., 1., 1., 1)
gl.glClear(gl.GL_COLOR_BUFFER_BIT)

imgui.render()
glfw.swap_buffers(window)

impl.shutdown()
imgui.shutdown()
glfw.terminate()


def impl_glfw_init():
width, height = 1280, 720
window_name = "minimal ImGui/GLFW3 example"

if not glfw.init():
print("Could not initialize OpenGL context")
exit(1)

# OS X supports only forward-compatible core profiles from 3.2
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 3)
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)

glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, gl.GL_TRUE)

# Create a windowed mode window and its OpenGL context
window = glfw.create_window(
int(width), int(height), window_name, None, None
)
glfw.make_context_current(window)

if not window:
glfw.terminate()
print("Could not initialize Window")
exit(1)

return window

if __name__ == "__main__":
main()
50 changes: 36 additions & 14 deletions imgui/cimgui.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ cdef extern from "imgui.h":
int MetricsRenderVertices # ✓
int MetricsRenderIndices # ✓
int MetricsActiveWindows # ✓
ImVec2 MouseDelta #
ImVec2 MouseDelta #

# ====
# source-note: [Internal] ImGui will maintain those fields for you
Expand Down Expand Up @@ -224,26 +224,49 @@ cdef extern from "imgui.h":
ImU32 col,
# note: optional
float rounding, # = 0.0f,
int rounding_corners_flags, # = ImDrawCornerFlags_All,
int rounding_corners_flags, # = ImDrawCornerFlags_All,
float thickness # = 1.0f
) except + # ✓


void AddRectFilled(
const ImVec2& a,
const ImVec2& b,
const ImVec2& a,
const ImVec2& b,
ImU32 col,
# note: optional
float rounding, # = 0.0f
int rounding_corners_flags # = ImDrawCornerFlags_All
) except + # ✓


void ChannelsSplit(int channels_count) except + # ✓
void ChannelsMerge() except + # ✓
void ChannelsSetCurrent(int idx) except + # ✓


void AddCircleFilled(
const ImVec2&,
float,
ImU32,
# note:optional
ImU32) except + # ✓

void AddText(
const ImVec2&,
ImU32,
const char*,
# note:optional
const char*) except + # ✓

void AddImage(
ImTextureID,
const ImVec2&,
const ImVec2&,
# note:optional
const ImVec2&,
const ImVec2&,
ImU32) except + # ✓


ctypedef struct ImDrawData: # ✓
bool Valid # ✓
Expand Down Expand Up @@ -550,11 +573,11 @@ cdef extern from "imgui.h" namespace "ImGui":

# ====
# ID scopes
void PushID(const char* str_id) except + #
void PushID(const char* str_id) except + #
void PushID(const char* str_id_begin, const char* str_id_end) except + # ✗
void PushID(const void* ptr_id) except + #
void PushID(const void* ptr_id) except + #
void PushID(int int_id) except + # ✗
void PopID() except + #
void PopID() except + #
ImGuiID GetID(const char* str_id) except + # ✗
ImGuiID GetID(const char* str_id_begin, const char* str_id_end) except + # ✗
ImGuiID GetID(const void* ptr_id) except + # ✗
Expand Down Expand Up @@ -901,12 +924,12 @@ cdef extern from "imgui.h" namespace "ImGui":
const char* format
) except + # Widgets: Trees
bool VSliderScalar( # ✗
const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max,
const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max,
# note: optional
const char* format,
float power
) except +

bool TreeNode(const char* label) except + # ✓
# bool TreeNode(const char* str_id, const char* fmt, ...) except + # ✗
# bool TreeNode(const void* ptr_id, const char* fmt, ...) except + # ✗
Expand Down Expand Up @@ -1096,8 +1119,8 @@ cdef extern from "imgui.h" namespace "ImGui":
void EndDragDropTarget() except + # ✗

# Clipping
void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect) except + #
void PopClipRect() except + #
void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect) except + #
void PopClipRect() except + #

# Utilities
bool IsItemHovered(ImGuiHoveredFlags flags) except + # ✓
Expand Down Expand Up @@ -1158,7 +1181,7 @@ cdef extern from "imgui.h" namespace "ImGui":
bool IsKeyReleased(int key_index) except + # ✓
int GetKeyPressedAmount(int key_index, float repeat_delay, float rate) except + # ✗
bool IsMouseDown(int button) except + # ✓
bool IsAnyMouseDown() except + #
bool IsAnyMouseDown() except + #
bool IsMouseClicked( # ✓
int button,
# note: optional
Expand Down Expand Up @@ -1218,4 +1241,3 @@ cdef extern from "imgui.h" namespace "ImGui":
# note: optional
size_t* out_ini_size
) except +

Loading