├── .gitmodules ├── COMPATIBILITY.md ├── DESIGN.md ├── FEATURES.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── dearcygui ├── __init__.pxd ├── __init__.py ├── backends │ ├── __init__.pxd │ ├── backend.h │ ├── backend.pxd │ ├── imgui_impl_sdl3.cpp │ ├── imgui_impl_sdl3.h │ ├── sdl3_gl3_backend.cpp │ └── time.pxd ├── c_types.pxd ├── constants.pyi ├── constants.pyx ├── core.pxd ├── core.pyi ├── core.pyx ├── dearcygui.pyx ├── dearpygui.py ├── docs │ ├── UI.md │ ├── advanced.md │ ├── basics.md │ ├── callbacks.md │ ├── drawings.md │ ├── plots.md │ └── themes.md ├── draw.pxd ├── draw.pyx ├── font.pxd ├── font.pyx ├── handler.pxd ├── handler.pyx ├── imgui.pxd ├── imgui.pyx ├── imgui_config.h ├── imgui_types.pxd ├── imgui_types.pyx ├── layout.pxd ├── layout.pyx ├── os.pxd ├── os.pyi ├── os.pyx ├── plot.pxd ├── plot.pyx ├── py.typed ├── theme.pxd ├── theme.pyx ├── types.pxd ├── types.pyi ├── types.pyx ├── utils │ ├── __init__.py │ ├── draw.py │ ├── handler.py │ ├── layout.py │ ├── widget.py │ └── window.py ├── widget.pxd ├── widget.pyx └── wrapper │ ├── __init__.pxd │ ├── imgui.pxd │ ├── imnodes.pxd │ └── implot.pxd ├── pyproject.toml ├── setup.py ├── stubs ├── custom.pyi └── stub_generator.py └── thirdparty ├── gl3w ├── GL │ ├── gl.h │ ├── gl3w.c │ ├── gl3w.h │ ├── glcorearb.h │ └── glext.h └── KHR │ └── khrplatform.h ├── imnodes ├── .clang-format ├── .clang-tidy ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── example │ ├── color_node_editor.cpp │ ├── graph.h │ ├── hello.cpp │ ├── main.cpp │ ├── multi_editor.cpp │ ├── node_editor.h │ └── save_load.cpp ├── img │ └── imnodes.gif ├── imnodes.cpp ├── imnodes.h ├── imnodes_internal.h └── vcpkg.json └── latin-modern-roman ├── GUST-FONT-LICENSE.TXT ├── lm-info.pdf ├── lmroman10-bold.otf ├── lmroman10-bolditalic.otf ├── lmroman10-italic.otf ├── lmroman10-regular.otf ├── lmroman12-bold.otf ├── lmroman12-italic.otf ├── lmroman12-regular.otf ├── lmroman17-regular.otf ├── lmroman5-bold.otf ├── lmroman5-regular.otf ├── lmroman6-bold.otf ├── lmroman6-regular.otf ├── lmroman7-bold.otf ├── lmroman7-italic.otf ├── lmroman7-regular.otf ├── lmroman8-bold.otf ├── lmroman8-italic.otf ├── lmroman8-regular.otf ├── lmroman9-bold.otf ├── lmroman9-italic.otf ├── lmroman9-regular.otf ├── lmromancaps10-oblique.otf ├── lmromancaps10-regular.otf ├── lmromandemi10-oblique.otf ├── lmromandemi10-regular.otf ├── lmromandunh10-oblique.otf ├── lmromandunh10-regular.otf ├── lmromanslant10-bold.otf ├── lmromanslant10-regular.otf ├── lmromanslant12-regular.otf ├── lmromanslant17-regular.otf ├── lmromanslant8-regular.otf ├── lmromanslant9-regular.otf ├── lmromanunsl10-regular.otf ├── lmsans10-bold.otf └── lmsans17-regular.otf /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "thirdparty/imgui"] 2 | path = thirdparty/imgui 3 | url = https://github.com/ocornut/imgui 4 | branch = docking 5 | [submodule "thirdparty/implot"] 6 | path = thirdparty/implot 7 | url = https://github.com/axeldavy/implot 8 | branch = master 9 | [submodule "thirdparty/freetype"] 10 | path = thirdparty/freetype 11 | url = https://gitlab.freedesktop.org/freetype/freetype 12 | [submodule "thirdparty/SDL"] 13 | path = thirdparty/SDL 14 | url = https://github.com/libsdl-org/SDL 15 | -------------------------------------------------------------------------------- /COMPATIBILITY.md: -------------------------------------------------------------------------------- 1 | For compatibility and ease of porting of applications written for DearPyGui (DPG), DearCyGui (DCG) supports a thin python layer that converts the original DPG calls into new DCG ones. Since DCG intends to be close to DPG, and both try to match closely to Dear ImGui, this layer is lightweight. 2 | In many cases it suffices to replace your ```import dearpygui.dearpygui as dpg``` by ```import dearcygui.dearpygui as dpg``` for DCG to run your program. In addition, as items created by the wrapper are DCG objects, you have access to the new DCG features with them. 3 | 4 | Still some features of DearPyGui are not perfectly matched to DCG, and compatibility issues might arise. Here is a list of features that might need manual changes on your side: 5 | 6 | - Item types. In DCG instead of checking the type of an object using ```get_item_type``` or ```get_item_types``` against specific strings, one should instead test with ```isinstance()``` if the object derives from the target class. This allows better handling of subclassing. While in the future, the wrapper may support mapping the new types to the old names, for now this is not supported and if one relied on the item types, manual porting is needed. 7 | 8 | - Themes targetting specific item types. In order to help porting, the wrapper maps types that could be used for themes meant to target specific item types, into DCG theme targets. This is not entirely complete yet and some items might not map to the correct category. 9 | 10 | - Children slots. DPG organized children into 4 slots. Depending on the parent, different types of children could end up in the same slots. A significant chunck of code decided which parent could accept which child, and vice-versa. Instead DCG simplifies the parenting rules, and more items are compatible as siblings. However in order to achieve this, more slots are used. Except a few exceptions, an item which can have children only supports one slot. The advantage is that it simplifies various parts of the drawing mecanism (some parts of DPG need to go through the children several times to run specific children at specific moments of the rendering process). In addition if children ended up in different slots, one couldn't run them after (or before) children of another slot. This is still true, but to a much lesser extent since much more children end up in the same slots. The impact on your code is that if you relied on the child slot, get_item_slot might be inaccurate, and in addition the siblings of your items might not go through all the children of the target slot. 11 | 12 | - Due to the above, A few items that used to be allowed as siblings or as parent/children, cannot anymore. Tooltips is in the uiItem slot and thus cannot be child/sibling of various elements it was allowed before. This restriction is compensated by the fact Tooltips can target any item (`target=` argument), and not just their previous sibling. Just insert them at a different place of your rendering tree that accepts uiItem. The wrapper attemps to do that for you. Another similar change is that the plotElement category, in which plot series reside, are direct children of the plot, and not anymore of the Y axis. Instead axes are children of the plot and reside in a different child slot than plotElement. They take `axes` argument to indicate which axes they target (contrary to DPG, X2, X3 are allowed). The wrapper handles that for you. 13 | 14 | - Horizontal groups and vertical groups are split. Thus you cannot switch from one to the other using `configure(horizontal=)`. 15 | 16 | - Colors might misbehave without porting efforts. Previously depending on the type of data to which the color was meant, sometimes the color data was divided by 255., sometimes not. Instead DPG supports uniformized 3 types of color format that can be passed to all color arguments. If you used to pass floating point color data in the [0, 255] range, you will need to either divide by 255, or convert to ints before passing them. Negative color fields are not supported either (and used to be clamped to 0). 17 | 18 | - Textures are uploaded right away, and thus require the context viewport to be initialized before being created. 19 | 20 | - rect_min, rect_max and context_area_avail were not properly documented and corresponded respectively to the top left of the item in screen space, the bottom right and the remaining area in the window starting from the bottom right. Instead content_area_avail is only defined for items which span a window area, and it corresponds to the full area available from the start of the window area. The old rect_min, rect_max and context_area_avail can be deduced from pos_to_viewport, rect_size, pos_to_window and the windows's content_area_avail. -------------------------------------------------------------------------------- /DESIGN.md: -------------------------------------------------------------------------------- 1 | Here are some technical details on how DearCyGui is designed: 2 | 3 | ## The rendering tree 4 | Each DCG context is associated a single viewport, which corresponds to a system window. 5 | This viewport is an item like any other, but cannot be replaced. Rendering starts from the viewports and spans to its children. 6 | 7 | The children of any item are rendered recursively from the first one to the last one. 8 | In practice, rather than holding a table of its children, each item only points to its LAST child. It is the responsibility of this child to render first its previous sibling before rendering itself. Then this previous sibling has the responsibility to render its previous sibling too before itself, etc. 9 | 10 | As a result a strong impact of this design is that a parent does not draw its children itself, and cannot insert rendering commands between each item. This impacts the implementation of tables, layouts, etc. 11 | 12 | There are pros and cons to this design choice. The original reason for this design choice is that I thought it was not possible to have a table of objects in Cython without the gil. In fact it is possible if one uses PyObject pointers. 13 | 14 | All rendering items have a draw() function that renders the object. To avoid redundant code, most code in fact implement a class specific method that is called by draw(). This draw() function is implemented with noexcept nogil enforced, which means Cython is not allowed to access Python fields or to increase/decrease any object refcount. This constraint generates efficient C++ code that should be pretty close in performance to native C++ code. 15 | 16 | The viewport holds some temporary information needed during rendering, which avoid passing arguments to draw(). 17 | 18 | Some parents define a clipping region, and rendering cannot be done by children outside the clipping region. 19 | 20 | ## Item locks 21 | 22 | One of the main issues with DPG is it had a single lock to protect any item access during rendering. However it had issues and it was not uncommon to have deadlocks when doing multithreading due to the GIL. 23 | 24 | DearCyGUI instead uses a lock per item. Locks are known to be very cheap when there is no contention, which is going to be almost always in DCG's usecase. 25 | 26 | The lock rule to guarantee thread safety and no deadlock is: 27 | The topmost lock in the rendering tree must be acquired before any lower lock. 28 | For instance imagine you want to access an item field. You only need to lock this item. Now imagine you need to change the parent of the item. In that case you need to acquire the parent lock BEFORE acquiring the item lock. This complex mecanism is implemented by baseItem, and for simplicity, when moving an item, it is first detached of its former parent, and then attached to its new parent. 29 | In that specific case, as the parent might change when the item lock is not acquired, baseItem implements locking first the item, then trying to lock the parent, and if it fails, unlock the item, then lock again the item, then try to lock the parent, etc. 30 | In all other cases, the locks are always acquired in a specific order to guarantee the lock rule. For instance during rendering, the viewport lock is first held, then the lock of the last child, which then locks its previous siblings, etc. Then the first child renders itself, and locks the lock of its last child, etc. Thus during rendering, when an item is rendered, we hold the lock of this item, as well as all its next siblings, and the lock of its parent, all its next siblings, etc. As the rendering tree is ... a tree, that generally means only a portion of the locks of the tree is held at a given time. 31 | 32 | As in practice the rendering of the item tree itself is not as expensive as can be other OS operations to prepare and finish rendering, the viewport is actually associated with three locks, such that one can access viewport fields or lock the main viewport lock while slow OS operations are done. 33 | 34 | In order to avoid any deadlock caused by the gil, whenever an entry point holding the gil requires a lock, we actually first only 'try' to lock, and if we fail, then we release the gil and block until the lock is achieved. 35 | 36 | 37 | ## Child slots 38 | 39 | There are several main classes of items from which all items derive. Almost all items derive from baseItem which defines an item that can have a tag, can be attached to parent, have siblings, etc. Exceptions to that are Callback and SharedValue. 40 | 41 | Subclassing baseItem are some other base classes. uiItem, drawingItem, baseTheme, baseHandler, plotElement. Each of these will get into different child slots and are incompatible to each other as siblings. Any subclass of these elements can be siblings and children of the same parents. Each parent defines which children base class they support. It is similar but not equivalent to DPG children slots. 42 | 43 | uiItem is the base class of most elements. It defines an object with a state, which accepts handlers, themes and optionally a Callback and a SharedValue. By default the position of the item corresponds to the current internal cursor position, which is incremented after every item (with a line jump by default). It accepts positioning arguments to override that. 44 | 45 | drawingItem is a simpler class of elements which map to imgui drawing operations. They have no state maintained, no callback, theme, value, etc. Their coordinates are in screen space transformed by their parent (if in a window, the coordinates are offsetted. If in a plot, the coordinates are offsetted and scaled.) 46 | 47 | baseTheme corresponds to theme elements that can be bound to items 48 | 49 | baseHandler corresponds to handler elements that can be bound to items 50 | 51 | plotElement corresponds to plot children and define the axes to which they relate to. 52 | 53 | All element subclass these base classes and override their main rendering methods. It is possible to subclass these elements in Python or Cython and be inserted as siblings to elements of the same base class. 54 | 55 | ## Everything is attributes 56 | 57 | In DPG, all items were associated with item configuration attributes, states and status. During item creation, some parameters were passed as mandatory as positional parameters. 58 | 59 | DCG uses a slightly different paradigm, as no positional parameters are required anymore. In addition DCG uses the full potential of implementing Python extension classes that Cython enables to do easily. On every DCG item, one can access the attributes as you would in any python class. This is very fast, and enables significant performance gains compared to DPG's configure. 60 | 61 | Under the hood, DCG implements all these attributes as class properties, and during initialisation, a table of all the properties, their names and their functions set read and write them are passed by Cython to Python. A docstring is passed to every attribute, thus one can use the help() command to get the information on an attribute. a Pyi is also generated by Cython to enable autocompletion in compatible code editors. Sadly this autocompletion is not useful when creating an item, but it is very well functionnal when accessing attributes. 62 | 63 | When an item is created, DCG first initializes all class specific fields with default values. Then in a second step all the names parameters are converted into attributes. 64 | Basically item creation is a loop doing: 65 | ```python 66 | for (key, value) in kwargs.items(): 67 | if hasattr(self, key): 68 | setattr(self, key, value) 69 | ``` 70 | In other words any optional parameter you pass during item creation is equivalent to setting the attribute of the same name after you have created the item. 71 | 72 | Note that this is a slight abuse on our side on the intent of python extension attributes, are they are meant to be cheap access to object attributes (with potential cheap conversion), and more heavy functions should rather be implemented as functions. item.parent = other_item should probably not be an attribute in this spirit, but this allows to implement better compatibility with DPG. 73 | 74 | In the spirit of everything is attributes, Themes override getattr and setattr in order to be able to set theme fields directly (and only what you have set is passed to the object). -------------------------------------------------------------------------------- /FEATURES.md: -------------------------------------------------------------------------------- 1 | ## New features that DearCyGui supports 2 | 3 | # Items 4 | - You can subclass any item in Python and create new items that can be inserted in the rendering tree. 5 | - You can subclass any item in Cython and create new items that can be inserted in the rendering tree. In Cython, contrary to Python, you can access the item internal fields (states, etc) directly and override the drawing function. This can be useful for advanced usage, but is more complex. Python subclassing should be sufficient for most. 6 | - Writing/reading item attributes is much faster (benchmark shows ~40 times faster when almost no item is created. But as DPG item access times is linear in the number of items, the gap quickly grows with the number of items). In addition the attributes can be accessed during rendering if rendering is not using the item at the moment. 7 | - Possibility for uiItems to access their position relative to the parent, the window or the viewport, and to set the placement relative to any of these. 8 | - Contrary to DPG which had a global lock, every item has its own lock. 9 | - And item can be created without any parent, and be attached later. 10 | - A lot of states that were not meaningful and were sometimes misleading were removed or raise an error when not valid. For instance Drawing items do not have an 'ok' or a 'visible' state as in practice they were always True no matter what. 11 | - A lot of states were not correctly updated, and special care has been done to properly update them. You can trust the value of the states much more. 12 | 13 | # Viewport 14 | - wait_for_input is now more useful as wake() enables to force rendering 15 | of a frame even if no mouse/key input is detected. 16 | - The viewport is an item like any other. Any item which is connected to the viewport is rendered. The viewport supports the same attributes as the other items (fewer specific attributes). 17 | - Several locks are used. Each item has its own lock, and the viewport uses three different locks to protect several parts of the rendering process that can take time. Only the needed locks are taken at a given time, thus accelerating multithread acccess to the items. 18 | 19 | 20 | # Layouts 21 | Layouts replace Groups. 22 | - You can subclass the main Layout class to do custom layouts by implement as callback a function that organizes the children of the Layout. The callback is called whenever the parent area changes or a new child is added. 23 | - Horizontal and vertical layouts support left/center/right/justified alignment, as well as manual alignment, where you pass a list of positions (which can be percentages) for the items. The callback is called when the parent are changes to give you a chance to pass new positions. 24 | 25 | # Handlers 26 | - The global handlers and item handlers categories are merged. 27 | - You don't need a global / item registry anymore. 28 | - You can combine handlers with conditions (test this handler only if these handlers are true) 29 | - You can combine handlers with NONE, ANY or ALL. 30 | - New handlers enable to catch mouse dragging an item. 31 | - You can create custom handlers with python subclassing. For instance you can have a handler that holds True only if a specific other item is visible, or if a user condition is true, or if the framecount is a multiple of 5, or anything you want. 32 | - As a result of all the above, you can make it so specific callbacks are only called if very specific conditions are met. This contrasts with DPG, where you had to check the specific conditions in your callback, and these might not be True anymore by the time you handle the callback. 33 | - You can append handlers to an item that already has handlers. 34 | - repeat argument for KeyPressHandler 35 | 36 | # Callbacks 37 | - While handlers only accept a single callback (because you can just duplicate your handlers if you need several callbacks to be called), item callbacks accept appending several callbacks. 38 | - When the callback fails for any reason, a detailed traceback is printed in the console. 39 | - Callbacks are issued right away, and can run while rendering is performed and manipulate items of the rendering tree while rendering is performed (as long as rendering is not using these items). 40 | - Since global handlers and item handlers were merged, a break in compatibility was required for callback inputs in order to indicate to which item the global handler was bound when it was triggered. The DPG wrapper handles passing the old arguments (which were sender, call_data, user_data), but normal DCG wrappers use instead sender, target_item, call_data. target_item can be the sender (item callback for instance). user_data is dropped as it can be simply accessed doing sender.user_data. In addition sender and target_item are directly the python objects rather than uuids. 41 | - Callbacks now work properly for bound methods (self.your_function). 42 | 43 | # Textures 44 | - Support for R, RG, RGB, RGBA in both uint8 and float32 formats 45 | - Textures are uploaded only once when you set their value, rather than every frame rendered. 46 | 47 | # Fonts 48 | - Default font looks much nicer. 49 | - Support for bold, italics and bold-italics in the default font. 50 | - Helpers and documentation to make your own fonts. 51 | 52 | # Plots 53 | - Support for X2 and X3 axes 54 | - Support for handlers on the axes 55 | - Support for zero copy when passing plot data (requires int32, float32 or float64 data) 56 | - It is possible to fit the plot to contained drawing items 57 | - Extended Custom Plot functionnality (possibility to add legend to groups of drawing items drawn in plot space) 58 | 59 | # DPI scaling 60 | - Support for automated and manual handling of the screen requested dpi scaling 61 | - Possibility to set a global scale factor in addition to the dpi scaling 62 | 63 | ## Features that DearCyGui does not support yet 64 | - Tables 65 | - Drag rects/lines 66 | - colormaps 67 | - some types of plots 68 | - Colormaps 69 | - DragNDrop. Not 100% sure yet it will be supported. 70 | 71 | ## Features that DearCyGui does not intend to support 72 | - Filter sets: Filter sets in DPG allow to give names to items, and have their parent filter which parent should be drawn or not depending on the names given. The reason that DCG will not implement this feature is because first it tries to avoid bloat, and adding a filter field that will almost never be useful is not good for that, second this feature would be much more efficient if implemented on the user side, as the filter will be run every frame, rather than just when needed. Instead the user can store his filters in user_data and manipulate the `show` field to his liking. 73 | - Knobs, 3D sliders: May be implemented as utilities, but will not be in core DCG. 74 | - Plot query rects: This type of feature needs a lot of customization. The new features of DCG enables the user to implement their own query rects. Some helpers will be available as utilities. 75 | 76 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 DearCyGui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include dearcygui/backends/ *.h 2 | recursive-include thirdparty/freetype/ * 3 | recursive-include thirdparty/gl3w/ *.h 4 | recursive-include thirdparty/imgui/ * 5 | recursive-include thirdparty/imnodes/ * 6 | recursive-include thirdparty/implot/ * 7 | recursive-include thirdparty/latin-modern-roman/ * 8 | recursive-include thirdparty/SDL/ * 9 | recursive-include dearcygui/ *.pyx 10 | recursive-include dearcygui/ *.pxd 11 | recursive-include dearcygui/ *.py 12 | recursive-include dearcygui/ *.typed 13 | recursive-include dearcygui/docs/ *.md 14 | include dearcygui/imgui_config.h 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Development for DearCyGui was moved to [https://github.com/DearCyGui/DearCyGui/]** 2 | 3 | ## DearCyGui: a Multi-platform (Windows, Linux, Mac) GUI library for Python 4 | 5 | DearCyGui is an easy to use library to make graphical interfaces in Python. 6 | 7 | Main features are: 8 | * *Fast*. Speed to create and manage the interface has been one of the main focus. 9 | * *Dynamic interface*. It is based on Dear ImGui (https://github.com/ocornut/imgui) to render. Each frame is new, and there is no cost if the content changes a lot a frame to another. 10 | * Unlike other libraries based on Dear ImGui that provide access to its low-level API, DearCyGui is more *high level*. As a result your code is easier to read, and less prone to errors. Python is not adapted to call the low-level API as it would quickly become slow (as you would be required to re-render every frame). In DearCyGui you build objects and the backend handles calling the low-level API. 11 | * *Customization*. You can create your own widgets or draw elements, and alter how they are rendered. 12 | * *Even more customization*, if using Cython. You can `cimport` DearCyGui and directly access the item internals or create your own drawing functions. 13 | * Adapted for *Object Oriented Programming* (All items can be subclassed), though you can use other styles as well. 14 | * Uses *SDL3*, and thus has high quality and up-to-date support for DPI handling, etc. 15 | * MIT Licensed. 16 | * Low GPU/CPU usage. 17 | 18 | 19 | ## Installing 20 | `pip install dearcygui` to install an old version 21 | 22 | Latest development version: 23 | ``` 24 | git clone --recurse-submodules https://github.com/DearCyGui/DearCyGui 25 | cd DearCyGui 26 | pip install . 27 | ``` 28 | 29 | ## Examples & Documentation 30 | 31 | * Demos Gallery: [https://github.com/DearCyGui/Demos] 32 | * Documentation: See the `docs` directory or run `documentation.py` in the demos 33 | 34 | 35 | ## Design Philosophy 36 | DearCyGui bridges the gap between Python's ease of use and Dear ImGui's performance. Rather than making direct Dear ImGui calls each frame from Python (which would be slow), DearCyGui: 37 | 38 | * Uses objects created in Python but managed by compiled C++ code (generated with Cython) 39 | * C++ code handles the per-frame rendering via Dear ImGui 40 | * Python code defines the UI structure and handles application logic 41 | * Cython enables seamless integration between Python and C++ 42 | 43 | This architecture provides: 44 | * Fast rendering performance 45 | * Clean, Pythonic API 46 | * Full Dear ImGui functionality 47 | * Extensibility through subclassing 48 | 49 | ## Credits 50 | DearCyGui began as a Cython reimplementation of DearPyGui (https://github.com/hoffstadt/DearPyGui) but has evolved with additional features and a different architecture. 51 | 52 | This project uses: 53 | * Dear ImGui (https://github.com/ocornut/imgui), and ImPlot, ImNodes. 54 | * SDL3 55 | * FreeType 56 | * Cython 57 | 58 | Huge thanks to the Cython team which have enabled this project to see the light of the day. 59 | 60 | Portions of this software are copyright © 2024 The FreeType 61 | Project (www.freetype.org). All rights reserved. 62 | -------------------------------------------------------------------------------- /dearcygui/__init__.pxd: -------------------------------------------------------------------------------- 1 | 2 | from dearcygui.core cimport * 3 | from dearcygui.c_types cimport * 4 | from dearcygui.draw cimport * 5 | from dearcygui.font cimport * 6 | from dearcygui.handler cimport * 7 | from dearcygui.layout cimport * 8 | from dearcygui.os cimport * 9 | from dearcygui.plot cimport * 10 | from dearcygui.theme cimport * 11 | from dearcygui.types cimport * 12 | from dearcygui.widget cimport * 13 | 14 | # We do not import imgui_types on purpose, 15 | # to enable cython interfacing without imgui 16 | # instead we provide this helper to do manual 17 | # imgui calls 18 | from dearcygui cimport imgui -------------------------------------------------------------------------------- /dearcygui/__init__.py: -------------------------------------------------------------------------------- 1 | from .dearcygui import bootstrap_cython_submodules 2 | bootstrap_cython_submodules() 3 | 4 | from . import constants 5 | from dearcygui.core import * 6 | from dearcygui.draw import * 7 | from dearcygui.font import * 8 | from dearcygui.handler import * 9 | from dearcygui.imgui_types import * 10 | from dearcygui.layout import * 11 | from dearcygui.os import * 12 | from dearcygui.plot import * 13 | from dearcygui.theme import * 14 | from dearcygui.types import * 15 | from dearcygui.widget import * 16 | 17 | # constants is overwritten by dearcygui.constants 18 | del core 19 | del draw 20 | del handler 21 | del layout 22 | del plot 23 | del os 24 | del theme 25 | del types 26 | del widget 27 | del bootstrap_cython_submodules 28 | from . import utils 29 | -------------------------------------------------------------------------------- /dearcygui/backends/__init__.pxd: -------------------------------------------------------------------------------- 1 | from dearcygui.backends cimport backend 2 | from dearcygui.backends cimport time -------------------------------------------------------------------------------- /dearcygui/backends/backend.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef void (*on_resize_fun)(void*); 9 | typedef void (*on_close_fun)(void*); 10 | typedef void (*render_fun)(void*); 11 | typedef void (*on_drop_fun)(void*, int, const char*); 12 | 13 | 14 | class platformViewport 15 | { 16 | public: 17 | platformViewport() = default; 18 | virtual ~platformViewport() = default; 19 | 20 | virtual void cleanup() = 0; 21 | virtual bool initialize(bool start_minimized, bool start_maximized) = 0; 22 | virtual void maximize() = 0; 23 | virtual void minimize() = 0; 24 | virtual void restore() = 0; 25 | virtual void processEvents() = 0; 26 | virtual bool renderFrame(bool can_skip_presenting) = 0; 27 | virtual void present() = 0; 28 | virtual void toggleFullScreen() = 0; 29 | virtual void wakeRendering() = 0; 30 | virtual void makeUploadContextCurrent() = 0; 31 | virtual void releaseUploadContext() = 0; 32 | 33 | // makeUploadContextCurrent must be called before any texture 34 | // operations are performed, and releaseUploadContext must be 35 | // called after the texture operations are done. 36 | virtual void* allocateTexture(unsigned width, unsigned height, unsigned num_chans, 37 | unsigned dynamic, unsigned type, unsigned filtering_mode) = 0; 38 | virtual void freeTexture(void* texture) = 0; 39 | virtual bool updateDynamicTexture(void* texture, unsigned width, unsigned height, 40 | unsigned num_chans, unsigned type, void* data, 41 | unsigned src_stride) = 0; 42 | virtual bool updateStaticTexture(void* texture, unsigned width, unsigned height, 43 | unsigned num_chans, unsigned type, void* data, 44 | unsigned src_stride) = 0; 45 | virtual bool downloadBackBuffer(void* data, int size) = 0; 46 | 47 | // Window state 48 | float dpiScale = 1.; 49 | bool isFullScreen = false; 50 | bool isMinimized = false; 51 | bool isMaximized = false; 52 | 53 | // Rendering properties 54 | float clearColor[4] = { 0., 0., 0., 1. }; 55 | bool hasModesChanged = false; 56 | bool hasVSync = true; 57 | bool waitForEvents = false; 58 | bool shouldSkipPresenting = false; 59 | std::atomic activityDetected{true}; 60 | std::atomic needsRefresh{true}; 61 | 62 | // Window properties 63 | std::string iconSmall; // not allowed to change after init 64 | std::string iconLarge; // same 65 | std::string windowTitle = "DearCyGui Window"; 66 | bool titleChangeRequested = false; 67 | bool windowResizable = true; 68 | bool windowAlwaysOnTop = false; 69 | bool windowDecorated = true; 70 | bool windowPropertyChangeRequested = false; 71 | 72 | // Window position/size 73 | int positionX = 100; 74 | int positionY = 100; 75 | bool positionChangeRequested = false; 76 | unsigned minWidth = 250; 77 | unsigned minHeight = 250; 78 | unsigned maxWidth = 10000; 79 | unsigned maxHeight = 10000; 80 | int frameWidth = 1280; // frame buffer size 81 | int frameHeight = 800; 82 | int windowWidth = 1280; // window size 83 | int windowHeight = 800; 84 | bool sizeChangeRequested = false; 85 | 86 | protected: 87 | 88 | // Callbacks 89 | render_fun renderCallback; 90 | on_resize_fun resizeCallback; 91 | on_close_fun closeCallback; 92 | on_drop_fun dropCallback; 93 | void* callbackData; 94 | 95 | // Utility the does a cheap test for 96 | // there has been any activity the 97 | // requires a render. 98 | static bool fastActivityCheck(); 99 | }; 100 | 101 | class SDLViewport : public platformViewport 102 | { 103 | public: 104 | virtual void cleanup() override; 105 | virtual bool initialize(bool start_minimized, bool start_maximized) override; 106 | virtual void maximize() override; 107 | virtual void minimize() override; 108 | virtual void restore() override; 109 | virtual void processEvents() override; 110 | virtual bool renderFrame(bool can_skip_presenting) override; 111 | virtual void present() override; 112 | virtual void toggleFullScreen() override; 113 | virtual void wakeRendering() override; 114 | virtual void makeUploadContextCurrent() override; 115 | virtual void releaseUploadContext() override; 116 | 117 | virtual void* allocateTexture(unsigned width, unsigned height, unsigned num_chans, 118 | unsigned dynamic, unsigned type, unsigned filtering_mode) override; 119 | virtual void freeTexture(void* texture) override; 120 | virtual bool updateDynamicTexture(void* texture, unsigned width, unsigned height, 121 | unsigned num_chans, unsigned type, void* data, 122 | unsigned src_stride) override; 123 | virtual bool updateStaticTexture(void* texture, unsigned width, unsigned height, 124 | unsigned num_chans, unsigned type, void* data, 125 | unsigned src_stride) override; 126 | virtual bool downloadBackBuffer(void* data, int size) override; 127 | 128 | static SDLViewport* create(render_fun render, 129 | on_resize_fun on_resize, 130 | on_close_fun on_close, 131 | on_drop_fun on_drop, 132 | void* callback_data); 133 | 134 | private: 135 | SDL_Window* windowHandle = nullptr; 136 | SDL_Window* uploadWindowHandle = nullptr; 137 | SDL_GLContext glContext = nullptr; 138 | SDL_GLContext uploadGLContext = nullptr; 139 | std::mutex renderContextLock; 140 | std::mutex uploadContextLock; 141 | bool hasOpenGL3Init = false; 142 | bool hasSDL3Init = false; 143 | bool hasResized = false; 144 | 145 | void preparePresentFrame(); 146 | }; -------------------------------------------------------------------------------- /dearcygui/backends/backend.pxd: -------------------------------------------------------------------------------- 1 | from libcpp.atomic cimport atomic 2 | from libcpp.string cimport string 3 | 4 | cdef extern from "backend.h" nogil: 5 | 6 | ctypedef void (*on_resize_fun)(void*) 7 | ctypedef void (*on_close_fun)(void*) 8 | ctypedef void (*render_fun)(void*) 9 | ctypedef void (*on_drop_fun)(void*, int, const char*) 10 | 11 | cdef cppclass platformViewport: 12 | # Virtual methods 13 | void cleanup() 14 | bint initialize(bint, bint) 15 | void maximize() 16 | void minimize() 17 | void restore() 18 | void processEvents() 19 | bint renderFrame(bint) 20 | void present() 21 | void toggleFullScreen() 22 | void wakeRendering() 23 | void makeUploadContextCurrent() 24 | void releaseUploadContext() 25 | 26 | # Texture methods 27 | void* allocateTexture(unsigned, unsigned, unsigned, unsigned, unsigned, unsigned) 28 | void freeTexture(void*) 29 | bint updateDynamicTexture(void*, unsigned, unsigned, unsigned, unsigned, void*, unsigned) 30 | bint updateStaticTexture(void*, unsigned, unsigned, unsigned, unsigned, void*, unsigned) 31 | 32 | bint downloadBackBuffer(void*, int) 33 | 34 | # Public members 35 | float dpiScale 36 | bint isFullScreen 37 | bint isMinimized 38 | bint isMaximized 39 | 40 | # Rendering properties 41 | float[4] clearColor 42 | bint hasVSync 43 | bint waitForEvents 44 | bint shouldSkipPresenting 45 | atomic[bint] activityDetected 46 | atomic[bint] needsRefresh 47 | 48 | # Window properties 49 | string iconSmall 50 | string iconLarge 51 | string windowTitle 52 | bint titleChangeRequested 53 | bint windowResizable 54 | bint windowAlwaysOnTop 55 | bint windowDecorated 56 | bint windowPropertyChangeRequested 57 | 58 | # Window position/size 59 | int positionX 60 | int positionY 61 | bint positionChangeRequested 62 | unsigned minWidth 63 | unsigned minHeight 64 | unsigned maxWidth 65 | unsigned maxHeight 66 | int frameWidth 67 | int frameHeight 68 | int windowWidth 69 | int windowHeight 70 | bint sizeChangeRequested 71 | 72 | # Protected members 73 | string windowTitle 74 | string iconSmall 75 | string iconLarge 76 | render_fun renderCallback 77 | on_resize_fun resizeCallback 78 | on_close_fun closeCallback 79 | void* callbackData 80 | 81 | cdef cppclass SDLViewport(platformViewport): 82 | @staticmethod 83 | platformViewport* create(render_fun, on_resize_fun, on_close_fun, on_drop_fun, void*) 84 | 85 | -------------------------------------------------------------------------------- /dearcygui/backends/imgui_impl_sdl3.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for SDL3 (*EXPERIMENTAL*) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL3 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**) 6 | 7 | // Implemented features: 8 | // [X] Platform: Clipboard support. 9 | // [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen. 10 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy SDL_SCANCODE_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 11 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 12 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 13 | 14 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 15 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 16 | // Learn about Dear ImGui: 17 | // - FAQ https://dearimgui.com/faq 18 | // - Getting Started https://dearimgui.com/getting-started 19 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 20 | // - Introduction, links and more at the top of imgui.cpp 21 | 22 | #pragma once 23 | #include "imgui.h" // IMGUI_IMPL_API 24 | #ifndef IMGUI_DISABLE 25 | 26 | struct SDL_Window; 27 | struct SDL_Renderer; 28 | struct SDL_Gamepad; 29 | typedef union SDL_Event SDL_Event; 30 | 31 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 32 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 33 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForVulkan(SDL_Window* window); 34 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForD3D(SDL_Window* window); 35 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForMetal(SDL_Window* window); 36 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForSDLRenderer(SDL_Window* window, SDL_Renderer* renderer); 37 | IMGUI_IMPL_API bool ImGui_ImplSDL3_InitForOther(SDL_Window* window); 38 | IMGUI_IMPL_API void ImGui_ImplSDL3_Shutdown(); 39 | IMGUI_IMPL_API void ImGui_ImplSDL3_NewFrame(); 40 | IMGUI_IMPL_API bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event); 41 | 42 | // Gamepad selection automatically starts in AutoFirst mode, picking first available SDL_Gamepad. You may override this. 43 | // When using manual mode, caller is responsible for opening/closing gamepad. 44 | enum ImGui_ImplSDL3_GamepadMode { ImGui_ImplSDL3_GamepadMode_AutoFirst, ImGui_ImplSDL3_GamepadMode_AutoAll, ImGui_ImplSDL3_GamepadMode_Manual }; 45 | IMGUI_IMPL_API void ImGui_ImplSDL3_SetGamepadMode(ImGui_ImplSDL3_GamepadMode mode, SDL_Gamepad** manual_gamepads_array = NULL, int manual_gamepads_count = -1); 46 | 47 | #endif // #ifndef IMGUI_DISABLE 48 | -------------------------------------------------------------------------------- /dearcygui/backends/time.pxd: -------------------------------------------------------------------------------- 1 | """ 2 | Cython implementation of (parts of) the standard library time module. 3 | 4 | Note: On implementations that lack a C-API for monotonic/perfcounter clocks 5 | (like PyPy), the fallback code uses the system clock which may return absolute 6 | time values from a different value range, differing from those provided by 7 | Python's "time" module. 8 | """ 9 | 10 | from libc.stdint cimport int64_t 11 | from cpython.exc cimport PyErr_SetFromErrno 12 | 13 | cdef extern from *: 14 | """ 15 | #if PY_VERSION_HEX >= 0x030d00b1 || defined(PyTime_t) 16 | #define __Pyx_PyTime_t PyTime_t 17 | #else 18 | #define __Pyx_PyTime_t _PyTime_t 19 | #endif 20 | 21 | #if PY_VERSION_HEX >= 0x030d00b1 || defined(PyTime_TimeRaw) 22 | static CYTHON_INLINE __Pyx_PyTime_t __Pyx_PyTime_TimeRaw(void) { 23 | __Pyx_PyTime_t tic; 24 | (void) PyTime_TimeRaw(&tic); 25 | return tic; 26 | } 27 | #else 28 | #define __Pyx_PyTime_TimeRaw() _PyTime_GetSystemClock() 29 | #endif 30 | 31 | #if PY_VERSION_HEX >= 0x030d00b1 || defined(PyTime_MonotonicRaw) 32 | static CYTHON_INLINE __Pyx_PyTime_t __Pyx_PyTime_MonotonicRaw(void) { 33 | __Pyx_PyTime_t tic; 34 | (void) PyTime_MonotonicRaw(&tic); 35 | return tic; 36 | } 37 | #elif CYTHON_COMPILING_IN_PYPY && !defined(_PyTime_GetMonotonicClock) 38 | #define __Pyx_PyTime_MonotonicRaw() _PyTime_GetSystemClock() 39 | #else 40 | #define __Pyx_PyTime_MonotonicRaw() _PyTime_GetMonotonicClock() 41 | #endif 42 | 43 | #if PY_VERSION_HEX >= 0x030d00b1 || defined(PyTime_PerfCounterRaw) 44 | static CYTHON_INLINE __Pyx_PyTime_t __Pyx_PyTime_PerfCounterRaw(void) { 45 | __Pyx_PyTime_t tic; 46 | (void) PyTime_PerfCounterRaw(&tic); 47 | return tic; 48 | } 49 | #elif CYTHON_COMPILING_IN_PYPY && !defined(_PyTime_GetPerfCounter) 50 | #define __Pyx_PyTime_PerfCounterRaw() __Pyx_PyTime_MonotonicRaw() 51 | #else 52 | #define __Pyx_PyTime_PerfCounterRaw() _PyTime_GetPerfCounter() 53 | #endif 54 | 55 | #if PY_VERSION_HEX >= 0x030d00b1 || defined(PyTime_AsSecondsDouble) 56 | #define __Pyx_PyTime_AsSecondsDouble(t) PyTime_AsSecondsDouble(t) 57 | #else 58 | #define __Pyx_PyTime_AsSecondsDouble(t) _PyTime_AsSecondsDouble(t) 59 | #endif 60 | """ 61 | ctypedef int64_t PyTime_t "__Pyx_PyTime_t" 62 | 63 | ctypedef PyTime_t _PyTime_t "__Pyx_PyTime_t" # legacy, use "PyTime_t" instead 64 | PyTime_t PyTime_TimeUnchecked "__Pyx_PyTime_TimeRaw" () noexcept nogil # legacy, use "PyTime_TimeRaw" instead 65 | 66 | PyTime_t PyTime_TimeRaw "__Pyx_PyTime_TimeRaw" () noexcept nogil 67 | PyTime_t PyTime_MonotonicRaw "__Pyx_PyTime_MonotonicRaw" () noexcept nogil 68 | PyTime_t PyTime_PerfCounterRaw "__Pyx_PyTime_PerfCounterRaw" () noexcept nogil 69 | double PyTime_AsSecondsDouble "__Pyx_PyTime_AsSecondsDouble" (PyTime_t t) noexcept nogil 70 | 71 | 72 | from libc.time cimport ( 73 | tm, 74 | time_t, 75 | localtime as libc_localtime, 76 | ) 77 | 78 | 79 | cdef inline double time() noexcept nogil: 80 | cdef PyTime_t tic = PyTime_TimeRaw() 81 | return PyTime_AsSecondsDouble(tic) 82 | 83 | 84 | cdef inline int64_t time_ns() noexcept nogil: 85 | return PyTime_TimeRaw() 86 | 87 | 88 | cdef inline double perf_counter() noexcept nogil: 89 | cdef PyTime_t tic = PyTime_PerfCounterRaw() 90 | return PyTime_AsSecondsDouble(tic) 91 | 92 | 93 | cdef inline int64_t perf_counter_ns() noexcept nogil: 94 | return PyTime_PerfCounterRaw() 95 | 96 | 97 | cdef inline double monotonic() noexcept nogil: 98 | cdef PyTime_t tic = PyTime_MonotonicRaw() 99 | return PyTime_AsSecondsDouble(tic) 100 | 101 | 102 | cdef inline int64_t monotonic_ns() noexcept nogil: 103 | return PyTime_MonotonicRaw() 104 | 105 | 106 | cdef inline int _raise_from_errno() except -1 with gil: 107 | PyErr_SetFromErrno(RuntimeError) 108 | return -1 # Let the C compiler know that this function always raises. 109 | 110 | 111 | cdef inline tm localtime() except * nogil: 112 | """ 113 | Analogue to the stdlib time.localtime. The returned struct 114 | has some entries that the stdlib version does not: tm_gmtoff, tm_zone 115 | """ 116 | cdef: 117 | time_t tic = time() 118 | tm* result 119 | 120 | result = libc_localtime(&tic) 121 | if result is NULL: 122 | _raise_from_errno() 123 | # Fix 0-based date values (and the 1900-based year). 124 | # See tmtotuple() in https://github.com/python/cpython/blob/master/Modules/timemodule.c 125 | result.tm_year += 1900 126 | result.tm_mon += 1 127 | result.tm_wday = ((result.tm_wday + 6) % 7) 128 | result.tm_yday += 1 129 | return result[0] 130 | -------------------------------------------------------------------------------- /dearcygui/c_types.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from * nogil: 2 | """ 3 | struct float2 { 4 | float p[2]; 5 | }; 6 | typedef struct float2 float2; 7 | struct Vec2 { 8 | float x; 9 | float y; 10 | }; 11 | typedef struct Vec2 Vec2; 12 | struct Vec4 { 13 | float x; 14 | float y; 15 | float z; 16 | float w; 17 | }; 18 | typedef struct Vec4 Vec4; 19 | struct double2 { 20 | double p[2]; 21 | }; 22 | typedef struct double2 double2; 23 | """ 24 | ctypedef struct float2: 25 | float[2] p 26 | ctypedef struct Vec2: 27 | float x 28 | float y 29 | ctypedef struct Vec4: 30 | float x 31 | float y 32 | float z 33 | float w 34 | ctypedef struct double2: 35 | double[2] p 36 | 37 | cdef inline Vec2 make_Vec2(float x, float y) noexcept nogil: 38 | cdef Vec2 v 39 | v.x = x 40 | v.y = y 41 | return v 42 | 43 | cdef inline void swap_Vec2(Vec2 &a, Vec2 &b) noexcept nogil: 44 | cdef float x, y 45 | x = a.x 46 | y = a.y 47 | a.x = b.x 48 | a.y = b.y 49 | b.x = x 50 | b.y = y 51 | 52 | # generated with pxdgen /usr/include/c++/11/mutex -x c++ 53 | 54 | cdef extern from "" namespace "std" nogil: 55 | cppclass mutex: 56 | mutex() 57 | mutex(mutex&) 58 | mutex& operator=(mutex&) 59 | void lock() 60 | bint try_lock() 61 | void unlock() 62 | cppclass __condvar: 63 | __condvar() 64 | __condvar(__condvar&) 65 | __condvar& operator=(__condvar&) 66 | void wait(mutex&) 67 | #void wait_until(mutex&, timespec&) 68 | #void wait_until(mutex&, clockid_t, timespec&) 69 | void notify_one() 70 | void notify_all() 71 | cppclass defer_lock_t: 72 | defer_lock_t() 73 | cppclass try_to_lock_t: 74 | try_to_lock_t() 75 | cppclass adopt_lock_t: 76 | adopt_lock_t() 77 | cppclass recursive_mutex: 78 | recursive_mutex() 79 | recursive_mutex(recursive_mutex&) 80 | recursive_mutex& operator=(recursive_mutex&) 81 | void lock() 82 | bint try_lock() 83 | void unlock() 84 | #int try_lock[_Lock1, _Lock2, _Lock3](_Lock1&, _Lock2&, _Lock3 &...) 85 | #void lock[_L1, _L2, _L3](_L1&, _L2&, _L3 &...) 86 | cppclass lock_guard[_Mutex]: 87 | ctypedef _Mutex mutex_type 88 | lock_guard(mutex_type&) 89 | lock_guard(mutex_type&, adopt_lock_t) 90 | lock_guard(lock_guard&) 91 | lock_guard& operator=(lock_guard&) 92 | cppclass scoped_lock[_MutexTypes]: 93 | #scoped_lock(_MutexTypes &..., ...) 94 | scoped_lock() 95 | scoped_lock(_MutexTypes &) 96 | #scoped_lock(adopt_lock_t, _MutexTypes &...) 97 | #scoped_lock(scoped_lock&) 98 | scoped_lock& operator=(scoped_lock&) 99 | cppclass unique_lock[_Mutex]: 100 | ctypedef _Mutex mutex_type 101 | unique_lock() 102 | unique_lock(mutex_type&) 103 | unique_lock(mutex_type&, defer_lock_t) 104 | unique_lock(mutex_type&, try_to_lock_t) 105 | unique_lock(mutex_type&, adopt_lock_t) 106 | unique_lock(unique_lock&) 107 | unique_lock& operator=(unique_lock&) 108 | #unique_lock(unique_lock&&) 109 | #unique_lock& operator=(unique_lock&&) 110 | void lock() 111 | bint try_lock() 112 | void unlock() 113 | void swap(unique_lock&) 114 | mutex_type* release() 115 | bint owns_lock() 116 | mutex_type* mutex() 117 | void swap[_Mutex](unique_lock[_Mutex]&, unique_lock[_Mutex]&) -------------------------------------------------------------------------------- /dearcygui/constants.pyi: -------------------------------------------------------------------------------- 1 | """ 2 | This type stub file was generated by cyright. 3 | """ 4 | 5 | mvDir_None = ... 6 | mvDir_Left = ... 7 | mvDir_Right = ... 8 | mvDir_Up = ... 9 | mvDir_Down = ... 10 | mvColorEdit_AlphaPreviewNone = ... 11 | mvColorEdit_AlphaPreview = ... 12 | mvColorEdit_AlphaPreviewHalf = ... 13 | mvColorEdit_uint8 = ... 14 | mvColorEdit_float = ... 15 | mvColorEdit_rgb = ... 16 | mvColorEdit_hsv = ... 17 | mvColorEdit_hex = ... 18 | mvColorEdit_input_rgb = ... 19 | mvColorEdit_input_hsv = ... 20 | mvPlotColormap_Default = ... 21 | mvPlotColormap_Deep = ... 22 | mvPlotColormap_Dark = ... 23 | mvPlotColormap_Pastel = ... 24 | mvPlotColormap_Paired = ... 25 | mvPlotColormap_Viridis = ... 26 | mvPlotColormap_Plasma = ... 27 | mvPlotColormap_Hot = ... 28 | mvPlotColormap_Cool = ... 29 | mvPlotColormap_Pink = ... 30 | mvPlotColormap_Jet = ... 31 | mvPlotColormap_Twilight = ... 32 | mvPlotColormap_RdBu = ... 33 | mvPlotColormap_BrBG = ... 34 | mvPlotColormap_PiYG = ... 35 | mvPlotColormap_Spectral = ... 36 | mvPlotColormap_Greys = ... 37 | mvColorPicker_bar = ... 38 | mvColorPicker_wheel = ... 39 | mvNode_PinShape_Circle = ... 40 | mvNode_PinShape_CircleFilled = ... 41 | mvNode_PinShape_Triangle = ... 42 | mvNode_PinShape_TriangleFilled = ... 43 | mvNode_PinShape_Quad = ... 44 | mvNode_PinShape_QuadFilled = ... 45 | mvXAxis = ... 46 | mvXAxis2 = ... 47 | mvXAxis3 = ... 48 | mvYAxis = ... 49 | mvYAxis2 = ... 50 | mvYAxis3 = ... 51 | mvPlotScale_Linear = ... 52 | mvPlotScale_Time = ... 53 | mvPlotScale_Log10 = ... 54 | mvPlotScale_SymLog = ... 55 | mvPlotMarker_None = ... 56 | mvPlotMarker_Circle = ... 57 | mvPlotMarker_Square = ... 58 | mvPlotMarker_Diamond = ... 59 | mvPlotMarker_Up = ... 60 | mvPlotMarker_Down = ... 61 | mvPlotMarker_Left = ... 62 | mvPlotMarker_Right = ... 63 | mvPlotMarker_Cross = ... 64 | mvPlotMarker_Plus = ... 65 | mvPlotMarker_Asterisk = ... 66 | mvPlot_Location_Center = ... 67 | mvPlot_Location_North = ... 68 | mvPlot_Location_South = ... 69 | mvPlot_Location_West = ... 70 | mvPlot_Location_East = ... 71 | mvPlot_Location_NorthWest = ... 72 | mvPlot_Location_NorthEast = ... 73 | mvPlot_Location_SouthWest = ... 74 | mvPlot_Location_SouthEast = ... 75 | mvNodeMiniMap_Location_BottomLeft = ... 76 | mvNodeMiniMap_Location_BottomRight = ... 77 | mvNodeMiniMap_Location_TopLeft = ... 78 | mvNodeMiniMap_Location_TopRight = ... 79 | mvTable_SizingFixedFit = ... 80 | mvTable_SizingFixedSame = ... 81 | mvTable_SizingStretchProp = ... 82 | mvTable_SizingStretchSame = ... 83 | mvThemeCol_Text = ... 84 | mvThemeCol_TextDisabled = ... 85 | mvThemeCol_WindowBg = ... 86 | mvThemeCol_ChildBg = ... 87 | mvThemeCol_Border = ... 88 | mvThemeCol_PopupBg = ... 89 | mvThemeCol_BorderShadow = ... 90 | mvThemeCol_FrameBg = ... 91 | mvThemeCol_FrameBgHovered = ... 92 | mvThemeCol_FrameBgActive = ... 93 | mvThemeCol_TitleBg = ... 94 | mvThemeCol_TitleBgActive = ... 95 | mvThemeCol_TitleBgCollapsed = ... 96 | mvThemeCol_MenuBarBg = ... 97 | mvThemeCol_ScrollbarBg = ... 98 | mvThemeCol_ScrollbarGrab = ... 99 | mvThemeCol_ScrollbarGrabHovered = ... 100 | mvThemeCol_ScrollbarGrabActive = ... 101 | mvThemeCol_CheckMark = ... 102 | mvThemeCol_SliderGrab = ... 103 | mvThemeCol_SliderGrabActive = ... 104 | mvThemeCol_Button = ... 105 | mvThemeCol_ButtonHovered = ... 106 | mvThemeCol_ButtonActive = ... 107 | mvThemeCol_Header = ... 108 | mvThemeCol_HeaderHovered = ... 109 | mvThemeCol_HeaderActive = ... 110 | mvThemeCol_Separator = ... 111 | mvThemeCol_SeparatorHovered = ... 112 | mvThemeCol_SeparatorActive = ... 113 | mvThemeCol_ResizeGrip = ... 114 | mvThemeCol_ResizeGripHovered = ... 115 | mvThemeCol_ResizeGripActive = ... 116 | mvThemeCol_Tab = ... 117 | mvThemeCol_TabHovered = ... 118 | mvThemeCol_TabActive = ... 119 | mvThemeCol_TabUnfocused = ... 120 | mvThemeCol_TabUnfocusedActive = ... 121 | mvThemeCol_PlotLines = ... 122 | mvThemeCol_PlotLinesHovered = ... 123 | mvThemeCol_PlotHistogram = ... 124 | mvThemeCol_PlotHistogramHovered = ... 125 | mvThemeCol_TableHeaderBg = ... 126 | mvThemeCol_TableBorderStrong = ... 127 | mvThemeCol_TableBorderLight = ... 128 | mvThemeCol_TableRowBg = ... 129 | mvThemeCol_TableRowBgAlt = ... 130 | mvThemeCol_TextSelectedBg = ... 131 | mvThemeCol_DragDropTarget = ... 132 | mvThemeCol_NavHighlight = ... 133 | mvThemeCol_NavWindowingHighlight = ... 134 | mvThemeCol_NavWindowingDimBg = ... 135 | mvThemeCol_ModalWindowDimBg = ... 136 | mvPlotCol_Line = ... 137 | mvPlotCol_Fill = ... 138 | mvPlotCol_MarkerOutline = ... 139 | mvPlotCol_MarkerFill = ... 140 | mvPlotCol_ErrorBar = ... 141 | mvPlotCol_FrameBg = ... 142 | mvPlotCol_PlotBg = ... 143 | mvPlotCol_PlotBorder = ... 144 | mvPlotCol_LegendBg = ... 145 | mvPlotCol_LegendBorder = ... 146 | mvPlotCol_LegendText = ... 147 | mvPlotCol_TitleText = ... 148 | mvPlotCol_InlayText = ... 149 | mvPlotCol_AxisBg = ... 150 | mvPlotCol_AxisBgActive = ... 151 | mvPlotCol_AxisBgHovered = ... 152 | mvPlotCol_AxisGrid = ... 153 | mvPlotCol_AxisText = ... 154 | mvPlotCol_Selection = ... 155 | mvPlotCol_Crosshairs = ... 156 | mvNodeCol_NodeBackground = ... 157 | mvNodeCol_NodeBackgroundHovered = ... 158 | mvNodeCol_NodeBackgroundSelected = ... 159 | mvNodeCol_NodeOutline = ... 160 | mvNodeCol_TitleBar = ... 161 | mvNodeCol_TitleBarHovered = ... 162 | mvNodeCol_TitleBarSelected = ... 163 | mvNodeCol_Link = ... 164 | mvNodeCol_LinkHovered = ... 165 | mvNodeCol_LinkSelected = ... 166 | mvNodeCol_Pin = ... 167 | mvNodeCol_PinHovered = ... 168 | mvNodeCol_BoxSelector = ... 169 | mvNodeCol_BoxSelectorOutline = ... 170 | mvNodeCol_GridBackground = ... 171 | mvNodeCol_GridLine = ... 172 | mvNodesCol_GridLinePrimary = ... 173 | mvNodesCol_MiniMapBackground = ... 174 | mvNodesCol_MiniMapBackgroundHovered = ... 175 | mvNodesCol_MiniMapOutline = ... 176 | mvNodesCol_MiniMapOutlineHovered = ... 177 | mvNodesCol_MiniMapNodeBackground = ... 178 | mvNodesCol_MiniMapNodeBackgroundHovered = ... 179 | mvNodesCol_MiniMapNodeBackgroundSelected = ... 180 | mvNodesCol_MiniMapNodeOutline = ... 181 | mvNodesCol_MiniMapLink = ... 182 | mvNodesCol_MiniMapLinkSelected = ... 183 | mvNodesCol_MiniMapCanvas = ... 184 | mvNodesCol_MiniMapCanvasOutline = ... 185 | mvStyleVar_Alpha = ... 186 | mvStyleVar_DisabledAlpha = ... 187 | mvStyleVar_WindowPadding = ... 188 | mvStyleVar_WindowRounding = ... 189 | mvStyleVar_WindowBorderSize = ... 190 | mvStyleVar_WindowMinSize = ... 191 | mvStyleVar_WindowTitleAlign = ... 192 | mvStyleVar_ChildRounding = ... 193 | mvStyleVar_ChildBorderSize = ... 194 | mvStyleVar_PopupRounding = ... 195 | mvStyleVar_PopupBorderSize = ... 196 | mvStyleVar_FramePadding = ... 197 | mvStyleVar_FrameRounding = ... 198 | mvStyleVar_FrameBorderSize = ... 199 | mvStyleVar_ItemSpacing = ... 200 | mvStyleVar_ItemInnerSpacing = ... 201 | mvStyleVar_IndentSpacing = ... 202 | mvStyleVar_CellPadding = ... 203 | mvStyleVar_ScrollbarSize = ... 204 | mvStyleVar_ScrollbarRounding = ... 205 | mvStyleVar_GrabMinSize = ... 206 | mvStyleVar_GrabRounding = ... 207 | mvStyleVar_TabRounding = ... 208 | mvStyleVar_TabBorderSize = ... 209 | mvStyleVar_TabBarBorderSize = ... 210 | mvStyleVar_TableAngledHeadersAngle = ... 211 | mvStyleVar_TableAngledHeadersTextAlign = ... 212 | mvStyleVar_ButtonTextAlign = ... 213 | mvStyleVar_SelectableTextAlign = ... 214 | mvStyleVar_SeparatorTextBorderSize = ... 215 | mvStyleVar_SeparatorTextAlign = ... 216 | mvStyleVar_SeparatorTextPadding = ... 217 | mvPlotStyleVar_LineWeight = ... 218 | mvPlotStyleVar_Marker = ... 219 | mvPlotStyleVar_MarkerSize = ... 220 | mvPlotStyleVar_MarkerWeight = ... 221 | mvPlotStyleVar_FillAlpha = ... 222 | mvPlotStyleVar_ErrorBarSize = ... 223 | mvPlotStyleVar_ErrorBarWeight = ... 224 | mvPlotStyleVar_DigitalBitHeight = ... 225 | mvPlotStyleVar_DigitalBitGap = ... 226 | mvPlotStyleVar_PlotBorderSize = ... 227 | mvPlotStyleVar_MinorAlpha = ... 228 | mvPlotStyleVar_MajorTickLen = ... 229 | mvPlotStyleVar_MinorTickLen = ... 230 | mvPlotStyleVar_MajorTickSize = ... 231 | mvPlotStyleVar_MinorTickSize = ... 232 | mvPlotStyleVar_MajorGridSize = ... 233 | mvPlotStyleVar_MinorGridSize = ... 234 | mvPlotStyleVar_PlotPadding = ... 235 | mvPlotStyleVar_LabelPadding = ... 236 | mvPlotStyleVar_LegendPadding = ... 237 | mvPlotStyleVar_LegendInnerPadding = ... 238 | mvPlotStyleVar_LegendSpacing = ... 239 | mvPlotStyleVar_MousePosPadding = ... 240 | mvPlotStyleVar_AnnotationPadding = ... 241 | mvPlotStyleVar_FitPadding = ... 242 | mvPlotStyleVar_PlotDefaultSize = ... 243 | mvPlotStyleVar_PlotMinSize = ... 244 | mvNodeStyleVar_GridSpacing = ... 245 | mvNodeStyleVar_NodeCornerRounding = ... 246 | mvNodeStyleVar_NodePadding = ... 247 | mvNodeStyleVar_NodeBorderThickness = ... 248 | mvNodeStyleVar_LinkThickness = ... 249 | mvNodeStyleVar_LinkLineSegmentsPerLength = ... 250 | mvNodeStyleVar_LinkHoverDistance = ... 251 | mvNodeStyleVar_PinCircleRadius = ... 252 | mvNodeStyleVar_PinQuadSideLength = ... 253 | mvNodeStyleVar_PinTriangleSideLength = ... 254 | mvNodeStyleVar_PinLineThickness = ... 255 | mvNodeStyleVar_PinHoverRadius = ... 256 | mvNodeStyleVar_PinOffset = ... 257 | mvNodesStyleVar_MiniMapPadding = ... 258 | mvNodesStyleVar_MiniMapOffset = ... 259 | -------------------------------------------------------------------------------- /dearcygui/dearcygui.pyx: -------------------------------------------------------------------------------- 1 | # from https://stackoverflow.com/questions/30157363/collapse-multiple-submodules-to-one-cython-extension/52729181#52729181 2 | import sys 3 | import importlib 4 | import importlib.abc 5 | import importlib.machinery 6 | import importlib.util 7 | 8 | # Chooses the right init function 9 | class CythonPackageMetaPathFinder(importlib.abc.MetaPathFinder): 10 | def __init__(self, name_filter): 11 | super(CythonPackageMetaPathFinder, self).__init__() 12 | self.name_filter = name_filter 13 | 14 | def find_spec(self, fullname, path, target=None): 15 | if fullname.startswith(self.name_filter): 16 | # use this extension-file but PyInit-function of another module: 17 | loader = importlib.machinery.ExtensionFileLoader(fullname, __file__) 18 | return importlib.util.spec_from_loader(fullname, loader) 19 | 20 | # injecting custom finder/loaders into sys.meta_path: 21 | def bootstrap_cython_submodules(): 22 | sys.meta_path.append(CythonPackageMetaPathFinder('dearcygui.')) -------------------------------------------------------------------------------- /dearcygui/docs/UI.md: -------------------------------------------------------------------------------- 1 | ## Widgets 2 | 3 | **DearCyGui** supports many widgets to implement various interactions with the users, for instance: 4 | 5 | - `Button`, to trigger an event on a click 6 | - `Checkbox`, to enable or disable something 7 | - `Slider`, to pick a value with a slider 8 | - `InputValue` and `InputText`, to manually enter a value or text 9 | - `Combo`, `ListBox` or `RadioButton` to select an item in a list 10 | - `Menu`, to add menu options to a window or the viewport. 11 | 12 | In addition, various objects enable to contain groups of objects and assign them a behaviour. 13 | 14 | - `TreeNode`, `CollapsingHeader` to quickly show/hide items with a click 15 | - `Tab` to have a header and a subwindow subwindow with content corresponding to the selected header 16 | - `ChildWindow`, to encapsulate on or several items into a dedicated limited space 17 | 18 | Almost all widgets have a *value* attribute which contains a value related to the 19 | widget main state. For instance the checkbox's value indicate if the item is selected 20 | or not. The slider's value contains the value at which the slider is set. 21 | In order to share values between widgets, one can use the shareable_value attribute, 22 | which returns an instance of a SharedValue which can be passed to other items. The 23 | type of the shared value must be compatible for this. It can also be useful to manipulate 24 | shared values if you need to reference in your code the value of an item before this 25 | item is created (you then pass the shared value you created earlier). 26 | 27 | Widgets can react to various user-interactions. See the *Callbacks* section for more details. 28 | 29 | ## Positioning elements 30 | 31 | UI element positioning uses a top-left origin coordinate system. 32 | When inside a `dcg.Window`, the backend library ImGui does maintain an internal cursor with (0, 0) 33 | being the first position of the cursor inside the window. This position is affected by various theme elements 34 | determining the size of window borders and padding. 35 | Everytime a widget is rendered, the internal cursor is moved down. If the no_newline attribute is set on an 36 | item, then the cursor is moved right instead. Some items, such as `Separator` and `Spacer` enable to 37 | add some vertical or horizontal space. 38 | 39 | It is advised if possible to favor use these to correctly place your items, as the positioning will 40 | respect the theme policy and scale properly with the global scale. 41 | 42 | The current position of an item relative to its parent, the window, or the viewport can be retrieved 43 | using the pos_to_parent, pos_to_window and pos_to_viewport attributes. Setting them will automatically 44 | change the positioning policy from DEFAULT to being linked to the attribute you have set. When 45 | the positions or sizes of parents and siblings change, the position attribute set will remain constant, 46 | while the other might move freely. 47 | 48 | It should be avoided if possible to directly position the items that way, as it does not scale well with 49 | the global scale, the themes and the font sizes. However it has its useful use-cases. 50 | 51 | For instance, one can implement dragging a button using these attributes. One can also overlap items. 52 | Items set with a non-default policy will not move the default cursor for other items. 53 | 54 | `Layout` objects are containers which can be a useful way to organize elements automatically. 55 | `Layout` objects have the special property that their state is an OR of the item states. For instance 56 | if an item is clicked, the Layout will also be considered clicked. The callback of a `Layout` is called 57 | whenever it is detected that the available region has changed, and it is meant that the parent `Layout` 58 | of an item will eventually set the pos_* attributes of its children to organize them in a custom Layout. 59 | 60 | For simplicity, two common `Layout` classes are provided: `VerticalLayout` and `HorizontalLayout`. They will 61 | automatically set the pos_* fields and no_newline fields of their children to organize them 62 | in a vertical only or horizontal only layout. They accept doing left, right, center, or justified 63 | positioning. 64 | 65 | ## Items sizes 66 | 67 | Most items accept having their size set by a `width` and a `height` attribute. 68 | These correspond to a *desired* size, and are automatically scaled by the global scale, unless 69 | the `no_scale` attribute is set. 70 | 71 | A positive value directly correspond to a desired pixel size (putting aside the global scale). Note 72 | some items unfortunately do not include some parts of their elements in this size. 73 | 74 | A negative value is used to mean a delta relative to the available size inside the parent. For instance 75 | a value of "-1" means "remaining size inside the parent - 1". 76 | 77 | A zero value means "default value", and depending to the item can mean fitting to the smallest size containing the content, 78 | or to a fixed size determined by the theme. 79 | 80 | The real pixel size obtained when the item is drawn is stored in `rect_size`, and changes to that value can be caught using 81 | the `ResizeHandler`. In some cases, it can be useful to use this handler to fit an item that is outside the bounds, 82 | or to center one. 83 | 84 | -------------------------------------------------------------------------------- /dearcygui/docs/advanced.md: -------------------------------------------------------------------------------- 1 | # Thread Safety 2 | 3 | **DearCyGui** is fully thread-safe and uses a separate mutex for each item. 4 | A mutex is a lock that a single thread can keep at a single time. 5 | Any time a field of an item is read or written to, the lock is held. 6 | 7 | The only except is the viewport, which has several mutexes in order to protect 8 | various parts, and enable to access some of its fields while work is occuring. 9 | 10 | Locking a mutex that is not already locked is pretty cheap on modern CPU architectures, 11 | which makes this solution viable. The significant advantage, against a single global 12 | mutex, is that item fields can be read and written to while other internal work 13 | (such as rendering) is occuring. Indeed if a thread owns a mutex, other threads 14 | attempting to lock will wait until the mutex is released. 15 | 16 | When having many mutexes, in order to prevent deadlocks, one technique is to 17 | use a specific locking order at all times. Since **DearCyGui** objects are stored 18 | in a tree structure and have at most a single parent, and possibly many children, 19 | a natural locking order is that if you need a lock on an item and one of its ancestors, 20 | you need to lock the ancestors' mutexes first. 21 | During rendering this order is respected. 22 | 23 | ``` 24 | order of mutex locking during rendering 25 | lock of the viewport 26 | for each child: 27 | lock the viewport child 28 | render recursively the child 29 | unlock the viewport child 30 | ``` 31 | 32 | The above process occurs recursively at every node of the tree. 33 | If the mutex of an item is held in another thread, rendering is paused 34 | until it is released. Thus it might be useful in some scenarios to lock the mutex 35 | in your program in order to make sure rendering does not occur while you are modifying 36 | several properties of an item in the rendering tree, and avoid showing on one frame an 37 | item in an incomplete state. 38 | 39 | If you need to lock several items, this gets harder to get right. Indeed as stated, 40 | the lock of the parents must be held before the lock of the children is held. 41 | And attempting to read or write an item's field is internally locking the mutex. 42 | Thus for instance these codes are easy mistakes that will cause a hang: 43 | 44 | ```python 45 | a.parent = b 46 | C = a.context 47 | 48 | # The mutex can be locked 49 | # with the mutex context manager 50 | # or with lock_mutex() 51 | 52 | with a.mutex: 53 | # Potential deadlock because accessing 54 | # any b field locks its mutex 55 | is_single_child = len(b.children) == 1 56 | 57 | with a.mutex: 58 | # if a is in the rendering tree, 59 | # the viewport is an ancestor, thus 60 | # this can hang 61 | C.viewport.handlers += ... 62 | ``` 63 | 64 | The simplest way to avoid complications is to not use the mutex, or to lock the viewport mutex instead 65 | of the item mutex. You can also use the `parents_mutex` property, which will lock the mutexes of all ancestors. -------------------------------------------------------------------------------- /dearcygui/docs/basics.md: -------------------------------------------------------------------------------- 1 | # Starting with **DearCyGui** 2 | 3 | ## What is **DearCyGui** 4 | 5 | **DearCyGui** is a **Python** library 6 | to write *GUI* applications. 7 | It is based on **Dear ImGui** to manage and render the GUI. 8 | **DearCyGui** is mainly written in **Cython**, thus the name. 9 | **Cython** knowledge is not required. 10 | 11 | **Python** is quite handy, 12 | but is not performant enough to render at full frame-rate 13 | complex UIs. The main idea of this library is to create items 14 | and declare how they should behave, and let the library handle 15 | rendering the items and check the conditions you registered for. 16 | The library is written mostly using **Cython** code, 17 | which is converted into efficient **C ++** code and 18 | compiled. The interest of using **Cython** is that it simplifies 19 | writing interaction code with **Python**. **DearCyGui** features 20 | a lot of these to ease the programmer's life. 21 | 22 | ## Why should I consider using **DearCyGui** ? 23 | 24 | There are a lot of available *GUI* libraries with 25 | **Python** support. **DearCyGui** targets only **Python**. 26 | 27 | Here are the main features of **DearCyGui**: 28 | 29 | - Cross-platform. It uses GL and SDL3 under the hood. 30 | - Free and MIT License. It can be integrated into industrial applications. 31 | - Fast. Item creation and configuration is optimized and can be 32 | significantly faster than on other frameworks. In addition rendering uses 33 | **Dear ImGui** which does an efficient work at packing draw calls and has 34 | a reduced overhead. 35 | - Type hinting and docstrings. There are a lot of available *GUI* libraries with 36 | **Python** support. **DearCyGui** targets only **Python**, which thus has 37 | first class support. 38 | - Low CPU/GPU usage. Rendering can be skipped when it is not needed. 39 | - Support for custom widgets. As with many (but not all) *GUI*, it is possible 40 | to subclass all items in custom classes. This simplifies making items 41 | with custom behaviours. 42 | - Not too verbose, not too slim. Several features allow the code to be easy 43 | to read (use of properties, passing properties values during init, `with` 44 | syntax, type hinting, etc.) However there is little unspecified *magic* 45 | happening. Items won't be attached to a parent unless you specified one 46 | (using `with` or `parent`), and events won't be magically received because 47 | you named you class methods with a specific naming scheme (you have to 48 | register them with handlers). 49 | - Avoiding calling **Python** code when not needed. **Python** is nice, 50 | but a bit heavy. **DearCyGui** features an extended event filter system 51 | to only call your **Python** callbacks when required. For instance, 52 | you can register a callback that will be called only the first frame 53 | an item is rendered, or when it is resized. You can combine conditions 54 | and add custom ones. 55 | - Interactable drawing items. It is possible to have custom interactable 56 | regions in drawing space, and thus implement various drawing interactions, 57 | such as interacting with a circle, a rectangle, a point, etc. Such possible 58 | interactions that can be implemented are resizing, clicking, rotating, 59 | displaying a tooltip when hovered, etc. 60 | 61 | 62 | ## When should I consider using another framework ? 63 | 64 | You might consider using another framework if one of these 65 | points is problematic for you: 66 | 67 | - No touchscreen support. It is very much keyboard and mouse. 68 | - It is still in heavy developpement, and thus there might be 69 | small changes there and there in variable names, etc. 70 | - It will update with the latest ImGui releases, which can 71 | introduce some small changes in variable names and behaviours. 72 | - Right now it has mostly been developped and tested on Linux, 73 | but it aims for Windows and MAC support as well. 74 | - No 'native' look. It uses the native file dialog, but besides 75 | that won't use the system colors or style. 76 | - This project is not developped by a company. Thus no paid support 77 | or other support plans. 78 | - While there is no current plan for that, it might stop being 79 | maintained one day. The last project I maintained lasted 10 years. 80 | 81 | 82 | ## The Context 83 | 84 | The first item you need to create is a *Context*. 85 | ```python 86 | C = dcg.Context() 87 | ``` 88 | 89 | The Context manages the state of your UI items and 90 | all items reference it. The context is stored 91 | in every item in the `context` attribute. 92 | 93 | It is possible to subclass the context, in order to 94 | attach additional information for your items, or 95 | to extend some features. For instance it is possible 96 | to log item creation and deletion, or to add custom 97 | configuration arguments to all items. 98 | 99 | ## The viewport and the rendering tree 100 | 101 | With the Context is attached a single *"Viewport"*. 102 | The Viewport basically corresponds to your application window as seen 103 | by the operating system. It has a title, decoration, etc (this is configurable). 104 | Every frame, rendering starts from the viewport and, in a tree traversal fashion, 105 | all children of the viewport, their children, the children of their children, 106 | etc will be rendered. An item outside of this *rendering* tree can 107 | exist, but will not be rendered. In addition items attached in the rendering tree 108 | can prevent being rendered using the `show` attribute." 109 | 110 | Items can be created as soon as the Context is created, 111 | but for anything to be displayed, you need to initialize the viewport. 112 | 113 | ```python 114 | C.viewport.initialize() 115 | ``` 116 | 117 | Once attached to the rendering tree, you do not need 118 | to retain a reference to the item for it to remain alive. You can 119 | retain a reference if you want to access later the object. 120 | 121 | ## Building the rendering tree 122 | 123 | To attach an item to another, several options are available. 124 | 125 | - You can set the `parent` attribute of your 126 | item to a reference to the parent or its `tag`. 127 | 128 | - You can append the item to the `children` attribute of the target parent. 129 | 130 | - Using the `with` syntax on the parent 131 | will attach all items inside the `with` to that parent. 132 | ```python 133 | with my_parent_item: 134 | item = create_my_new_item() 135 | ``` 136 | 137 | - By default items try to attach to a parent unless 138 | `attach=False` is set during item creation. 139 | 140 | ## Creating an item 141 | 142 | All items in **DearCyGui** are built with the following properties: 143 | - *Everything* is properties. Items can be configured by writing to their attributes 144 | at any time, and their current state can be retrieved by reading their attributes. 145 | - All items take the context instance as mandatory positional first argument. You can add more 146 | when subclassing. 147 | - All other arguments of standard **DearCyGui** items (except very few exceptions) are optionnal 148 | keyword arguments. By default all item attributes are set to reasonable default values, and for 149 | most boolean attributes, the default value is `False`. Some exceptions are `show`, or `enabled` 150 | which are set to `True` by default. 151 | - At item creation the default value of the attributes are set, and the keyword arguments are 152 | then converted in a later phase in `__init__` into setting the attributes of the same name (except 153 | very few exceptions for compatibility reasons). It is important to take this into account when 154 | subclassing an object, as you might want to delay (or not) the configuration of the attributes. 155 | Note when subclassing, the attributes are already initialized to the default value when entering 156 | your custom class's `__init__`. 157 | Essentially, the execution flow of item creation when subclassing is 158 | 159 | > The Item's memory structure is initialized and values set to the default value 160 | > 161 | > Your `__init__()` 162 | > 163 | > (Optional) At some point in your `__init__` you call the base class `__init__` method 164 | > 165 | > The base class `__init__` iterates on the keyword parameters and tries to set them as attributes. 166 | 167 | ## Thread safety 168 | 169 | Each item is protected by its own mutex instally and it is safe to manipulate items from several threads. 170 | It is possible to lock the internal mutex, but with special care (see the advanced section). 171 | 172 | ## Autocompletion 173 | 174 | **DearCyGui** provides .pyi files to help linters suggest code completion and show documentation. 175 | Alternatively you can use this program to visualize the documentation of each item and see 176 | available fields. -------------------------------------------------------------------------------- /dearcygui/docs/callbacks.md: -------------------------------------------------------------------------------- 1 | # What is a callback ? 2 | 3 | A *Callback* is a function that is called in response to an event. 4 | Various objects in **DearCyGui** take a callback attribute in order to 5 | react to various events. 6 | 7 | # Callback input arguments 8 | 9 | A valid callback takes zero, one, two or three positional arguments. 10 | The first argument passed is the object to which the callback was attached. 11 | The second argument is the object for which the callback was triggered. 12 | It can be the same as the first argument, but for instance in the case 13 | of handlers attached to an item, that is the way to know for which item 14 | the handler reacted. Indeed a handler can be attached to many items. 15 | The third argument is specific to how the callback was issued. In the 16 | case of UI items, it is generally the same as `item.value`. For handlers, 17 | see the description of the handler. The idea is that the value should 18 | be something immediately useful to react to the callback. 19 | 20 | If the callback takes less than three positional arguments, then 21 | only a subset of the arguments is passed, in the above order of priority. 22 | Non-positional arguments are ignored, and thus will take whatever default 23 | value you have given them. This is one trick to pass by value local 24 | variables for temporary functions defined inside another function. 25 | 26 | # Attaching custom data to an item 27 | 28 | Note that all items accept a `user_data` attribute, in which you can store 29 | any information. This might be useful in your callbacks. 30 | **DearCyGui** objects do not accept setting new attributes, but if you subclass 31 | in Python these objects, this restriction is lifted. If you want to implement 32 | various or complex interactions, it is recommended to subclass the target 33 | **DearCyGui** objects and attach them new attributes and methods. Callbacks 34 | can be class methods. 35 | 36 | # Callback thread 37 | 38 | Callbacks are by default issued in a single secondary thread. This can be 39 | replaced by a custom behaviour by setting the queue attribute of the Context. 40 | Note that appending callbacks use Python's global interpreter lock, and thus 41 | you should ensure not to have it locked for too long to not stall rendering. 42 | 43 | # Handlers 44 | 45 | In general, it is best to avoid issuing more callbacks than needed. Handlers 46 | are much cheaper than callbacks. Thus for instance it is much more recommanded 47 | if one want to react to various key events, to have one handler per key, rather 48 | than one handler for all keys, and filter in the callback (in particular 49 | because in this specific case the handler has to check all possible keys of 50 | all possible keyboards). 51 | 52 | In order to only trigger callbacks when needed, various tools are available 53 | to filter the handlers. We'll delve into them later in the last section. 54 | 55 | --- 56 | 57 | # Base handlers 58 | 59 | Handlers can detect various specific events happening to your event. 60 | The complete list of handlers can be found in the Available items section, 61 | but here are the description of a few: 62 | 63 | - `ActiveHandler`. An user-interactable item is considered active when the 64 | user is interacting with it. For instance in the case of a Button, 65 | a button is considered active as soon as the mouse is pressed on it. 66 | When the mouse is released, the button is not active anymore. 67 | `ActivatedHandler` and `DeactivatedHandler` enable to only trigger callbacks 68 | when the active status changes, rather than all frames with the status. 69 | While checking for activation is ok for most use-cases, in the general 70 | case, it is recommended to favor using the item's main callback. Indeed 71 | this callback has been calibrated to correspond to the most common needs 72 | related to these items. For instance, if the user presses the mouse on a 73 | button, them moves the mouse out of the button area, and then unclicks, 74 | the main `Button` callback will not trigger, while both `ActivatedHandler` 75 | and `DeactivatedHandler` will have triggered. 76 | 77 | - `ClickedHandler`. This handler is equivalent to checking that the item 78 | is hovered and that a click occured. On the other hand, `MouseClickHandler` 79 | does not care where the click occured. 80 | 81 | - `HoverHandler`. This handler, and its peers `GotHoverHandler` and `LostHoverHandler`, 82 | enable to react to the mouse hovering above an item. In the general case, 83 | only a single item is considered hovered. Note that a single item 84 | can be active as well, and that it might not be the same as the hovered 85 | item (see above example with the Button). 86 | Note if you need to display a message when the target item is hovered, 87 | that you might have you need met by a Tooltip. 88 | 89 | - `ResizeHandler`. Every UI item has a rect_size attribute that defines 90 | its size in pixels (which might not be the requested size, due to 91 | rounding, scaling, etc). The `ResizeHandler` triggers its callback 92 | whenever that rect_size changes. 93 | 94 | - `OpenHandler/CloseHandler/ToggledOpenHandler/ToggledCloseHandler`. 95 | Some UI items (`TreeNode`, `CollapseHeader`, `Window`) can be reduced 96 | in a closed state (which does NOT mean the item is destroyed), in 97 | which only a small header of the item is shown. Open refers to 98 | the whole content being shown. These four handlers enable to react 99 | to these states, and the changes of these states. 100 | 101 | - `RenderHandler/GotRenderHandler/LostRenderHandler`. An item is considered 102 | "CPU-rendered" if during `render_frame` the item was seen by the rendered. 103 | To be considered rendered, an item must be in the render tree, its 104 | show attribute must be set to True, as well as all its parents. In 105 | addition, no parent must have skipped rendering some its children 106 | with clipping optimizations. Being rendered does not mean that 107 | the item is visible (many parents do not do clipping optimizations, 108 | or are very conservative about it), but it needs to be rendered 109 | to be visible. 110 | Note that the size and position of an item might converge in a few frames 111 | after it gets rendered, as some parent items take guesses during rendering 112 | about the size of their children and only take the real value the next frame. 113 | It is important to note though that an item that is not rendered will not 114 | have any of its handlers run. `OtherItemHandler` can be used to run handlers 115 | on an item that might not be rendered, but that should be rarely needed. 116 | When an item gets hidden by a parent or by show being set to False, the handlers 117 | are run one last time, in order to properly trigger `LostRenderHandler`, as well 118 | as all the other status loss handlers. 119 | 120 | --- 121 | 122 | # Combining handlers 123 | In general it is best to avoid issuing callbacks, due to Python overhead. 124 | Combining handlers enable to create complex checks inside the handlers, in 125 | order to only issue the callbacks when specific events are met. 126 | `HandlerList` has an op attribute that can be set to `ALL/ANY/NONE`, and thus 127 | can be used to check when the condition of a handler is not met, or when 128 | the condition of a handler is met, but not the one of another one, etc. 129 | Any logical combination is possible by using a tree of HandlerList. 130 | However `HandlerList` will often not issue an interesting third argument 131 | to the callback, or it might be that running a specific handler is 132 | particularly heavy (for instance a `CustomHandler`, or a significant 133 | subtree of handlers in a HandlerList). In that case a `ConditionalHandler` 134 | is very useful. The first handler of its children list is only run if the 135 | `ALL/ANY/NONE` condition is met on the other elements of the children list. 136 | Finally a `CustomHandler` enables to insert Python checks inside the handlers, 137 | but do not abuse of it and be careful not to stuck rendering. -------------------------------------------------------------------------------- /dearcygui/docs/drawings.md: -------------------------------------------------------------------------------- 1 | # Tools for rendering 2 | 3 | **DearCyGui** contains various items to perform some light 2D rendering. 4 | It is not possible yet to use custom shaders, or perform 3D rendering, 5 | but the 2D rendering is optimized in order to perform well visually (antialiasing), 6 | and in overhead (no state maintenance, drawcalls groupped as much as possible). 7 | 8 | The items to draw have their name beginning with `Draw` 9 | - `DrawArrow` draws an arrow 10 | - `DrawLine`, `DrawPolyLine` enable to draw one or several lines 11 | - `DrawTriangle`, `DrawRect`, `DrawPolygon`, draws respectively a triangle, a rectangle, a polygon 12 | - `DrawCircle`, `DrawEllipse` draw a circle and an ellipse 13 | - `DrawingList` enables to group several items. It is useful (by subclassing it) to create custom objects. 14 | - `DrawingListScale` enables to apply a transform to the coordinates, but you for complex cases `Plot` is more powerful 15 | 16 | All color arguments in **DearCyGui** accept three formats: 17 | 18 | - A packed RGBA (8 bit per channel) 19 | - a tuple of uint8. For instance `(10, 25, 35)` means `R=10`, `G=25`, `B=35`. If a fourth coordinate is passed, it corresponds to *alpha* (255 means opaque and 0 fully transparent). 20 | - a tuple of float32. The behaviour is similar to a tuple of uint8, except all values must be divided by 255. Values must be between 0 and 1. **BEWARE** of this behaviour, as you be careful not to multiply with a float scalar integer values without normalizing. 21 | 22 | **DearCyGui** provides respectively `color_as_int`, `color_as_ints` and `color_as_floats` to produce these three representations. These functions take as input any of these three formats. When reading a color attribute of an item, the first format is used, thus these helpers can help convert the format to what you need. 23 | 24 | Most Draw* items accept a `thickness` attribute. This thickness is automatically scaled by the global scale and the plot scale (in inside `Plot`). 25 | Similarly the `radius` attribute of `DrawCircle` is scaled. To prevent this scaling and have a `thickness` or `radius` in pixels, pass a negative value. 26 | 27 | # Coordinate system 28 | 29 | The coordinate system in which Draw* commands reside depends on their parent. `DrawInWindow` creates a system with origin the position in the window, and such that 1 pixel = 1 unit (scaling put aside). `DrawInPlot` inherits the range from the selected axes of the `Plot`, which can be directly changed by setting the `min` and `max` attribute of the relevant axes. In all cases, the GPU clips elements that are outside of the region of the parent. Note it is possible to use `Plot` purely as a coordinate system by removing all default visual elements of a plot (legend, axes, etc). On the other hand, `DrawInPlot` enable optionnaly to appear in the legend of `Plot`, and thus Draw* elements can be used to create custom plot drawings. 30 | 31 | # Events and `DrawInvisibleButton` 32 | 33 | As the Draw* items do not check any state, they do not react to clicking, hovering, etc. Handlers attached to their parent `Plot` or `Window` enable to capture changes in the coordinate system (resizing, etc). `DrawInvisibleButton` enables to capture clicks inside the draw region, by creating a rectangular region that reacts to hovering, clicks, etc. Handlers can be attached to it similarly to normal UI elements. However `DrawInvisibleButton` can be overlapped. Similarly to normal buttons, a pressed `DrawInvisibleButton` remains in the active state as long as the mouse is not released, thus you can implement dragging objects without having to move the invisible button during the dragging operation. To implement an interactable Draw* Object, one can subclass `DrawingList`, and attach visuals and `DrawInvisibleButton`. But for simple needs, note that `DrawInvisibleButton` also accepts children. In that case the coordinate system scales such that (0, 0) is the top left of the button and (1, 1) the bottom right. 34 | 35 | `DrawInvisibleButton` takes various arguments to control its behaviour. The shape is determined in plot space by setting the top left and bottom right coordinates in `p1` and `p2`, but you can assign a size on pixel space by using the `min_side` and `max_side` attribute. For example a point will be assigned identical `p1` and `p2`, but will be assigned a min_side. In the case of overlap, the last button in the rendering tree takes priority. -------------------------------------------------------------------------------- /dearcygui/docs/plots.md: -------------------------------------------------------------------------------- 1 | Plots are square items which enable to draw plot elements or drawings in a customizable coordinate system. 2 | 3 | Various styles of the plot can be customized. By default a legend is shown, as well as axes and ticks. It is 4 | possible with handlers to detect hovering and clicks over the legend, the axes area or the plot area, as well 5 | as changes in the coordinates system (`AxesResizeHandler`) 6 | 7 | Each Plot has three separate X axes (X1, X2, X3) and three separate Y axes (Y1, Y2, Y3). 8 | By default only X1 and Y1 are enabled, and plotElements are assigned to X1/Y1. 9 | 10 | The configuration of the axes and the legend can be done by accessing directly the X1, X2, X3, Y1, Y2, Y3 and legend attributes of a plot. They are respectively of type PlotAxisConfig and PlotLegendConfig. 11 | 12 | The mouse position can be obtained in plot coordinate space by looking at the `mouse_coord` attribute 13 | of each PlotAxisConfig. The min and max of the coordinates of that axis can be set directly using the `min` and `max` attributes, but it can also be set automatically using an automated fit to the drawn data. See the description of `auto_fit`, `contraint_min/max`, `no_initial_fit`, `lock_min/max` and `ignore_fit` for more details. 14 | 15 | Plots can include: 16 | - `PlotLine`. To draw line plots, or segment plots. 17 | - `PlotScatter`. For a scatter plot 18 | - `PlotShadedLine`. For line plots with shaded area beneath for line. 19 | - `PlotStairs`. For stairs plot 20 | - `PlotStems`. For stems plot 21 | - `PlotBars`. For bars plot 22 | - `DrawInPlot`. For custom rendering in plot coordinate space. Useful to inherit from the coordinates, resizing, zoom and panning features of a plot. 23 | 24 | By default, hovering an element legend increases the thickness of the element. If the plot element 25 | is assigned children widgets, right clicking on it on its legend opens a small window with these elements. The legend can be disabled globally on a plot, or individually for each item. 26 | 27 | The implementation of plots is using the **ImGui** extension library **ImPlot**. -------------------------------------------------------------------------------- /dearcygui/docs/themes.md: -------------------------------------------------------------------------------- 1 | # Themes 2 | 3 | ## ThemeColor and ThemeStyle 4 | 5 | **ImGui** is the main library used to render items. The appearance of many items, 6 | as well as the style, and various spacing behaviours can be tuned using themes. 7 | **ImPlot** is used to render plots. 8 | 9 | - `ThemeColorImGui` enables to change the color of most objects 10 | - `ThemeColorImPlot` enables to change the color of plot items 11 | - `ThemeStyleImGui` enables to change the style and spacing of most items 12 | - `ThemeStyleImPlot` enables to change the style and spacing of plots 13 | 14 | By default all values passed, as well as default values, are scaled by the global scale, and rounded to an 15 | integer when it makes sense. This can be disabled using `no_scaling` and `no_rounding`. 16 | 17 | Values set in a theme instance are meant to replace any previous value currently set in the rendering tree. 18 | When a theme is attached to an item, the values are replayed when the item is rendered, and the item, 19 | as well as all its children will use these theme values (unless another theme is applied). 20 | 21 | It is possible with `ThemeListWithCondition` to define a theme that will be only applied for children when a specific type of 22 | item is found. However it is encouraged not to use them if possible for performance reasons, as every time an item is rendered, 23 | all conditions will be checked. In addition, it is preferred to attach a theme to as few items as possible, in order to avoid 24 | rewriting the values when not needed. Finally if you attach themes to many items, try to only set in them the values that 25 | will impact these items. 26 | 27 | ```python 28 | my_theme = dcg.ThemeStyleImGui(FramePadding=(0, 0)) 29 | ... 30 | item.theme = my_theme 31 | ... 32 | my_theme.WindowRounding = 1 # adding a new setting in the theme 33 | ... 34 | my_theme.WindowRounding = None # Removing a setting from the theme 35 | ... 36 | my_theme[dcg.constants.WindowRounding] = 1 # alternative syntax 37 | ``` 38 | 39 | *** 40 | 41 | # Fonts 42 | 43 | ## The default font 44 | 45 | The default font uses the Latex Latin Modern font at size 17, scaled by the global scale. 46 | It combines several fonts in order to provide in a single font `bold`, *italics* and **bold-italics**. 47 | The advantage of combining fonts into one is to benefit from text wrapping, as it is not needed 48 | to issue several Text() calls. In addition combining fonts needs special centering and sizing. 49 | 50 | ## The default font at different sizes 51 | 52 | New instances of the default font can be created using `AutoFont`. 53 | ```python 54 | my_new_font = dcg.AutoFont(C, base_size=new_size) 55 | ``` 56 | The default base size is 17. 57 | 58 | ## Simplest and fastest way of loading a font 59 | 60 | To load a non-default font, the simplest is to use `AutoFont` 61 | ```python 62 | my_new_font = dcg.AutoFont(C, 63 | base_size=my_target_size, 64 | main_font_path=path) 65 | ``` 66 | 67 | `AutoFont` does the following for you: 68 | - Load the font, render the `GlyphSet`, and load it in a `FontTexture` 69 | - Detect scales at which the font is used in practice (viewport dpi scaling, etc), and compile in the background new versions of the font to be sharp at the target scale. 70 | - Load the best compiled font for the target scale when used, in order to have sharp rendering 71 | 72 | By default it uses `make_extended_latin_font` to build a `GlyphSet`, which corresponds to a set of renderer glyphs and their size information. 73 | This function builds an extended latin set of characters, with bold/bold-italics and italics. The helpers `make_bold`, `make_bold_italic` and `make_italic` can be used to generate text that uses the characters that will render in these modes. 74 | 75 | If one wants to load a different set of characters, AutoFont takes a `font_creator` argument to replace `make_extended_latin`. This function should take as argument the target size, and optional arguments that are forwarded by AutoFont. It should return a `GlyphSet` (see below how to build one). 76 | 77 | ## Alternative way 78 | 79 | The second simplest way is to use a `FontTexture` directly: 80 | ```python 81 | 82 | font_texture = dcg.FontTexture(C) 83 | font_texture.add_font_file(path, size=size) 84 | font_texture.build() 85 | my_new_font = font_texture[0] 86 | ``` 87 | 88 | This is simple and fast (it uses **ImGui** directly), but it has its share 89 | of imperfections. It is not the recommended way. 90 | 91 | ## An improved alternative way 92 | 93 | ```python 94 | 95 | # Prepare the font texture 96 | font_texture = dcg.FontTexture(C) 97 | # Load the font 98 | font_renderer = FontRenderer(path) 99 | # render the glyphs (GlyphSet) 100 | # see the docstring for various modes that impact 101 | # how the glyphs are rendered. 102 | glyph_set = font_renderer.render_glyph_set(target_size=size) 103 | # Note a GlyphSet can be built manually by adding 104 | # manually the image of each glyph with GlyphSet's `add_glyph`. 105 | # This enables to load custom bitmap fonts, using any character mapping. 106 | # Characters can also be added to an already built GlyphSet. 107 | # See GlyphSet methods for how to alter the size and positioning 108 | # of the loaded glyphs. 109 | # Center the font on a target character (optional) 110 | glyph_set.center_on_glyph(target_unicode=ord("B")) 111 | # Load into a font texture 112 | font_texture.add_custom_font(glyph_set) 113 | font_texture.build() 114 | my_new_font = font_texture[0] 115 | ``` 116 | 117 | Note however that both alternative methods will give blurry rendering whenever the display's dpi scale is not 1. `AutoFont` handles building at the correct scale for you. Alternatively a simple way to handle scaling is to do: 118 | 119 | ```python 120 | # Scale the size during glyph rendering 121 | global_scale = C.viewport.dpi * C.viewport.scale 122 | # Render at a bigger size 123 | glyph_set = font_renderer.render_glyph_set(target_size=round(size*global_scale)) 124 | ... 125 | # The font is already scaled 126 | # Thus we make it so after being scaled 127 | # by global_scale, the resulting scale is 1. 128 | my_new_font.scale = 1./global_scale 129 | ``` 130 | 131 | As long as `global_scale` is not changed after the font is created, this method will give good results. 132 | -------------------------------------------------------------------------------- /dearcygui/draw.pxd: -------------------------------------------------------------------------------- 1 | from .core cimport drawingItem, Texture, baseFont, SharedValue 2 | from .c_types cimport double2, float2 3 | 4 | from libcpp.string cimport string 5 | from libcpp.vector cimport vector 6 | 7 | cdef class ViewportDrawList(drawingItem): 8 | cdef bint _front 9 | cdef void draw(self, void*) noexcept nogil 10 | 11 | cdef class DrawingList(drawingItem): 12 | pass 13 | 14 | cdef class DrawingClip(drawingItem): 15 | cdef double[2] _pmin 16 | cdef double[2] _pmax 17 | cdef float _scale_min 18 | cdef float _scale_max 19 | cdef bint _no_global_scale 20 | cdef void draw(self, void*) noexcept nogil 21 | 22 | cdef class DrawingScale(drawingItem): 23 | cdef double[2] _scales 24 | cdef double[2] _shifts 25 | cdef bint _no_parent_scale 26 | cdef bint _no_global_scale 27 | cdef void draw(self, void*) noexcept nogil 28 | 29 | cdef class DrawSplitBatch(drawingItem): 30 | cdef void draw(self, void*) noexcept nogil 31 | 32 | cdef class DrawArrow(drawingItem): 33 | cdef double[2] _start 34 | cdef double[2] _end 35 | cdef double[2] _corner1 36 | cdef double[2] _corner2 37 | cdef unsigned int _color # imgui.ImU32 38 | cdef float _thickness 39 | cdef float _size 40 | cdef void draw(self, void*) noexcept nogil 41 | cdef void __compute_tip(self) 42 | 43 | cdef class DrawBezierCubic(drawingItem): 44 | cdef double[2] _p1 45 | cdef double[2] _p2 46 | cdef double[2] _p3 47 | cdef double[2] _p4 48 | cdef unsigned int _color # imgui.ImU32 49 | cdef float _thickness 50 | cdef int _segments 51 | cdef void draw(self, void*) noexcept nogil 52 | 53 | cdef class DrawBezierQuadratic(drawingItem): 54 | cdef double[2] _p1 55 | cdef double[2] _p2 56 | cdef double[2] _p3 57 | cdef unsigned int _color # imgui.ImU32 58 | cdef float _thickness 59 | cdef int _segments 60 | cdef void draw(self, void*) noexcept nogil 61 | 62 | cdef class DrawCircle(drawingItem): 63 | cdef double[2] _center 64 | cdef float _radius 65 | cdef unsigned int _color # imgui.ImU32 66 | cdef unsigned int _fill # imgui.ImU32 67 | cdef float _thickness 68 | cdef int _segments 69 | cdef void draw(self, void*) noexcept nogil 70 | 71 | cdef class DrawEllipse(drawingItem): 72 | cdef double[2] _pmin 73 | cdef double[2] _pmax 74 | cdef unsigned int _color # imgui.ImU32 75 | cdef unsigned int _fill # imgui.ImU32 76 | cdef float _thickness 77 | cdef int _segments 78 | cdef vector[double2] _points 79 | cdef void __fill_points(self) 80 | cdef void draw(self, void*) noexcept nogil 81 | 82 | cdef class DrawImage(drawingItem): 83 | cdef double[2] _p1 84 | cdef double[2] _p2 85 | cdef double[2] _p3 86 | cdef double[2] _p4 87 | cdef double[2] _center 88 | cdef double _direction 89 | cdef double _height 90 | cdef double _width 91 | cdef float[2] _uv1 92 | cdef float[2] _uv2 93 | cdef float[2] _uv3 94 | cdef float[2] _uv4 95 | cdef float _rounding 96 | cdef unsigned int _color_multiplier # imgui.ImU32 97 | cdef Texture _texture 98 | cdef void update_center(self) noexcept nogil 99 | cdef void update_extremities(self) noexcept nogil 100 | cdef void draw(self, void*) noexcept nogil 101 | 102 | cdef class DrawLine(drawingItem): 103 | cdef double[2] _p1 104 | cdef double[2] _p2 105 | cdef double[2] _center 106 | cdef double _length 107 | cdef double _direction 108 | cdef unsigned int _color # imgui.ImU32 109 | cdef float _thickness 110 | cdef void update_center(self) noexcept nogil 111 | cdef void update_extremities(self) noexcept nogil 112 | cdef void draw(self, void*) noexcept nogil 113 | 114 | cdef class DrawPolyline(drawingItem): 115 | cdef unsigned int _color # imgui.ImU32 116 | cdef float _thickness 117 | cdef bint _closed 118 | cdef vector[double2] _points 119 | cdef void draw(self, void*) noexcept nogil 120 | 121 | cdef class DrawPolygon(drawingItem): 122 | cdef unsigned int _color # imgui.ImU32 123 | cdef unsigned int _fill # imgui.ImU32 124 | cdef float _thickness 125 | cdef vector[double2] _points 126 | cdef int[:,:] _triangulation_indices 127 | cdef void __triangulate(self) 128 | cdef void draw(self, void*) noexcept nogil 129 | 130 | cdef class DrawQuad(drawingItem): 131 | cdef double[2] _p1 132 | cdef double[2] _p2 133 | cdef double[2] _p3 134 | cdef double[2] _p4 135 | cdef unsigned int _color # imgui.ImU32 136 | cdef unsigned int _fill # imgui.ImU32 137 | cdef float _thickness 138 | cdef void draw(self, void*) noexcept nogil 139 | 140 | cdef class DrawRect(drawingItem): 141 | cdef double[2] _pmin 142 | cdef double[2] _pmax 143 | cdef unsigned int _color # imgui.ImU32 144 | cdef unsigned int _color_upper_left # imgui.ImU32 145 | cdef unsigned int _color_upper_right # imgui.ImU32 146 | cdef unsigned int _color_bottom_left # imgui.ImU32 147 | cdef unsigned int _color_bottom_right # imgui.ImU32 148 | cdef unsigned int _fill # imgui.ImU32 149 | cdef float _rounding 150 | cdef float _thickness 151 | cdef bint _multicolor 152 | cdef void draw(self, void*) noexcept nogil 153 | 154 | cdef class DrawRegularPolygon(drawingItem): 155 | cdef double[2] _center 156 | cdef float _radius 157 | cdef double _direction 158 | cdef unsigned int _color # imgui.ImU32 159 | cdef unsigned int _fill # imgui.ImU32 160 | cdef float _thickness 161 | cdef int _num_points 162 | cdef vector[float2] _points 163 | cdef bint _dirty 164 | cdef void draw(self, void*) noexcept nogil 165 | 166 | cdef class DrawStar(drawingItem): 167 | cdef double[2] _center 168 | cdef float _radius 169 | cdef float _inner_radius 170 | cdef double _direction 171 | cdef unsigned int _color # imgui.ImU32 172 | cdef unsigned int _fill # imgui.ImU32 173 | cdef float _thickness 174 | cdef int _num_points 175 | cdef vector[float2] _points 176 | cdef vector[float2] _inner_points 177 | cdef bint _dirty 178 | cdef void draw(self, void*) noexcept nogil 179 | 180 | cdef class DrawText(drawingItem): 181 | cdef double[2] _pos 182 | cdef string _text 183 | cdef unsigned int _color # imgui.ImU32 184 | cdef float _size 185 | cdef baseFont _font 186 | cdef void draw(self, void*) noexcept nogil 187 | 188 | cdef class DrawTriangle(drawingItem): 189 | cdef double[2] _p1 190 | cdef double[2] _p2 191 | cdef double[2] _p3 192 | cdef unsigned int _color # imgui.ImU32 193 | cdef unsigned int _fill # imgui.ImU32 194 | cdef float _thickness 195 | cdef void draw(self, void*) noexcept nogil 196 | 197 | cdef class DrawValue(drawingItem): 198 | cdef char[256] buffer 199 | cdef double[2] _pos 200 | cdef string _print_format 201 | cdef unsigned int _color # imgui.ImU32 202 | cdef int _type 203 | cdef float _size 204 | cdef baseFont _font 205 | cdef SharedValue _value 206 | cdef void draw(self, void*) noexcept nogil -------------------------------------------------------------------------------- /dearcygui/font.pxd: -------------------------------------------------------------------------------- 1 | from libcpp.deque cimport deque 2 | from libcpp.vector cimport vector 3 | from cpython.ref cimport PyObject 4 | from .types cimport * 5 | from .core cimport baseItem, baseFont, Texture 6 | 7 | cdef class Font(baseFont): 8 | cdef void* _font # imgui.ImFont* 9 | cdef FontTexture _container 10 | cdef bint _dpi_scaling 11 | cdef float _scale 12 | cdef vector[float] _scales_backup 13 | cdef void push(self) noexcept nogil 14 | cdef void pop(self) noexcept nogil 15 | 16 | cdef class FontMultiScales(baseFont): 17 | cdef vector[PyObject*] _fonts # type Font 18 | cdef deque[float] _stored_scales # Store last 10 scales 19 | cdef vector[PyObject*] _callbacks # type Callback 20 | cdef vector[PyObject*] _applied_fonts # type Font 21 | cdef void push(self) noexcept nogil 22 | cdef void pop(self) noexcept nogil 23 | 24 | cdef class AutoFont(FontMultiScales): 25 | cdef str _main_font_path 26 | cdef str _italic_font_path 27 | cdef str _bold_font_path 28 | cdef str _bold_italic_path 29 | cdef dict _kwargs 30 | cdef float _base_size 31 | cdef object _font_creation_executor # ThreadPoolExecutor 32 | cdef set _pending_fonts # set of scales being created 33 | cdef object _font_creator # Callable that creates fonts 34 | cpdef void _create_font_at_scale(self, float scale, bint no_fail) 35 | cdef void _add_new_font_to_list(self, Font font) 36 | 37 | cdef class FontTexture(baseItem): 38 | """ 39 | Packs one or several fonts into 40 | a texture for internal use by ImGui. 41 | """ 42 | cdef void* _atlas # imgui.ImFontAtlas * 43 | cdef Texture _texture 44 | cdef bint _built 45 | cdef list _fonts_files # content of the font files 46 | cdef list _fonts 47 | 48 | cdef class GlyphSet: 49 | cdef readonly int height 50 | cdef readonly dict images 51 | cdef readonly dict positioning 52 | cdef readonly int origin_y 53 | cpdef void add_glyph(self, 54 | int unicode_key, 55 | object image, 56 | float dy, 57 | float dx, 58 | float advance) 59 | 60 | cdef class FontRenderer: 61 | cdef object _face 62 | cpdef GlyphSet render_glyph_set(self, 63 | target_pixel_height=?, 64 | target_size=?, 65 | str hinter=?, 66 | restrict_to=?, 67 | allow_color=?) -------------------------------------------------------------------------------- /dearcygui/handler.pxd: -------------------------------------------------------------------------------- 1 | from .core cimport * 2 | from .types cimport * 3 | 4 | cdef class CustomHandler(baseHandler): 5 | cdef bint _has_run 6 | cdef void check_bind(self, baseItem) 7 | cdef bint check_state(self, baseItem) noexcept nogil 8 | cdef void run_handler(self, baseItem) noexcept nogil 9 | 10 | cdef class HandlerList(baseHandler): 11 | cdef HandlerListOP _op 12 | cdef void check_bind(self, baseItem) 13 | cdef bint check_state(self, baseItem) noexcept nogil 14 | cdef void run_handler(self, baseItem) noexcept nogil 15 | 16 | cdef class ConditionalHandler(baseHandler): 17 | cdef void check_bind(self, baseItem) 18 | cdef bint check_state(self, baseItem) noexcept nogil 19 | cdef void run_handler(self, baseItem) noexcept nogil 20 | 21 | cdef class OtherItemHandler(HandlerList): 22 | cdef baseItem _target 23 | cdef void check_bind(self, baseItem) 24 | cdef bint check_state(self, baseItem) noexcept nogil 25 | cdef void run_handler(self, baseItem) noexcept nogil 26 | 27 | cdef class ActivatedHandler(baseHandler): 28 | cdef void check_bind(self, baseItem) 29 | cdef bint check_state(self, baseItem) noexcept nogil 30 | 31 | cdef class ActiveHandler(baseHandler): 32 | cdef void check_bind(self, baseItem) 33 | cdef bint check_state(self, baseItem) noexcept nogil 34 | 35 | cdef class ClickedHandler(baseHandler): 36 | cdef MouseButton _button 37 | cdef void check_bind(self, baseItem) 38 | cdef bint check_state(self, baseItem) noexcept nogil 39 | cdef void run_handler(self, baseItem) noexcept nogil 40 | 41 | cdef class DoubleClickedHandler(baseHandler): 42 | cdef MouseButton _button 43 | cdef void check_bind(self, baseItem) 44 | cdef bint check_state(self, baseItem) noexcept nogil 45 | cdef void run_handler(self, baseItem) noexcept nogil 46 | 47 | cdef class DeactivatedHandler(baseHandler): 48 | cdef void check_bind(self, baseItem) 49 | cdef bint check_state(self, baseItem) noexcept nogil 50 | 51 | cdef class DeactivatedAfterEditHandler(baseHandler): 52 | cdef void check_bind(self, baseItem) 53 | cdef bint check_state(self, baseItem) noexcept nogil 54 | 55 | cdef class DraggedHandler(baseHandler): 56 | cdef MouseButton _button 57 | cdef void check_bind(self, baseItem) 58 | cdef bint check_state(self, baseItem) noexcept nogil 59 | cdef void run_handler(self, baseItem) noexcept nogil 60 | 61 | cdef class DraggingHandler(baseHandler): 62 | cdef MouseButton _button 63 | cdef void check_bind(self, baseItem) 64 | cdef bint check_state(self, baseItem) noexcept nogil 65 | cdef void run_handler(self, baseItem) noexcept nogil 66 | 67 | cdef class EditedHandler(baseHandler): 68 | cdef void check_bind(self, baseItem) 69 | cdef bint check_state(self, baseItem) noexcept nogil 70 | 71 | cdef class FocusHandler(baseHandler): 72 | cdef void check_bind(self, baseItem) 73 | cdef bint check_state(self, baseItem) noexcept nogil 74 | 75 | cdef class GotFocusHandler(baseHandler): 76 | cdef void check_bind(self, baseItem) 77 | cdef bint check_state(self, baseItem) noexcept nogil 78 | 79 | cdef class LostFocusHandler(baseHandler): 80 | cdef void check_bind(self, baseItem) 81 | cdef bint check_state(self, baseItem) noexcept nogil 82 | 83 | cdef class MouseOverHandler(baseHandler): 84 | cdef void check_bind(self, baseItem) 85 | cdef bint check_state(self, baseItem) noexcept nogil 86 | 87 | cdef class GotMouseOverHandler(baseHandler): 88 | cdef void check_bind(self, baseItem) 89 | cdef bint check_state(self, baseItem) noexcept nogil 90 | 91 | cdef class LostMouseOverHandler(baseHandler): 92 | cdef void check_bind(self, baseItem) 93 | cdef bint check_state(self, baseItem) noexcept nogil 94 | 95 | cdef class HoverHandler(baseHandler): 96 | cdef void check_bind(self, baseItem) 97 | cdef bint check_state(self, baseItem) noexcept nogil 98 | 99 | cdef class GotHoverHandler(baseHandler): 100 | cdef void check_bind(self, baseItem) 101 | cdef bint check_state(self, baseItem) noexcept nogil 102 | 103 | cdef class LostHoverHandler(baseHandler): 104 | cdef void check_bind(self, baseItem) 105 | cdef bint check_state(self, baseItem) noexcept nogil 106 | 107 | cdef class MotionHandler(baseHandler): 108 | cdef Positioning[2] _positioning 109 | cdef void check_bind(self, baseItem) 110 | cdef bint check_state(self, baseItem) noexcept nogil 111 | 112 | cdef class ContentResizeHandler(baseHandler): 113 | cdef void check_bind(self, baseItem) 114 | cdef bint check_state(self, baseItem) noexcept nogil 115 | 116 | cdef class ResizeHandler(baseHandler): 117 | cdef void check_bind(self, baseItem) 118 | cdef bint check_state(self, baseItem) noexcept nogil 119 | 120 | cdef class ToggledOpenHandler(baseHandler): 121 | cdef void check_bind(self, baseItem) 122 | cdef bint check_state(self, baseItem) noexcept nogil 123 | 124 | cdef class ToggledCloseHandler(baseHandler): 125 | cdef void check_bind(self, baseItem) 126 | cdef bint check_state(self, baseItem) noexcept nogil 127 | 128 | cdef class OpenHandler(baseHandler): 129 | cdef void check_bind(self, baseItem) 130 | cdef bint check_state(self, baseItem) noexcept nogil 131 | 132 | cdef class CloseHandler(baseHandler): 133 | cdef void check_bind(self, baseItem) 134 | cdef bint check_state(self, baseItem) noexcept nogil 135 | 136 | cdef class RenderHandler(baseHandler): 137 | cdef void check_bind(self, baseItem) 138 | cdef bint check_state(self, baseItem) noexcept nogil 139 | 140 | cdef class GotRenderHandler(baseHandler): 141 | cdef void check_bind(self, baseItem) 142 | cdef bint check_state(self, baseItem) noexcept nogil 143 | 144 | cdef class LostRenderHandler(baseHandler): 145 | cdef void check_bind(self, baseItem) 146 | cdef bint check_state(self, baseItem) noexcept nogil 147 | 148 | cdef class MouseCursorHandler(baseHandler): 149 | cdef MouseCursor _mouse_cursor 150 | cdef void check_bind(self, baseItem) 151 | cdef bint check_state(self, baseItem) noexcept nogil 152 | cdef void run_handler(self, baseItem) noexcept nogil 153 | 154 | cdef class KeyDownHandler(baseHandler): 155 | cdef int _key 156 | cdef bint check_state(self, baseItem item) noexcept nogil 157 | cdef void run_handler(self, baseItem) noexcept nogil 158 | 159 | cdef class KeyPressHandler(baseHandler): 160 | cdef int _key 161 | cdef bint _repeat 162 | cdef bint check_state(self, baseItem item) noexcept nogil 163 | cdef void run_handler(self, baseItem) noexcept nogil 164 | 165 | cdef class KeyReleaseHandler(baseHandler): 166 | cdef int _key 167 | cdef bint check_state(self, baseItem item) noexcept nogil 168 | cdef void run_handler(self, baseItem) noexcept nogil 169 | 170 | cdef class MouseClickHandler(baseHandler): 171 | cdef MouseButton _button 172 | cdef bint _repeat 173 | cdef bint check_state(self, baseItem item) noexcept nogil 174 | cdef void run_handler(self, baseItem) noexcept nogil 175 | 176 | cdef class MouseDoubleClickHandler(baseHandler): 177 | cdef MouseButton _button 178 | cdef bint check_state(self, baseItem item) noexcept nogil 179 | cdef void run_handler(self, baseItem) noexcept nogil 180 | 181 | cdef class MouseDownHandler(baseHandler): 182 | cdef MouseButton _button 183 | cdef bint check_state(self, baseItem item) noexcept nogil 184 | cdef void run_handler(self, baseItem) noexcept nogil 185 | 186 | cdef class MouseDragHandler(baseHandler): 187 | cdef MouseButton _button 188 | cdef float _threshold 189 | cdef bint check_state(self, baseItem item) noexcept nogil 190 | cdef void run_handler(self, baseItem) noexcept nogil 191 | 192 | cdef class MouseMoveHandler(baseHandler): 193 | cdef bint check_state(self, baseItem item) noexcept nogil 194 | cdef void run_handler(self, baseItem) noexcept nogil 195 | 196 | cdef class MouseInRect(baseHandler): 197 | cdef double _x1, _y1, _x2, _y2 198 | cdef bint check_state(self, baseItem item) noexcept nogil 199 | cdef void run_handler(self, baseItem) noexcept nogil 200 | 201 | cdef class MouseReleaseHandler(baseHandler): 202 | cdef MouseButton _button 203 | cdef bint check_state(self, baseItem item) noexcept nogil 204 | cdef void run_handler(self, baseItem) noexcept nogil 205 | 206 | cdef class MouseWheelHandler(baseHandler): 207 | cdef bint _horizontal 208 | cdef bint check_state(self, baseItem item) noexcept nogil 209 | cdef void run_handler(self, baseItem) noexcept nogil -------------------------------------------------------------------------------- /dearcygui/imgui_config.h: -------------------------------------------------------------------------------- 1 | #define IMGUI_ENABLE_FREETYPE 2 | #define ImDrawIdx unsigned int 3 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 4 | #define IMGUI_USE_WCHAR32 5 | // Disable asserts 6 | #define IM_ASSERT(_EXPR) do {} while(0) 7 | #define IMGUI_DISABLE_DEBUG_TOOLS 8 | // needed for imnodes 9 | #define IMGUI_DEFINE_MATH_OPERATORS 10 | -------------------------------------------------------------------------------- /dearcygui/imgui_types.pxd: -------------------------------------------------------------------------------- 1 | from dearcygui.wrapper cimport imgui, implot 2 | from .c_types cimport Vec2, Vec4 3 | 4 | # Here all the types that need a cimport 5 | # of imgui. In order to enable Cython code 6 | # to interact with us without using imgui, 7 | # we try to avoid as much as possible to 8 | # include this file in the .pxd files. 9 | 10 | cpdef enum class ButtonDirection: 11 | NONE = imgui.ImGuiDir_None, 12 | LEFT = imgui.ImGuiDir_Left, 13 | RIGHT = imgui.ImGuiDir_Right, 14 | UP = imgui.ImGuiDir_Up, 15 | DOWN = imgui.ImGuiDir_Down 16 | 17 | cpdef enum class AxisScale: 18 | LINEAR=implot.ImPlotScale_Linear 19 | TIME=implot.ImPlotScale_Time 20 | LOG10=implot.ImPlotScale_Log10 21 | SYMLOG=implot.ImPlotScale_SymLog 22 | 23 | cpdef enum class Axis: 24 | X1=implot.ImAxis_X1 25 | X2=implot.ImAxis_X2 26 | X3=implot.ImAxis_X3 27 | Y1=implot.ImAxis_Y1 28 | Y2=implot.ImAxis_Y2 29 | Y3=implot.ImAxis_Y3 30 | 31 | cpdef enum class LegendLocation: 32 | CENTER=implot.ImPlotLocation_Center 33 | NORTH=implot.ImPlotLocation_Center 34 | SOUTH=implot.ImPlotLocation_Center 35 | WEST=implot.ImPlotLocation_Center 36 | EAST=implot.ImPlotLocation_Center 37 | NORTHWEST=implot.ImPlotLocation_NorthWest 38 | NORTHEAST=implot.ImPlotLocation_NorthEast 39 | SOUTHWEST=implot.ImPlotLocation_SouthWest 40 | SOUTHEAST=implot.ImPlotLocation_SouthEast 41 | 42 | cdef imgui.ImU32 imgui_ColorConvertFloat4ToU32(imgui.ImVec4) noexcept nogil 43 | cdef imgui.ImVec4 imgui_ColorConvertU32ToFloat4(imgui.ImU32) noexcept nogil 44 | 45 | cdef inline imgui.ImU32 parse_color(src): 46 | if isinstance(src, int): 47 | # RGBA, little endian 48 | return (src) 49 | cdef int src_size = 5 # to trigger error by default 50 | if hasattr(src, '__len__'): 51 | src_size = len(src) 52 | if src_size == 0 or src_size > 4: 53 | raise TypeError("Color data must either an int32 (rgba, little endian),\n" \ 54 | "or an array of int (r, g, b, a) or float (r, g, b, a) normalized") 55 | cdef imgui.ImVec4 color_float4 56 | cdef imgui.ImU32 color_u32 57 | cdef bint contains_nonints = False 58 | cdef int i 59 | cdef float[4] values 60 | cdef int[4] values_int 61 | 62 | for i in range(src_size): 63 | element = src[i] 64 | if not(isinstance(element, int)): 65 | contains_nonints = True 66 | values[i] = element 67 | values_int[i] = values[i] 68 | else: 69 | values_int[i] = element 70 | values[i] = values_int[i] 71 | for i in range(src_size, 4): 72 | values[i] = 1. 73 | values_int[i] = 255 74 | 75 | if not(contains_nonints): 76 | for i in range(4): 77 | if values_int[i] < 0 or values_int[i] > 255: 78 | raise ValueError("Color value component outside bounds (0...255)") 79 | color_u32 = values_int[0] 80 | color_u32 |= (values_int[1]) << 8 81 | color_u32 |= (values_int[2]) << 16 82 | color_u32 |= (values_int[3]) << 24 83 | return color_u32 84 | 85 | for i in range(4): 86 | if values[i] < 0. or values[i] > 1.: 87 | raise ValueError("Color value component outside bounds (0...1)") 88 | 89 | color_float4.x = values[0] 90 | color_float4.y = values[1] 91 | color_float4.z = values[2] 92 | color_float4.w = values[3] 93 | return imgui_ColorConvertFloat4ToU32(color_float4) 94 | 95 | cdef inline void unparse_color(float *dst, imgui.ImU32 color_uint) noexcept nogil: 96 | cdef imgui.ImVec4 color_float4 = imgui_ColorConvertU32ToFloat4(color_uint) 97 | dst[0] = color_float4.x 98 | dst[1] = color_float4.y 99 | dst[2] = color_float4.z 100 | dst[3] = color_float4.w 101 | 102 | # These conversions are to avoid 103 | # using imgui.* in pxd files. 104 | 105 | cdef inline imgui.ImVec2 Vec2ImVec2(Vec2 src) noexcept nogil: 106 | cdef imgui.ImVec2 dst 107 | dst.x = src.x 108 | dst.y = src.y 109 | return dst 110 | 111 | cdef inline imgui.ImVec4 Vec4ImVec4(Vec4 src) noexcept nogil: 112 | cdef imgui.ImVec4 dst 113 | dst.x = src.x 114 | dst.y = src.y 115 | dst.z = src.z 116 | dst.w = src.w 117 | return dst 118 | 119 | cdef inline Vec2 ImVec2Vec2(imgui.ImVec2 src) noexcept nogil: 120 | cdef Vec2 dst 121 | dst.x = src.x 122 | dst.y = src.y 123 | return dst 124 | 125 | cdef inline Vec4 ImVec4Vec4(imgui.ImVec4 src) noexcept nogil: 126 | cdef Vec4 dst 127 | dst.x = src.x 128 | dst.y = src.y 129 | dst.z = src.z 130 | dst.w = src.w 131 | return dst 132 | 133 | -------------------------------------------------------------------------------- /dearcygui/imgui_types.pyx: -------------------------------------------------------------------------------- 1 | from dearcygui.wrapper cimport imgui 2 | 3 | cdef imgui.ImU32 imgui_ColorConvertFloat4ToU32(imgui.ImVec4 color_float4) noexcept nogil: 4 | return imgui.ColorConvertFloat4ToU32(color_float4) 5 | 6 | cdef imgui.ImVec4 imgui_ColorConvertU32ToFloat4(imgui.ImU32 color_uint) noexcept nogil: 7 | return imgui.ColorConvertU32ToFloat4(color_uint) 8 | 9 | def color_as_int(val)-> int: 10 | """ 11 | Convert any color representation to an integer (packed rgba). 12 | """ 13 | cdef imgui.ImU32 color = parse_color(val) 14 | return int(color) 15 | 16 | def color_as_ints(val) -> tuple[int, int, int, int]: 17 | """ 18 | Convert any color representation to a tuple of integers (r, g, b, a). 19 | """ 20 | cdef imgui.ImU32 color = parse_color(val) 21 | cdef imgui.ImVec4 color_vec = imgui.ColorConvertU32ToFloat4(color) 22 | return (int(255. * color_vec.x), 23 | int(255. * color_vec.y), 24 | int(255. * color_vec.z), 25 | int(255. * color_vec.w)) 26 | 27 | def color_as_floats(val) -> tuple[float, float, float, float]: 28 | """ 29 | Convert any color representation to a tuple of floats (r, g, b, a). 30 | """ 31 | cdef imgui.ImU32 color = parse_color(val) 32 | cdef imgui.ImVec4 color_vec = imgui.ColorConvertU32ToFloat4(color) 33 | return (color_vec.x, color_vec.y, color_vec.z, color_vec.w) 34 | -------------------------------------------------------------------------------- /dearcygui/layout.pxd: -------------------------------------------------------------------------------- 1 | from .core cimport uiItem 2 | from .c_types cimport Vec2 3 | from .types cimport Alignment 4 | 5 | from cpython.ref cimport PyObject 6 | from libcpp.vector cimport vector 7 | 8 | cdef class Layout(uiItem): 9 | cdef bint _force_update 10 | cdef Vec2 _spacing 11 | cdef PyObject* _previous_last_child 12 | cdef Vec2 update_content_area(self) noexcept nogil 13 | cdef void draw_child(self, uiItem child) noexcept nogil 14 | cdef void draw_children(self) noexcept nogil 15 | cdef bint check_change(self) noexcept nogil 16 | cdef bint draw_item(self) noexcept nogil 17 | 18 | cdef class HorizontalLayout(Layout): 19 | cdef Alignment _alignment_mode 20 | cdef vector[float] _positions 21 | cdef bint _no_wrap 22 | cdef float _wrap_x 23 | cdef float __compute_items_size(self, int&) noexcept nogil 24 | cdef void __update_layout(self) noexcept nogil 25 | cdef bint draw_item(self) noexcept nogil 26 | 27 | cdef class VerticalLayout(Layout): 28 | cdef Alignment _alignment_mode 29 | cdef vector[float] _positions 30 | cdef float __compute_items_size(self, int&) noexcept nogil 31 | cdef void __update_layout(self) noexcept nogil 32 | cdef bint draw_item(self) noexcept nogil 33 | 34 | cdef class WindowLayout(uiItem): 35 | cdef bint _force_update 36 | cdef Vec2 _spacing 37 | cdef PyObject* _previous_last_child 38 | cdef Vec2 update_content_area(self) noexcept nogil 39 | cdef void draw_child(self, uiItem child) noexcept nogil 40 | cdef void draw_children(self) noexcept nogil 41 | cdef bint check_change(self) noexcept nogil 42 | cdef void __update_layout(self) noexcept nogil 43 | cdef void draw(self) noexcept nogil 44 | 45 | cdef class WindowHorizontalLayout(WindowLayout): 46 | cdef Alignment _alignment_mode 47 | cdef vector[float] _positions 48 | cdef float __compute_items_size(self, int &n_items) noexcept nogil 49 | cdef void __update_layout(self) noexcept nogil 50 | 51 | cdef class WindowVerticalLayout(WindowLayout): 52 | cdef Alignment _alignment_mode 53 | cdef vector[float] _positions 54 | cdef float __compute_items_size(self, int &n_items) noexcept nogil 55 | cdef void __update_layout(self) noexcept nogil -------------------------------------------------------------------------------- /dearcygui/os.pxd: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dearcygui/os.pyi: -------------------------------------------------------------------------------- 1 | """ 2 | This type stub file was generated by cyright. 3 | """ 4 | 5 | def show_open_file_dialog(callback, default_location: str = ..., allow_multiple_files: bool = ...): # -> None: 6 | """ 7 | Open the OS file open selection dialog 8 | 9 | callback is a function that will be called with a single 10 | argument: a list of paths. Can be None or [] if the dialog 11 | was cancelled or nothing was selected. 12 | 13 | default_location: optional default location 14 | allow_multiple_files (default to False): if True, allow 15 | selecting several paths which will be passed to the list 16 | given to the callback. If False, the list has maximum a 17 | single argument. 18 | """ 19 | ... 20 | 21 | def show_save_file_dialog(callback, default_location: str = ...): # -> None: 22 | """ 23 | Open the OS file save selection dialog 24 | 25 | callback is a function that will be called with a single 26 | argument: a list of paths. Can be None or [] if the dialog 27 | was cancelled or nothing was selected. else, the list 28 | will contain a single path. 29 | 30 | default_location: optional default location 31 | """ 32 | ... 33 | 34 | def show_open_folder_dialog(callback, default_location: str = ..., allow_multiple_files: bool = ...): # -> None: 35 | """ 36 | Open the OS directory open selection dialog 37 | 38 | callback is a function that will be called with a single 39 | argument: a list of paths. Can be None or [] if the dialog 40 | was cancelled or nothing was selected. 41 | 42 | default_location: optional default location 43 | allow_multiple_files (default to False): if True, allow 44 | selecting several paths which will be passed to the list 45 | given to the callback. If False, the list has maximum a 46 | single argument. 47 | """ 48 | ... 49 | 50 | -------------------------------------------------------------------------------- /dearcygui/os.pyx: -------------------------------------------------------------------------------- 1 | from cpython.ref cimport PyObject, Py_INCREF, Py_DECREF 2 | import traceback 3 | 4 | 5 | """ 6 | System File dialog 7 | """ 8 | 9 | cdef extern from "SDL3/SDL_dialog.h" nogil: 10 | struct SDL_Window_: 11 | pass 12 | ctypedef SDL_Window_* SDL_Window 13 | struct SDL_DialogFileFilter: 14 | const char* name 15 | const char* pattern 16 | ctypedef void (*SDL_DialogFileCallback)(void*, const char*const*, int) 17 | void SDL_ShowOpenFileDialog(SDL_DialogFileCallback, void*, SDL_Window_*, SDL_DialogFileFilter*, int, const char*, bint) 18 | void SDL_ShowSaveFileDialog(SDL_DialogFileCallback, void*, SDL_Window_*, SDL_DialogFileFilter*, int, const char*) 19 | void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback, void*, SDL_Window_*, const char*, bint) 20 | 21 | cdef void dialog_callback(void *userdata, 22 | const char *const*filelist, 23 | int filter) noexcept nogil: 24 | with gil: 25 | dialog_callback_gil(userdata, filelist, filter) 26 | 27 | cdef void dialog_callback_gil(void *userdata, 28 | const char *const*filelist, 29 | int filter): 30 | cdef object callback 31 | result = None 32 | if filelist != NULL: 33 | result = [] 34 | while filelist[0] != NULL: 35 | result.append(str(filelist[0], encoding='utf-8')) 36 | filelist += 1 37 | if userdata == NULL: 38 | return 39 | callback = userdata 40 | try: 41 | callback(result) 42 | except Exception as e: 43 | print(traceback.format_exc()) 44 | 45 | def show_open_file_dialog(callback, str default_location=None, bint allow_multiple_files=False): 46 | """ 47 | Open the OS file open selection dialog 48 | 49 | callback is a function that will be called with a single 50 | argument: a list of paths. Can be None or [] if the dialog 51 | was cancelled or nothing was selected. 52 | 53 | default_location: optional default location 54 | allow_multiple_files (default to False): if True, allow 55 | selecting several paths which will be passed to the list 56 | given to the callback. If False, the list has maximum a 57 | single argument. 58 | """ 59 | Py_INCREF(callback) 60 | cdef char *default_location_c = NULL 61 | cdef bytes default_location_array = None 62 | if default_location is not None: 63 | default_location_array = bytes(default_location, 'utf-8') 64 | default_location_c = default_location_array 65 | SDL_ShowOpenFileDialog(dialog_callback, callback, NULL, NULL, 0, default_location_c, allow_multiple_files) 66 | 67 | def show_save_file_dialog(callback, str default_location=None): 68 | """ 69 | Open the OS file save selection dialog 70 | 71 | callback is a function that will be called with a single 72 | argument: a list of paths. Can be None or [] if the dialog 73 | was cancelled or nothing was selected. else, the list 74 | will contain a single path. 75 | 76 | default_location: optional default location 77 | """ 78 | Py_INCREF(callback) 79 | cdef char *default_location_c = NULL 80 | cdef bytes default_location_array = None 81 | if default_location is not None: 82 | default_location_array = bytes(default_location, 'utf-8') 83 | default_location_c = default_location_array 84 | SDL_ShowSaveFileDialog(dialog_callback, callback, NULL, NULL, 0, default_location_c) 85 | 86 | def show_open_folder_dialog(callback, str default_location=None, bint allow_multiple_files=False): 87 | """ 88 | Open the OS directory open selection dialog 89 | 90 | callback is a function that will be called with a single 91 | argument: a list of paths. Can be None or [] if the dialog 92 | was cancelled or nothing was selected. 93 | 94 | default_location: optional default location 95 | allow_multiple_files (default to False): if True, allow 96 | selecting several paths which will be passed to the list 97 | given to the callback. If False, the list has maximum a 98 | single argument. 99 | """ 100 | Py_INCREF(callback) 101 | cdef char *default_location_c = NULL 102 | cdef bytes default_location_array = None 103 | if default_location is not None: 104 | default_location_array = bytes(default_location, 'utf-8') 105 | default_location_c = default_location_array 106 | SDL_ShowOpenFolderDialog(dialog_callback, callback, NULL, default_location_c, allow_multiple_files) 107 | -------------------------------------------------------------------------------- /dearcygui/plot.pxd: -------------------------------------------------------------------------------- 1 | from .core cimport baseItem, baseFont, itemState, \ 2 | plotElement, uiItem, Callback, baseHandler 3 | from .types cimport * 4 | 5 | from libcpp.string cimport string 6 | from libcpp.vector cimport vector 7 | 8 | cimport numpy as cnp 9 | 10 | cdef class AxesResizeHandler(baseHandler): 11 | cdef int[2] _axes 12 | cdef void check_bind(self, baseItem) 13 | cdef bint check_state(self, baseItem) noexcept nogil 14 | cdef void run_handler(self, baseItem) noexcept nogil 15 | 16 | 17 | cdef class PlotAxisConfig(baseItem): 18 | cdef bint _enabled 19 | cdef int _scale # AxisScale 20 | cdef string _tick_format 21 | cdef int _flags # implot.ImPlotAxisFlags 22 | cdef double _min 23 | cdef double _max 24 | cdef double _prev_min 25 | cdef double _prev_max 26 | cdef bint _dirty_minmax 27 | cdef double _constraint_min 28 | cdef double _constraint_max 29 | cdef double _zoom_min 30 | cdef double _zoom_max 31 | cdef double _mouse_coord 32 | cdef bint _to_fit 33 | cdef itemState state 34 | cdef Callback _resize_callback 35 | cdef string _label 36 | cdef string _format 37 | cdef vector[string] _labels 38 | cdef vector[const char*] _labels_cstr 39 | cdef vector[double] _labels_coord 40 | cdef bint _keep_default_ticks 41 | cdef void setup(self, int) noexcept nogil # implot.ImAxis 42 | cdef void after_setup(self, int) noexcept nogil # implot.ImAxis 43 | cdef void after_plot(self, int) noexcept nogil # implot.ImAxis 44 | cdef void set_hidden(self) noexcept nogil 45 | 46 | cdef class PlotLegendConfig(baseItem): 47 | cdef bint _show 48 | cdef int _location # LegendLocation 49 | cdef int _flags # implot.ImPlotLegendFlags 50 | cdef void setup(self) noexcept nogil 51 | cdef void after_setup(self) noexcept nogil 52 | 53 | cdef class Plot(uiItem): 54 | cdef PlotAxisConfig _X1 55 | cdef PlotAxisConfig _X2 56 | cdef PlotAxisConfig _X3 57 | cdef PlotAxisConfig _Y1 58 | cdef PlotAxisConfig _Y2 59 | cdef PlotAxisConfig _Y3 60 | cdef PlotLegendConfig _legend 61 | cdef int _pan_button 62 | cdef int _pan_modifier # imgui.ImGuiKeyChord 63 | cdef int _fit_button 64 | cdef int _menu_button 65 | cdef int _override_mod # imgui.ImGuiKeyChord 66 | cdef int _zoom_mod # imgui.ImGuiKeyChord 67 | cdef float _zoom_rate 68 | cdef bint _use_local_time 69 | cdef bint _use_ISO8601 70 | cdef bint _use_24hour_clock 71 | cdef int _mouse_location # LegendLocation 72 | cdef int _flags # implot.ImPlotFlags 73 | cdef bint draw_item(self) noexcept nogil 74 | 75 | cdef class plotElementWithLegend(plotElement): 76 | cdef itemState state 77 | cdef bint _legend 78 | cdef int _legend_button 79 | cdef baseFont _font 80 | cdef bint _enabled 81 | cdef bint _enabled_dirty 82 | cdef void draw(self) noexcept nogil 83 | cdef void draw_element(self) noexcept nogil 84 | 85 | cdef class plotElementXY(plotElementWithLegend): 86 | cdef cnp.ndarray _X 87 | cdef cnp.ndarray _Y 88 | cdef void check_arrays(self) noexcept nogil 89 | 90 | cdef class PlotLine(plotElementXY): 91 | cdef void draw_element(self) noexcept nogil 92 | 93 | cdef class plotElementXYY(plotElementWithLegend): 94 | cdef cnp.ndarray _X 95 | cdef cnp.ndarray _Y1 96 | cdef cnp.ndarray _Y2 97 | cdef void check_arrays(self) noexcept nogil 98 | 99 | cdef class PlotShadedLine(plotElementXYY): 100 | cdef void draw_element(self) noexcept nogil 101 | 102 | cdef class PlotStems(plotElementXY): 103 | cdef void draw_element(self) noexcept nogil 104 | 105 | cdef class PlotBars(plotElementXY): 106 | cdef double _weight 107 | cdef void draw_element(self) noexcept nogil 108 | 109 | cdef class PlotStairs(plotElementXY): 110 | cdef void draw_element(self) noexcept nogil 111 | 112 | cdef class plotElementX(plotElementWithLegend): 113 | cdef cnp.ndarray _X 114 | cdef void check_arrays(self) noexcept nogil 115 | 116 | cdef class PlotInfLines(plotElementX): 117 | cdef void draw_element(self) noexcept nogil 118 | 119 | cdef class PlotScatter(plotElementXY): 120 | cdef void draw_element(self) noexcept nogil 121 | 122 | cdef class DrawInPlot(plotElementWithLegend): 123 | cdef bint _ignore_fit 124 | cdef void draw(self) noexcept nogil 125 | 126 | cdef class Subplots(uiItem): 127 | cdef int _rows 128 | cdef int _cols 129 | cdef vector[float] _row_ratios 130 | cdef vector[float] _col_ratios 131 | cdef int _flags # implot.ImPlotSubplotFlags 132 | cdef bint draw_item(self) noexcept nogil 133 | 134 | cdef class PlotBarGroups(plotElementWithLegend): 135 | cdef cnp.ndarray _values 136 | cdef vector[string] _labels 137 | cdef double _group_size 138 | cdef double _shift 139 | cdef void draw_element(self) noexcept nogil 140 | 141 | cdef class PlotPieChart(plotElementWithLegend): 142 | cdef cnp.ndarray _values 143 | cdef vector[string] _labels 144 | cdef double _x 145 | cdef double _y 146 | cdef double _radius 147 | cdef double _angle 148 | cdef void draw_element(self) noexcept nogil 149 | 150 | cdef class PlotDigital(plotElementXY): 151 | cdef void draw_element(self) noexcept nogil 152 | 153 | cdef class PlotAnnotation(plotElement): 154 | cdef string _text 155 | cdef double _x 156 | cdef double _y 157 | cdef int _bg_color 158 | cdef Vec2 _offset 159 | cdef bint _clamp 160 | cdef void draw_element(self) noexcept nogil 161 | 162 | -------------------------------------------------------------------------------- /dearcygui/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/dearcygui/py.typed -------------------------------------------------------------------------------- /dearcygui/theme.pxd: -------------------------------------------------------------------------------- 1 | from libcpp.unordered_map cimport unordered_map 2 | from .core cimport * 3 | from .types cimport * 4 | 5 | cdef class baseThemeColor(baseTheme): 6 | cdef list _names 7 | cdef unordered_map[int, unsigned int] _index_to_value 8 | cdef object __common_getter(self, int) 9 | cdef void __common_setter(self, int, object) 10 | 11 | cdef class ThemeColorImGui(baseThemeColor): 12 | cdef void push(self) noexcept nogil 13 | cdef void push_to_list(self, vector[theme_action]&) noexcept nogil 14 | cdef void pop(self) noexcept nogil 15 | 16 | cdef class ThemeColorImPlot(baseThemeColor): 17 | cdef void push(self) noexcept nogil 18 | cdef void push_to_list(self, vector[theme_action]&) noexcept nogil 19 | cdef void pop(self) noexcept nogil 20 | 21 | ''' 22 | cdef class ThemeColorImNodes(baseThemeColor): 23 | cdef void push(self) noexcept nogil 24 | cdef void push_to_list(self, vector[theme_action]&) noexcept nogil 25 | cdef void pop(self) noexcept nogil 26 | ''' 27 | 28 | ctypedef struct theme_value_info: 29 | theme_value value 30 | theme_value_types value_type 31 | theme_value_float2_mask float2_mask 32 | bint should_round 33 | bint should_scale 34 | 35 | cdef class baseThemeStyle(baseTheme): 36 | cdef list _names 37 | cdef theme_backends _backend 38 | cdef unordered_map[int, theme_value_info] _index_to_value 39 | cdef unordered_map[int, theme_value_info] _index_to_value_for_dpi 40 | cdef float _dpi 41 | cdef bint _dpi_scaling 42 | cdef bint _round_after_scale 43 | cdef object __common_getter(self, int, theme_value_types) 44 | cdef void __common_setter(self, int, theme_value_types, bint, bint, py_value) 45 | cdef void __compute_for_dpi(self) noexcept nogil 46 | cdef void push_to_list(self, vector[theme_action]&) noexcept nogil 47 | cdef void push(self) noexcept nogil 48 | cdef void pop(self) noexcept nogil 49 | 50 | cdef class ThemeStyleImGui(baseThemeStyle): 51 | pass 52 | 53 | cdef class ThemeStyleImPlot(baseThemeStyle): 54 | pass 55 | 56 | cdef class ThemeStyleImNodes(baseThemeStyle): 57 | pass 58 | 59 | cdef class ThemeList(baseTheme): 60 | cdef void push(self) noexcept nogil 61 | cdef void push_to_list(self, vector[theme_action]&) noexcept nogil 62 | cdef void pop(self) noexcept nogil 63 | 64 | cdef class ThemeListWithCondition(baseTheme): 65 | cdef ThemeEnablers _activation_condition_enabled 66 | cdef ThemeCategories _activation_condition_category 67 | cdef void push(self) noexcept nogil 68 | cdef void pop(self) noexcept nogil 69 | cdef void push_to_list(self, vector[theme_action]& v) noexcept nogil 70 | 71 | cdef class ThemeStopCondition(baseTheme): 72 | cdef vector[int] _start_pending_theme_actions_backup 73 | cdef void push(self) noexcept nogil 74 | cdef void pop(self) noexcept nogil 75 | cdef void push_to_list(self, vector[theme_action]& v) noexcept nogil 76 | -------------------------------------------------------------------------------- /dearcygui/types.pxd: -------------------------------------------------------------------------------- 1 | # This file is imported in many pxd files, 2 | # and we avoid cimporting imgui here in order 3 | # to enable external code to link to us using 4 | # the pxd files and without including imgui. 5 | 6 | from .c_types cimport float2, double2, Vec2, Vec4 7 | 8 | cdef enum child_type: 9 | cat_drawing 10 | cat_handler 11 | cat_menubar 12 | cat_plot_element 13 | cat_tab 14 | cat_tag 15 | cat_theme 16 | cat_viewport_drawlist 17 | cat_widget 18 | cat_window 19 | 20 | cpdef enum class HandlerListOP: 21 | ALL, 22 | ANY, 23 | NONE 24 | 25 | cpdef enum class MouseButton: 26 | LEFT = 0, 27 | RIGHT = 1, 28 | MIDDLE = 2, 29 | X1 = 3, 30 | X2 = 4 31 | 32 | cpdef enum class MouseButtonMask: 33 | NOBUTTON = 0, 34 | LEFT = 1, 35 | RIGHT = 2, 36 | LEFTRIGHT = 3, 37 | MIDDLE = 4, 38 | LEFTMIDDLE = 5, 39 | MIDDLERIGHT = 6, 40 | ANY = 7 41 | # X1 = 8 42 | # X2 = 16, 43 | # ANY = 31 44 | 45 | 46 | cpdef enum class MouseCursor: 47 | CursorNone = -1, 48 | CursorArrow = 0, 49 | CursorTextInput, # When hovering over InputText, etc. 50 | ResizeAll, # (Unused by Dear ImGui functions) 51 | ResizeNS, # When hovering over a horizontal border 52 | ResizeEW, # When hovering over a vertical border or a column 53 | ResizeNESW, # When hovering over the bottom-left corner of a window 54 | ResizeNWSE, # When hovering over the bottom-right corner of a window 55 | Hand, # (Unused by Dear ImGui functions. Use for e.g. hyperlinks) 56 | NotAllowed 57 | 58 | """Class to describe the positioning policy of an item""" 59 | cpdef enum class Positioning: 60 | DEFAULT, # Cursor position 61 | REL_DEFAULT, # Shift relative to the cursor position 62 | REL_PARENT, # Shift relative to the parent position 63 | REL_WINDOW, # Shift relative to the window position 64 | REL_VIEWPORT # Shift relative to the viewport position 65 | 66 | """Class to describe the sizing policy of an item""" 67 | cpdef enum class Sizing: 68 | SCALED, # fixed, but scaled by the global scale factor 69 | ABSOLUTE, # fixed, not affected by the global scale factor 70 | RELATIVE, # Delta relative to the parent size 71 | PERCENTAGE, # Percentage of the parent size 72 | AUTO # Automatically calculated 73 | 74 | cpdef enum class Alignment: 75 | LEFT=0, 76 | TOP=0, 77 | RIGHT=1, 78 | BOTTOM=1, 79 | CENTER=2, 80 | JUSTIFIED=3, 81 | MANUAL=4 82 | 83 | cdef enum theme_types: 84 | t_color, 85 | t_style 86 | 87 | cdef enum theme_backends: 88 | t_imgui, 89 | t_implot, 90 | t_imnodes 91 | 92 | cpdef enum class ThemeEnablers: 93 | ANY, 94 | FALSE, 95 | TRUE, 96 | DISCARDED 97 | 98 | cpdef enum class ThemeCategories: 99 | t_any, 100 | t_simpleplot, 101 | t_button, 102 | t_combo, 103 | t_checkbox, 104 | t_slider, 105 | t_listbox, 106 | t_radiobutton, 107 | t_inputtext, 108 | t_inputvalue, 109 | t_text, 110 | t_selectable, 111 | t_tab, 112 | t_tabbar, 113 | t_tabbutton, 114 | t_menuitem, 115 | t_progressbar, 116 | t_image, 117 | t_imagebutton, 118 | t_menubar, 119 | t_menu, 120 | t_tooltip, 121 | t_layout, 122 | t_treenode, 123 | t_collapsingheader, 124 | t_child, 125 | t_colorbutton, 126 | t_coloredit, 127 | t_colorpicker, 128 | t_window, 129 | t_plot 130 | 131 | cdef enum theme_value_float2_mask: 132 | t_full, 133 | t_left, 134 | t_right 135 | 136 | cdef enum theme_value_types: 137 | t_int, 138 | t_float, 139 | t_float2, 140 | t_u32 141 | 142 | ctypedef union theme_value: 143 | int value_int 144 | float value_float 145 | float[2] value_float2 146 | unsigned value_u32 147 | 148 | ctypedef struct theme_action: 149 | ThemeEnablers activation_condition_enabled 150 | ThemeCategories activation_condition_category 151 | theme_types type 152 | theme_backends backend 153 | int theme_index 154 | theme_value_types value_type 155 | theme_value value 156 | theme_value_float2_mask float2_mask 157 | 158 | ctypedef fused point_type: 159 | int 160 | float 161 | double 162 | 163 | 164 | cdef class Coord: 165 | cdef double _x 166 | cdef double _y 167 | @staticmethod 168 | cdef Coord build(double[2] &coord) 169 | @staticmethod 170 | cdef Coord build_v(Vec2 &coord) 171 | 172 | cdef class Rect: 173 | cdef double _x1 174 | cdef double _y1 175 | cdef double _x2 176 | cdef double _y2 177 | @staticmethod 178 | cdef Rect build(double[4] &rect) 179 | 180 | cdef inline void read_point(point_type* dst, src): 181 | if not(hasattr(src, '__len__')): 182 | raise TypeError("Point data must be an array of up to 2 coordinates") 183 | cdef int src_size = len(src) 184 | if src_size > 2: 185 | raise TypeError("Point data must be an array of up to 2 coordinates") 186 | dst[0] = 0. 187 | dst[1] = 0. 188 | if src_size > 0: 189 | dst[0] = src[0] 190 | if src_size > 1: 191 | dst[1] = src[1] 192 | 193 | cdef inline void read_coord(double* dst, src): 194 | if isinstance(src, Coord): 195 | dst[0] = (src)._x 196 | dst[1] = (src)._y 197 | else: 198 | read_point[double](dst, src) 199 | 200 | cdef inline void read_rect(double* dst, src): 201 | if isinstance(src, Rect): 202 | dst[0] = (src)._x1 203 | dst[1] = (src)._y1 204 | dst[2] = (src)._x2 205 | dst[3] = (src)._y2 206 | return 207 | try: 208 | if isinstance(src, tuple) and len(src) == 2 and \ 209 | hasattr(src[0], "__len__") and hasattr(src[1], "__len__"): 210 | read_coord(dst, src[0]) 211 | read_coord(dst + 2, src[1]) 212 | else: 213 | read_vec4[double](dst, src) 214 | except TypeError: 215 | raise TypeError("Rect data must be a tuple of two points or an array of up to 4 coordinates") 216 | 217 | cdef inline void read_vec4(point_type* dst, src): 218 | if not(hasattr(src, '__len__')): 219 | raise TypeError("Point data must be an array of up to 4 coordinates") 220 | cdef int src_size = len(src) 221 | if src_size > 4: 222 | raise TypeError("Point data must be an array of up to 4 coordinates") 223 | dst[0] = 0. 224 | dst[1] = 0. 225 | dst[2] = 0. 226 | dst[3] = 0. 227 | if src_size > 0: 228 | dst[0] = src[0] 229 | if src_size > 1: 230 | dst[1] = src[1] 231 | if src_size > 2: 232 | dst[2] = src[2] 233 | if src_size > 3: 234 | dst[3] = src[3] 235 | 236 | -------------------------------------------------------------------------------- /dearcygui/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .draw import * 2 | from .handler import * 3 | from .layout import * 4 | from .widget import * 5 | from .window import * -------------------------------------------------------------------------------- /dearcygui/utils/handler.py: -------------------------------------------------------------------------------- 1 | import dearcygui as dcg 2 | 3 | class AnyKeyPressHandler(dcg.HandlerList): 4 | """ 5 | Helper to test all keys in one handler. 6 | Obviously it would be better for performance 7 | to only test the target keys. Do not attach 8 | this to every item. 9 | """ 10 | def __init__(self, context, **kwargs): 11 | self._callback = None 12 | self._repeat = False 13 | super().__init__(context, **kwargs) 14 | with self: 15 | for key in dcg.Key: 16 | dcg.KeyPressHandler(context, 17 | key=dcg.Key(key), 18 | repeat=self._repeat, 19 | callback=self._callback) 20 | 21 | @property 22 | def callback(self): 23 | return self._callback 24 | 25 | @callback.setter 26 | def callback(self, value): 27 | self._callback = value 28 | for c in self.children: 29 | c.callback = value 30 | 31 | @property 32 | def repeat(self): 33 | return self._repeat 34 | 35 | @repeat.setter 36 | def repeat(self, value): 37 | self._repeat = value 38 | for c in self.children: 39 | c.repeat = value 40 | 41 | class AnyKeyReleaseHandler(dcg.HandlerList): 42 | """ 43 | Helper to test all keys in one handler. 44 | Obviously it would be better for performance 45 | to only test the target keys. Do not attach 46 | this to every item. 47 | """ 48 | def __init__(self, context, **kwargs): 49 | self._callback = None 50 | super().__init__(context, **kwargs) 51 | with self: 52 | for key in dcg.Key: 53 | dcg.KeyPressHandler(context, 54 | key=dcg.Key(key), 55 | callback=self._callback) 56 | 57 | @property 58 | def callback(self): 59 | return self._callback 60 | 61 | @callback.setter 62 | def callback(self, value): 63 | self._callback = value 64 | for c in self.children: 65 | c.callback = value 66 | 67 | class AnyKeyDownHandler(dcg.HandlerList): 68 | """ 69 | Helper to test all keys in one handler. 70 | Obviously it would be better for performance 71 | to only test the target keys. Do not attach 72 | this to every item. 73 | """ 74 | def __init__(self, context, **kwargs): 75 | self._callback = None 76 | super().__init__(context, **kwargs) 77 | with self: 78 | for key in dcg.Key: 79 | dcg.KeyPressHandler(context, 80 | key=dcg.Key(key), 81 | callback=self._callback) 82 | 83 | @property 84 | def callback(self): 85 | return self._callback 86 | 87 | @callback.setter 88 | def callback(self, value): 89 | self._callback = value 90 | for c in self.children: 91 | c.callback = value 92 | -------------------------------------------------------------------------------- /dearcygui/utils/layout.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/dearcygui/utils/layout.py -------------------------------------------------------------------------------- /dearcygui/utils/widget.py: -------------------------------------------------------------------------------- 1 | import dearcygui as dcg 2 | 3 | class TemporaryTooltip(dcg.Tooltip): 4 | """ 5 | A tooltip that deletes itself when its 6 | showing condition is not met anymore. 7 | 8 | The handler passed as argument 9 | should be a new handler instance that will 10 | be checked for the condition. It should hold 11 | True as long as the item should be shown. 12 | """ 13 | def __init__(self, 14 | context : dcg.Context, 15 | **kwargs): 16 | super().__init__(context, **kwargs) 17 | not_rendered = dcg.OtherItemHandler(context, target=self, op=dcg.HandlerListOP.NONE, callback=self.destroy_tooltip) 18 | with not_rendered: 19 | dcg.RenderHandler(context) 20 | self.viewport_handler = not_rendered 21 | # += is not atomic. The mutex is to be thread safe, in case 22 | # another thread manipulates the handlers 23 | with context.viewport.mutex: 24 | context.viewport.handlers += [self.viewport_handler] 25 | 26 | def cleanup_handlers(self): 27 | # Remove the handlers we attached 28 | with self.context.viewport.mutex: 29 | self.context.viewport.handlers = [ 30 | h for h in self.context.viewport.handlers\ 31 | if h is not self.viewport_handler 32 | ] 33 | 34 | def destroy_tooltip(self): 35 | if self.context is None: 36 | return # Already deleted 37 | self.cleanup_handlers() 38 | # self.parent = None would work too but would wait GC. 39 | self.delete_item() -------------------------------------------------------------------------------- /dearcygui/widget.pxd: -------------------------------------------------------------------------------- 1 | from .core cimport baseItem, uiItem, drawingItem, itemState, \ 2 | baseHandler, Texture, SharedValue 3 | from .c_types cimport Vec2, Vec4 4 | 5 | from libcpp.string cimport string 6 | from libcpp.vector cimport vector 7 | 8 | cimport numpy as cnp 9 | 10 | cdef class DrawInvisibleButton(drawingItem): 11 | cdef itemState state 12 | cdef int _button # imgui.ImGuiButtonFlags 13 | cdef float _min_side 14 | cdef float _max_side 15 | cdef bint _no_input 16 | cdef bint _capture_mouse 17 | cdef double[2] _p1 18 | cdef double[2] _p2 19 | cdef Vec2 _initial_mouse_position 20 | 21 | cdef class DrawInWindow(uiItem): 22 | cdef bint draw_item(self) noexcept nogil 23 | 24 | cdef class SimplePlot(uiItem): 25 | cdef string _overlay 26 | cdef float _scale_min 27 | cdef float _scale_max 28 | cdef bint _histogram 29 | cdef bint _autoscale 30 | cdef int _last_frame_autoscale_update 31 | cdef bint draw_item(self) noexcept nogil 32 | 33 | 34 | cdef class Button(uiItem): 35 | cdef int _direction # imgui.ImGuiDir 36 | cdef bint _small 37 | cdef bint _arrow 38 | cdef bint _repeat 39 | cdef bint draw_item(self) noexcept nogil 40 | 41 | 42 | cdef class Combo(uiItem): 43 | cdef int _flags # imgui.ImGuiComboFlags 44 | cdef vector[string] _items 45 | cdef string _disabled_value 46 | cdef bint draw_item(self) noexcept nogil 47 | 48 | 49 | cdef class Checkbox(uiItem): 50 | cdef bint draw_item(self) noexcept nogil 51 | 52 | 53 | cdef class Slider(uiItem): 54 | cdef int _size 55 | cdef int _format 56 | cdef bint _drag 57 | cdef float _drag_speed 58 | cdef double _min 59 | cdef double _max 60 | cdef string _print_format 61 | cdef bint _vertical 62 | cdef int _flags # imgui.ImGuiSliderFlags 63 | cdef bint draw_item(self) noexcept nogil 64 | 65 | 66 | cdef class ListBox(uiItem): 67 | cdef vector[string] _items 68 | cdef int _num_items_shown_when_open 69 | cdef bint draw_item(self) noexcept nogil 70 | 71 | 72 | cdef class RadioButton(uiItem): 73 | cdef vector[string] _items 74 | cdef bint _horizontal 75 | cdef bint draw_item(self) noexcept nogil 76 | 77 | 78 | cdef class InputText(uiItem): 79 | cdef string _hint 80 | cdef bint _multiline 81 | cdef int _max_characters 82 | cdef char* _buffer 83 | cdef int _last_frame_update 84 | cdef int _flags # imgui.ImGuiInputTextFlags 85 | cdef bint draw_item(self) noexcept nogil 86 | 87 | 88 | cdef class InputValue(uiItem): 89 | cdef int _size 90 | cdef int _format 91 | cdef double _step 92 | cdef double _step_fast 93 | cdef double _min 94 | cdef double _max 95 | cdef string _print_format 96 | cdef int _flags # imgui.ImGuiInputTextFlags 97 | cdef bint draw_item(self) noexcept nogil 98 | 99 | 100 | cdef class Text(uiItem): 101 | cdef unsigned int _color # imgui.ImU32 102 | cdef int _wrap 103 | cdef bint _bullet 104 | cdef bint _show_label 105 | cdef bint draw_item(self) noexcept nogil 106 | 107 | cdef class TextValue(uiItem): 108 | cdef string _print_format 109 | cdef int _type 110 | cdef bint draw_item(self) noexcept nogil 111 | 112 | cdef class Selectable(uiItem): 113 | cdef int _flags # imgui.ImGuiSelectableFlags 114 | cdef bint draw_item(self) noexcept nogil 115 | 116 | cdef class MenuItem(uiItem): 117 | cdef string _shortcut 118 | cdef bint _check 119 | cdef bint draw_item(self) noexcept nogil 120 | 121 | 122 | cdef class ProgressBar(uiItem): 123 | cdef string _overlay 124 | cdef bint draw_item(self) noexcept nogil 125 | 126 | 127 | cdef class Image(uiItem): 128 | cdef float[4] _uv 129 | cdef unsigned int _color_multiplier # imgui.ImU32 130 | cdef unsigned int _border_color # imgui.ImU32 131 | cdef Texture _texture 132 | cdef bint draw_item(self) noexcept nogil 133 | 134 | 135 | cdef class ImageButton(uiItem): 136 | cdef float[4] _uv 137 | cdef unsigned int _color_multiplier # imgui.ImU32 138 | cdef unsigned int _background_color # imgui.ImU32 139 | cdef Texture _texture 140 | cdef int _frame_padding 141 | cdef bint draw_item(self) noexcept nogil 142 | 143 | cdef class Separator(uiItem): 144 | cdef bint draw_item(self) noexcept nogil 145 | 146 | cdef class Spacer(uiItem): 147 | cdef bint draw_item(self) noexcept nogil 148 | 149 | cdef class MenuBar(uiItem): 150 | cdef void draw(self) noexcept nogil 151 | 152 | cdef class Menu(uiItem): 153 | cdef bint draw_item(self) noexcept nogil 154 | 155 | cdef class Tooltip(uiItem): 156 | cdef float _delay 157 | cdef bint _hide_on_activity 158 | cdef bint _only_if_previous_item_hovered 159 | cdef bint _only_if_ 160 | cdef baseItem _target 161 | cdef baseHandler _secondary_handler 162 | cdef bint draw_item(self) noexcept nogil 163 | 164 | cdef class TabButton(uiItem): 165 | cdef int _flags # imgui.ImGuiTabBarFlags 166 | cdef bint draw_item(self) noexcept nogil 167 | 168 | cdef class Tab(uiItem): 169 | cdef bint _closable 170 | cdef int _flags # imgui.ImGuiTabItemFlags 171 | 172 | cdef class TabBar(uiItem): 173 | cdef int _flags # imgui.ImGuiTabBarFlags 174 | 175 | cdef class TreeNode(uiItem): 176 | cdef int _flags # imgui.ImGuiTreeNodeFlags 177 | cdef bint _selectable 178 | cdef bint draw_item(self) noexcept nogil 179 | 180 | cdef class CollapsingHeader(uiItem): 181 | cdef int _flags # imgui.ImGuiTreeNodeFlags 182 | cdef bint _closable 183 | cdef bint draw_item(self) noexcept nogil 184 | 185 | cdef class ChildWindow(uiItem): 186 | cdef int _window_flags # imgui.ImGuiWindowFlags 187 | cdef int _child_flags # imgui.ImGuiChildFlags 188 | cdef bint draw_item(self) noexcept nogil 189 | 190 | cdef class ColorButton(uiItem): 191 | cdef int _flags # imgui.ImGuiColorEditFlags 192 | cdef bint draw_item(self) noexcept nogil 193 | 194 | cdef class ColorEdit(uiItem): 195 | cdef int _flags # imgui.ImGuiColorEditFlags 196 | cdef bint draw_item(self) noexcept nogil 197 | 198 | cdef class ColorPicker(uiItem): 199 | cdef int _flags # imgui.ImGuiColorEditFlags 200 | cdef bint draw_item(self) noexcept nogil 201 | 202 | cdef class SharedBool(SharedValue): 203 | cdef bint _value 204 | # Internal functions. 205 | # python uses get_value and set_value 206 | cdef bint get(self) noexcept nogil 207 | cdef void set(self, bint) noexcept nogil 208 | 209 | cdef class SharedFloat(SharedValue): 210 | cdef float _value 211 | cdef float get(self) noexcept nogil 212 | cdef void set(self, float) noexcept nogil 213 | 214 | cdef class SharedInt(SharedValue): 215 | cdef int _value 216 | cdef int get(self) noexcept nogil 217 | cdef void set(self, int) noexcept nogil 218 | 219 | cdef class SharedColor(SharedValue): 220 | cdef unsigned int _value # imgui.ImU32 221 | cdef Vec4 _value_asfloat4 # imgui.ImVec4 222 | cdef unsigned int getU32(self) noexcept nogil # imgui.ImU32 223 | cdef Vec4 getF4(self) noexcept nogil # imgui.ImVec4 224 | cdef void setU32(self, unsigned int) noexcept nogil # imgui.ImU32 225 | cdef void setF4(self, Vec4) noexcept nogil # imgui.ImVec4 226 | 227 | cdef class SharedDouble(SharedValue): 228 | cdef double _value 229 | cdef double get(self) noexcept nogil 230 | cdef void set(self, double) noexcept nogil 231 | 232 | cdef class SharedStr(SharedValue): 233 | cdef string _value 234 | cdef void get(self, string&) noexcept nogil 235 | cdef void set(self, string) noexcept nogil 236 | 237 | cdef class SharedFloat4(SharedValue): 238 | cdef float[4] _value 239 | cdef void get(self, float *) noexcept nogil# cython does support float[4] as return value 240 | cdef void set(self, float[4]) noexcept nogil 241 | 242 | cdef class SharedInt4(SharedValue): 243 | cdef int[4] _value 244 | cdef void get(self, int *) noexcept nogil 245 | cdef void set(self, int[4]) noexcept nogil 246 | 247 | cdef class SharedDouble4(SharedValue): 248 | cdef double[4] _value 249 | cdef void get(self, double *) noexcept nogil 250 | cdef void set(self, double[4]) noexcept nogil 251 | 252 | cdef class SharedFloatVect(SharedValue): 253 | cdef cnp.ndarray _value_np 254 | cdef float[:] _value 255 | cdef float[:] get(self) noexcept nogil 256 | cdef void set(self, float[:]) noexcept nogil 257 | """ 258 | cdef class SharedDoubleVect: 259 | cdef double[:] _value 260 | cdef double[:] get(self) noexcept nogil 261 | cdef void set(self, double[:]) noexcept nogil 262 | 263 | 264 | cdef class SharedTime: 265 | cdef tm _value 266 | cdef tm get(self) noexcept nogil 267 | cdef void set(self, tm) noexcept nogil 268 | """ 269 | 270 | cdef class TableColumnConfig(baseItem): 271 | cdef itemState state 272 | cdef int _flags # ImGuiTableColumnFlags_ 273 | cdef bint _stretch 274 | cdef bint _fixed 275 | cdef float _width 276 | cdef float _stretch_weight 277 | cdef bint _dpi_scaling 278 | cdef int _bg_color # imgui.U32 -------------------------------------------------------------------------------- /dearcygui/wrapper/__init__.pxd: -------------------------------------------------------------------------------- 1 | from dearcygui.wrapper cimport imgui 2 | from dearcygui.wrapper cimport implot 3 | from dearcygui.wrapper cimport imnodes -------------------------------------------------------------------------------- /dearcygui/wrapper/imnodes.pxd: -------------------------------------------------------------------------------- 1 | # generated with pxdgen thirdparty/imnodes/imnodes.h -x c++ -f defines -f importall -w ImNodes -I thirdparty/imgui/ 2 | 3 | from dearcygui.wrapper.imgui cimport ImGuiContext, ImVec2 4 | 5 | cdef extern from "imnodes.h" nogil: 6 | struct ImNodesContext: 7 | pass 8 | struct ImGuiContext: 9 | pass 10 | struct ImNodesEditorContext: 11 | pass 12 | struct ImRect: 13 | pass 14 | const int IMNODES_NAMESPACE 15 | ctypedef int ImNodesCol 16 | ctypedef int ImNodesStyleVar 17 | ctypedef int ImNodesStyleFlags 18 | ctypedef int ImNodesPinShape 19 | ctypedef int ImNodesAttributeFlags 20 | ctypedef int ImNodesMiniMapLocation 21 | enum ImNodesCol_: 22 | ImNodesCol_NodeBackground = 0 23 | ImNodesCol_NodeBackgroundHovered = 1 24 | ImNodesCol_NodeBackgroundSelected = 2 25 | ImNodesCol_NodeOutline = 3 26 | ImNodesCol_TitleBar = 4 27 | ImNodesCol_TitleBarHovered = 5 28 | ImNodesCol_TitleBarSelected = 6 29 | ImNodesCol_Link = 7 30 | ImNodesCol_LinkHovered = 8 31 | ImNodesCol_LinkSelected = 9 32 | ImNodesCol_Pin = 10 33 | ImNodesCol_PinHovered = 11 34 | ImNodesCol_BoxSelector = 12 35 | ImNodesCol_BoxSelectorOutline = 13 36 | ImNodesCol_GridBackground = 14 37 | ImNodesCol_GridLine = 15 38 | ImNodesCol_GridLinePrimary = 16 39 | ImNodesCol_MiniMapBackground = 17 40 | ImNodesCol_MiniMapBackgroundHovered = 18 41 | ImNodesCol_MiniMapOutline = 19 42 | ImNodesCol_MiniMapOutlineHovered = 20 43 | ImNodesCol_MiniMapNodeBackground = 21 44 | ImNodesCol_MiniMapNodeBackgroundHovered = 22 45 | ImNodesCol_MiniMapNodeBackgroundSelected = 23 46 | ImNodesCol_MiniMapNodeOutline = 24 47 | ImNodesCol_MiniMapLink = 25 48 | ImNodesCol_MiniMapLinkSelected = 26 49 | ImNodesCol_MiniMapCanvas = 27 50 | ImNodesCol_MiniMapCanvasOutline = 28 51 | ImNodesCol_COUNT = 29 52 | enum ImNodesStyleVar_: 53 | ImNodesStyleVar_GridSpacing = 0 54 | ImNodesStyleVar_NodeCornerRounding = 1 55 | ImNodesStyleVar_NodePadding = 2 56 | ImNodesStyleVar_NodeBorderThickness = 3 57 | ImNodesStyleVar_LinkThickness = 4 58 | ImNodesStyleVar_LinkLineSegmentsPerLength = 5 59 | ImNodesStyleVar_LinkHoverDistance = 6 60 | ImNodesStyleVar_PinCircleRadius = 7 61 | ImNodesStyleVar_PinQuadSideLength = 8 62 | ImNodesStyleVar_PinTriangleSideLength = 9 63 | ImNodesStyleVar_PinLineThickness = 10 64 | ImNodesStyleVar_PinHoverRadius = 11 65 | ImNodesStyleVar_PinOffset = 12 66 | ImNodesStyleVar_MiniMapPadding = 13 67 | ImNodesStyleVar_MiniMapOffset = 14 68 | ImNodesStyleVar_COUNT = 15 69 | enum ImNodesStyleFlags_: 70 | ImNodesStyleFlags_None = 0 71 | ImNodesStyleFlags_NodeOutline = 1 72 | ImNodesStyleFlags_GridLines = 4 73 | ImNodesStyleFlags_GridLinesPrimary = 8 74 | ImNodesStyleFlags_GridSnapping = 16 75 | enum ImNodesPinShape_: 76 | ImNodesPinShape_Circle = 0 77 | ImNodesPinShape_CircleFilled = 1 78 | ImNodesPinShape_Triangle = 2 79 | ImNodesPinShape_TriangleFilled = 3 80 | ImNodesPinShape_Quad = 4 81 | ImNodesPinShape_QuadFilled = 5 82 | enum ImNodesAttributeFlags_: 83 | ImNodesAttributeFlags_None = 0 84 | ImNodesAttributeFlags_EnableLinkDetachWithDragClick = 1 85 | ImNodesAttributeFlags_EnableLinkCreationOnSnap = 2 86 | cppclass ImNodesIO: 87 | cppclass EmulateThreeButtonMouse: 88 | EmulateThreeButtonMouse() 89 | const bint* Modifier 90 | EmulateThreeButtonMouse EmulateThreeButtonMouse 91 | cppclass LinkDetachWithModifierClick: 92 | LinkDetachWithModifierClick() 93 | const bint* Modifier 94 | LinkDetachWithModifierClick LinkDetachWithModifierClick 95 | cppclass MultipleSelectModifier: 96 | MultipleSelectModifier() 97 | const bint* Modifier 98 | MultipleSelectModifier MultipleSelectModifier 99 | int AltMouseButton 100 | float AutoPanningSpeed 101 | ImNodesIO() 102 | cppclass ImNodesStyle: 103 | float GridSpacing 104 | float NodeCornerRounding 105 | ImVec2 NodePadding 106 | float NodeBorderThickness 107 | float LinkThickness 108 | float LinkLineSegmentsPerLength 109 | float LinkHoverDistance 110 | float PinCircleRadius 111 | float PinQuadSideLength 112 | float PinTriangleSideLength 113 | float PinLineThickness 114 | float PinHoverRadius 115 | float PinOffset 116 | ImVec2 MiniMapPadding 117 | ImVec2 MiniMapOffset 118 | ImNodesStyleFlags Flags 119 | unsigned int Colors[29] 120 | ImNodesStyle() 121 | enum ImNodesMiniMapLocation_: 122 | ImNodesMiniMapLocation_BottomLeft = 0 123 | ImNodesMiniMapLocation_BottomRight = 1 124 | ImNodesMiniMapLocation_TopLeft = 2 125 | ImNodesMiniMapLocation_TopRight = 3 126 | ctypedef void (*ImNodesMiniMapNodeHoveringCallback)(int, void*) 127 | ctypedef void* ImNodesMiniMapNodeHoveringCallbackUserData 128 | 129 | 130 | cdef extern from "imnodes.h" namespace "ImNodes" nogil: 131 | struct ImNodesContext: 132 | pass 133 | struct ImNodesEditorContext: 134 | pass 135 | struct ImRect: 136 | pass 137 | void SetImGuiContext(ImGuiContext*) 138 | ImNodesContext* CreateContext() 139 | void DestroyContext() 140 | void DestroyContext(ImNodesContext*) 141 | ImNodesContext* GetCurrentContext() 142 | void SetCurrentContext(ImNodesContext*) 143 | ImNodesEditorContext* EditorContextCreate() 144 | void EditorContextFree(ImNodesEditorContext*) 145 | void EditorContextSet(ImNodesEditorContext*) 146 | ImRect mvEditorGetSize() 147 | ImVec2 EditorContextGetPanning() 148 | void EditorContextResetPanning(ImVec2&) 149 | void EditorContextMoveToNode(const int) 150 | ImNodesIO& GetIO() 151 | ImNodesStyle& GetStyle() 152 | void StyleColorsDark() 153 | void StyleColorsDark(ImNodesStyle*) 154 | void StyleColorsClassic() 155 | void StyleColorsClassic(ImNodesStyle*) 156 | void StyleColorsLight() 157 | void StyleColorsLight(ImNodesStyle*) 158 | void BeginNodeEditor() 159 | void EndNodeEditor() 160 | void MiniMap(const float) 161 | void MiniMap(const float, ImNodesMiniMapLocation) 162 | void MiniMap(const float, ImNodesMiniMapLocation, ImNodesMiniMapNodeHoveringCallback) 163 | void MiniMap(const float, ImNodesMiniMapLocation, ImNodesMiniMapNodeHoveringCallback, ImNodesMiniMapNodeHoveringCallbackUserData) 164 | void PushColorStyle(ImNodesCol, unsigned int) 165 | void PopColorStyle() 166 | void PushStyleVar(ImNodesStyleVar, float) 167 | void PushStyleVar(ImNodesStyleVar, ImVec2&) 168 | void PopStyleVar(int) 169 | void BeginNode(int) 170 | void EndNode() 171 | ImVec2 GetNodeDimensions(int) 172 | void BeginNodeTitleBar() 173 | void EndNodeTitleBar() 174 | void BeginInputAttribute(int) 175 | void BeginInputAttribute(int, ImNodesPinShape) 176 | void EndInputAttribute() 177 | void BeginOutputAttribute(int) 178 | void BeginOutputAttribute(int, ImNodesPinShape) 179 | void EndOutputAttribute() 180 | void BeginStaticAttribute(int) 181 | void EndStaticAttribute() 182 | void PushAttributeFlag(ImNodesAttributeFlags) 183 | void PopAttributeFlag() 184 | void Link(int, int, int) 185 | void SetNodeDraggable(int, const bint) 186 | void SetNodeScreenSpacePos(int, ImVec2&) 187 | void SetNodeEditorSpacePos(int, ImVec2&) 188 | void SetNodeGridSpacePos(int, ImVec2&) 189 | ImVec2 GetNodeScreenSpacePos(const int) 190 | ImVec2 GetNodeEditorSpacePos(const int) 191 | ImVec2 GetNodeGridSpacePos(const int) 192 | void SnapNodeToGrid(int) 193 | bint IsEditorHovered() 194 | bint IsNodeHovered(int*) 195 | bint IsLinkHovered(int*) 196 | bint IsPinHovered(int*) 197 | int NumSelectedNodes() 198 | int NumSelectedLinks() 199 | void GetSelectedNodes(int*) 200 | void GetSelectedLinks(int*) 201 | void ClearNodeSelection() 202 | void ClearLinkSelection() 203 | void SelectNode(int) 204 | void ClearNodeSelection(int) 205 | bint IsNodeSelected(int) 206 | void SelectLink(int) 207 | void ClearLinkSelection(int) 208 | bint IsLinkSelected(int) 209 | bint IsAttributeActive() 210 | bint IsAnyAttributeActive() 211 | bint IsAnyAttributeActive(int*) 212 | bint IsLinkStarted(int*) 213 | bint IsLinkDropped() 214 | bint IsLinkDropped(int*) 215 | bint IsLinkDropped(int*, bint) 216 | bint IsLinkCreated(int*, int*) 217 | bint IsLinkCreated(int*, int*, bint*) 218 | bint IsLinkCreated(int*, int*, int*, int*) 219 | bint IsLinkCreated(int*, int*, int*, int*, bint*) 220 | bint IsLinkDestroyed(int*) 221 | const char* SaveCurrentEditorStateToIniString() 222 | const char* SaveCurrentEditorStateToIniString(size_t*) 223 | const char* SaveEditorStateToIniString(ImNodesEditorContext*) 224 | const char* SaveEditorStateToIniString(ImNodesEditorContext*, size_t*) 225 | void LoadCurrentEditorStateFromIniString(const char*, size_t) 226 | void LoadEditorStateFromIniString(ImNodesEditorContext*, const char*, size_t) 227 | void SaveCurrentEditorStateToIniFile(const char*) 228 | void SaveEditorStateToIniFile(ImNodesEditorContext*, const char*) 229 | void LoadCurrentEditorStateFromIniFile(const char*) 230 | void LoadEditorStateFromIniFile(ImNodesEditorContext*, const char*) 231 | 232 | 233 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "Cython>=0.30", 4 | "freetype-py", 5 | "numpy", 6 | "wheel", 7 | "click", 8 | "setuptools", 9 | ] 10 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages, Distribution 2 | from setuptools.command import build_py 3 | from setuptools.extension import Extension 4 | from Cython.Build import cythonize 5 | import distutils.cmd 6 | from codecs import open 7 | import os 8 | from os import path 9 | import sys 10 | from glob import glob 11 | import numpy as np 12 | import shutil 13 | import subprocess 14 | 15 | wip_version = "0.0.3" 16 | 17 | def version_number(): 18 | return wip_version 19 | 20 | def get_platform(): 21 | 22 | platforms = { 23 | 'linux' : 'Linux', 24 | 'linux1' : 'Linux', 25 | 'linux2' : 'Linux', 26 | 'darwin' : 'OS X', 27 | } 28 | if "win" in sys.platform: 29 | return "Windows" 30 | if sys.platform not in platforms: 31 | return sys.platform 32 | 33 | return platforms[sys.platform] 34 | 35 | def build_SDL3(): 36 | src_path = os.path.dirname(os.path.abspath(__file__)) 37 | cmake_config_args = [ 38 | '-DCMAKE_BUILD_TYPE=Release', 39 | '-DSDL_SHARED=OFF', 40 | '-DSDL_STATIC=ON', 41 | '-DSDL_EXAMPLES=OFF', 42 | '-DSDL_TESTS=OFF', 43 | '-DSDL_TEST_LIBRARY=OFF', 44 | '-DSDL_DISABLE_INSTALL=ON', 45 | '-DSDL_DISABLE_INSTALL_DOCS=OON', 46 | '-DCMAKE_POSITION_INDEPENDENT_CODE=ON' 47 | ] 48 | command = 'cmake -S thirdparty/SDL/ -B build_SDL ' + ' '.join(cmake_config_args) 49 | subprocess.check_call(command, shell=True) 50 | command = 'cmake --build build_SDL --config Release' 51 | subprocess.check_call(command, shell=True) 52 | if get_platform() == "Windows": 53 | return os.path.abspath(os.path.join("build_SDL", "Release/SDL3-static.lib")) 54 | return os.path.abspath(os.path.join("build_SDL", "libSDL3.a")) 55 | 56 | def build_FREETYPE(): 57 | src_path = os.path.dirname(os.path.abspath(__file__)) 58 | cmake_config_args = [ 59 | '-DCMAKE_BUILD_TYPE=Release', 60 | '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', 61 | '-D FT_DISABLE_ZLIB=TRUE', 62 | '-D FT_DISABLE_BZIP2=TRUE', 63 | '-D FT_DISABLE_PNG=TRUE', 64 | '-D FT_DISABLE_HARFBUZZ=TRUE', 65 | '-D FT_DISABLE_BROTLI=TRUE' 66 | ] 67 | command = 'cmake -S thirdparty/freetype/ -B build_FT ' + ' '.join(cmake_config_args) 68 | subprocess.check_call(command, shell=True) 69 | command = 'cmake --build build_FT --config Release' 70 | subprocess.check_call(command, shell=True) 71 | if get_platform() == "Windows": 72 | return os.path.abspath(os.path.join("build_FT", "Release/freetype.lib")) 73 | return os.path.abspath(os.path.join("build_FT", "libfreetype.a")) 74 | 75 | def setup_package(): 76 | 77 | src_path = os.path.dirname(os.path.abspath(__file__)) 78 | old_path = os.getcwd() 79 | os.chdir(src_path) 80 | sys.path.insert(0, src_path) 81 | 82 | # Build dependencies 83 | sdl3_lib = build_SDL3() 84 | FT_lib = build_FREETYPE() 85 | 86 | # import readme content 87 | with open("./README.md", encoding='utf-8') as f: 88 | long_description = f.read() 89 | 90 | include_dirs = ["dearcygui", 91 | "dearcygui/backends", 92 | "thirdparty/imgui", 93 | "thirdparty/imgui/backends", 94 | "thirdparty/imnodes", 95 | "thirdparty/implot", 96 | "thirdparty/gl3w", 97 | "thirdparty/freetype/include", 98 | "thirdparty/SDL/include"] 99 | include_dirs += [np.get_include()] 100 | 101 | cpp_sources = [ 102 | "dearcygui/backends/sdl3_gl3_backend.cpp", 103 | "thirdparty/imnodes/imnodes.cpp", 104 | "thirdparty/implot/implot.cpp", 105 | "thirdparty/implot/implot_items.cpp", 106 | "thirdparty/implot/implot_demo.cpp", 107 | "thirdparty/imgui/misc/cpp/imgui_stdlib.cpp", 108 | "thirdparty/imgui/imgui.cpp", 109 | "thirdparty/imgui/imgui_demo.cpp", 110 | "thirdparty/imgui/imgui_draw.cpp", 111 | "thirdparty/imgui/imgui_widgets.cpp", 112 | "thirdparty/imgui/imgui_tables.cpp", 113 | "dearcygui/backends/imgui_impl_sdl3.cpp", 114 | "thirdparty/imgui/backends/imgui_impl_opengl3.cpp", 115 | "thirdparty/imgui/misc/freetype/imgui_freetype.cpp", 116 | "thirdparty/gl3w/GL/gl3w.c" 117 | ] 118 | 119 | compile_args = ["-D_CRT_SECURE_NO_WARNINGS", 120 | "-D_USE_MATH_DEFINES", 121 | "-DIMGUI_IMPL_OPENGL_LOADER_SDL3", 122 | "-DIMGUI_USER_CONFIG=\"imgui_config.h\""] 123 | linking_args = ['-O3'] 124 | 125 | if get_platform() == "Linux": 126 | compile_args += ["-DNDEBUG", "-fwrapv", "-O3", "-DUNIX", "-DLINUX", "-g1"] 127 | libraries = ["crypt", "pthread", "dl", "util", "m", "GL"] 128 | elif get_platform() == "OS X": 129 | compile_args += ["-fobjc-arc", "-fno-common", "-dynamic", "-DNDEBUG",\ 130 | "-fwrapv" ,"-O3", "-DAPPLE"] 131 | libraries = ["Cocoa", "IOKit", "CoreFoundation", "CoreVideo", "OpenGL"] 132 | linking_args += ["-framework", "Cocoa", "-framework", "IOKit", "-framework", "CoreFoundation", "-framework", "CoreVideo", "-framework", "OpenGL"] 133 | elif get_platform() == "Windows": 134 | compile_args += ["/O2", "/DNDEBUG", "/D_WINDOWS", "/D_UNICODE", "/DWIN32_LEAN_AND_MEAN"] 135 | libraries = ["user32", "gdi32", "shell32", "advapi32", "ole32", "oleaut32", "uuid", "opengl32", \ 136 | "setupapi", "cfgmgr32", "version", "winmm"] 137 | linking_args += ["/MACHINE:X64"] 138 | else: 139 | # Please test and tell us what changes are needed to the build 140 | raise ValueError("Unsupported platform") 141 | cython_sources = [ 142 | "dearcygui/core.pyx", 143 | "dearcygui/constants.pyx", 144 | "dearcygui/draw.pyx", 145 | "dearcygui/font.pyx", 146 | "dearcygui/handler.pyx", 147 | "dearcygui/imgui.pyx", 148 | "dearcygui/imgui_types.pyx", 149 | "dearcygui/layout.pyx", 150 | "dearcygui/os.pyx", 151 | "dearcygui/plot.pyx", 152 | "dearcygui/theme.pyx", 153 | "dearcygui/types.pyx", 154 | "dearcygui/widget.pyx", 155 | ] 156 | 157 | # We compile in a single extension because we want 158 | # to link to the same static libraries 159 | 160 | extensions = [ 161 | Extension( 162 | "dearcygui.dearcygui", 163 | ["dearcygui/dearcygui.pyx"] + cython_sources + cpp_sources, 164 | language="c++", 165 | include_dirs=include_dirs, 166 | extra_compile_args=compile_args, 167 | libraries=libraries, 168 | extra_link_args=linking_args, 169 | extra_objects=[sdl3_lib, FT_lib] 170 | ) 171 | ] 172 | 173 | shutil.copy("thirdparty/latin-modern-roman/lmsans17-regular.otf", "dearcygui/") 174 | shutil.copy("thirdparty/latin-modern-roman/lmromanslant17-regular.otf", "dearcygui/") 175 | shutil.copy("thirdparty/latin-modern-roman/lmsans10-bold.otf", "dearcygui/") 176 | shutil.copy("thirdparty/latin-modern-roman/lmromandemi10-oblique.otf", "dearcygui/") 177 | 178 | 179 | metadata = dict( 180 | name='dearcygui', # Required 181 | version=version_number(), # Required 182 | author="Axel Davy", # Optional 183 | description='DearCyGui: A simple and customizable Python GUI Toolkit coded in Cython', # Required 184 | long_description=long_description, # Optional 185 | long_description_content_type='text/markdown', # Optional 186 | url='https://github.com/axeldavy/DearCyGui', # Optional 187 | license = 'MIT', 188 | python_requires='>=3.10', 189 | classifiers=[ 190 | 'Development Status :: 2 - Pre-Alpha', 191 | 'Intended Audience :: Education', 192 | 'Intended Audience :: Developers', 193 | 'Intended Audience :: Science/Research', 194 | 'License :: OSI Approved :: MIT License', 195 | 'Operating System :: MacOS', 196 | 'Operating System :: Microsoft :: Windows :: Windows 10', 197 | 'Operating System :: POSIX', 198 | 'Operating System :: Unix', 199 | 'Programming Language :: Cython', 200 | 'Programming Language :: Python :: 3', 201 | 'Topic :: Software Development :: User Interfaces', 202 | 'Topic :: Software Development :: Libraries :: Python Modules', 203 | ], 204 | packages=['dearcygui', 'dearcygui.docs', 'dearcygui.utils', 'dearcygui.backends', 'dearcygui.wrapper'], 205 | install_requires=[ 206 | 'numpy', 207 | 'freetype-py', 208 | 'scipy' 209 | ], 210 | ext_modules = cythonize(extensions, compiler_directives={'language_level' : "3"}, nthreads=4) 211 | ) 212 | metadata["package_data"] = {} 213 | metadata["package_data"]['dearcygui'] = ['*.pxd', '*.py', '*.pyi', '*ttf', '*otf', '*typed'] 214 | metadata["package_data"]['dearcygui.docs'] = ['*.py', '*.md'] 215 | metadata["package_data"]['dearcygui.utils'] = ['*.pxd', '*.py', '*.pyi', '*ttf', '*otf', '*typed'] 216 | metadata["package_data"]['dearcygui.backends'] = ['*.pxd', '*.py', '*.pyi', '*ttf', '*otf', '*typed'] 217 | metadata["package_data"]['dearcygui.wrapper'] = ['*.pxd', '*.py', '*.pyi', '*ttf', '*otf', '*typed'] 218 | 219 | if "--force" in sys.argv: 220 | sys.argv.remove('--force') 221 | 222 | try: 223 | setup(**metadata) 224 | finally: 225 | del sys.path[0] 226 | os.chdir(old_path) 227 | return 228 | 229 | 230 | if __name__ == '__main__': 231 | setup_package() 232 | -------------------------------------------------------------------------------- /stubs/custom.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from enum import IntEnum 3 | from typing import Protocol, Sequence 4 | from .types import * 5 | 6 | Sender = TypeVar('Sender', baseHandler, uiItem, covariant=True) 7 | Target = TypeVar('Target', baseItem, covariant=True) 8 | 9 | class DCGCallable0(Protocol): 10 | def __call__(self, /) -> Any: 11 | ... 12 | 13 | class DCGCallable1(Protocol): 14 | def __call__(self, 15 | sender : Sender, 16 | /) -> Any: 17 | ... 18 | 19 | class DCGCallable2(Protocol): 20 | def __call__(self, 21 | sender : Sender, 22 | target : Target, 23 | /) -> Any: 24 | ... 25 | 26 | class DCGCallable3(Protocol): 27 | def __call__(self, 28 | sender : Sender, 29 | target : Target, 30 | value : Any, 31 | /) -> Any: 32 | ... 33 | 34 | class DCGCallable0Kw(Protocol): 35 | def __call__(self, /, **kwargs) -> Any: 36 | ... 37 | 38 | class DCGCallable1Kw(Protocol): 39 | def __call__(self, 40 | sender : Sender, 41 | /, 42 | **kwargs : Any) -> Any: 43 | ... 44 | 45 | class DCGCallable2Kw(Protocol): 46 | def __call__(self, 47 | sender : Sender, 48 | target : Target, 49 | /, 50 | **kwargs : Any) -> Any: 51 | ... 52 | 53 | class DCGCallable3Kw(Protocol): 54 | def __call__(self, 55 | sender : Sender, 56 | target : Target, 57 | value : Any, 58 | /, 59 | **kwargs : Any) -> Any: 60 | ... 61 | 62 | 63 | DCGCallable = DCGCallable0 | DCGCallable1 | DCGCallable2 | DCGCallable3 | DCGCallable0Kw | DCGCallable1Kw | DCGCallable2Kw | DCGCallable3Kw 64 | 65 | Color = int | tuple[int, int, int] | tuple[int, int, int, int] | tuple[float, float, float] | tuple[float, float, float, float] | Sequence[int] | Sequence[float] 66 | 67 | 68 | class wrap_mutex: 69 | def __init__(self, target) -> None: 70 | ... 71 | 72 | def __enter__(self): # -> None: 73 | ... 74 | 75 | def __exit__(self, exc_type, exc_value, traceback): # -> Literal[False]: 76 | ... 77 | 78 | 79 | 80 | class wrap_this_and_parents_mutex: 81 | def __init__(self, target) -> None: 82 | ... 83 | 84 | def __enter__(self): # -> None: 85 | ... 86 | 87 | def __exit__(self, exc_type, exc_value, traceback): # -> Literal[False]: 88 | ... 89 | -------------------------------------------------------------------------------- /thirdparty/imnodes/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AccessModifierOffset: -4 3 | AlignAfterOpenBracket: 'AlwaysBreak' 4 | AlignConsecutiveDeclarations: 'true' 5 | AllowAllParametersOfDeclarationOnNextLine: 'false' 6 | AllowShortFunctionsOnASingleLine: 'true' 7 | AlwaysBreakBeforeMultilineStrings: 'true' 8 | AlwaysBreakTemplateDeclarations: 'true' 9 | BinPackArguments: 'false' 10 | BinPackParameters: 'false' 11 | BraceWrapping: { 12 | AfterCaseLabel: 'true' 13 | AfterClass: 'true' 14 | AfterControlStatement: 'true' 15 | AfterEnum: 'true' 16 | AfterFunction: 'true' 17 | AfterNamespace: 'true' 18 | AfterStruct: 'true' 19 | AfterUnion: 'true' 20 | BeforeCatch: 'true' 21 | BeforeElse: 'true' 22 | IndentBraces: 'false' 23 | } 24 | BreakBeforeBraces: Custom 25 | ColumnLimit: 100 26 | Cpp11BracedListStyle: 'true' 27 | DerivePointerAlignment: 'false' 28 | IndentCaseLabels: 'false' 29 | IndentWidth: 4 30 | PenaltyExcessCharacter: 100000000 31 | PenaltyReturnTypeOnItsOwnLine: 100000000 32 | PointerAlignment: Left 33 | PointerBindsToType: 'true' 34 | SortIncludes: 'false' 35 | SpaceAfterTemplateKeyword: 'false' 36 | SpaceBeforeParens: ControlStatements 37 | TabWidth: 8 38 | UseTab: Never 39 | ... 40 | -------------------------------------------------------------------------------- /thirdparty/imnodes/.clang-tidy: -------------------------------------------------------------------------------- 1 | # Apply this style by doing 2 | # 3 | # clang-tidy -fix-errors -config= 4 | # 5 | # Running the command without -fix-errors will generate warnings about each 6 | # style violation but won't change them. 7 | 8 | Checks: '-*,readability-identifier-naming' 9 | CheckOptions: 10 | - key: readability-identifier-naming.ClassCase 11 | value: CamelCase 12 | - key: readability-identifier-naming.EnumCase 13 | value: CamelCase 14 | - key: readability-identifier-naming.FunctionCase 15 | value: CamelCase 16 | - key: readability-identifier-naming.MemberCase 17 | value: CamelCase 18 | - key: readability-identifier-naming.MethodCase 19 | value: CamelCase 20 | - key: readability-identifier-naming.NamespaceCase 21 | value: CamelCase 22 | - key: readability-identifier-naming.ParameterCase 23 | value: lower_case 24 | - key: readability-identifier-naming.PrivateMemberCase 25 | value: CamelCase 26 | - key: readability-identifier-naming.PrivateMemberPrefix 27 | value: '_' 28 | - key: readability-identifier-naming.StaticConstantCase 29 | value: UPPER_CASE 30 | - key: readability-identifier-naming.StructCase 31 | value: CamelCase 32 | - key: readability-identifier-naming.VariableCase 33 | value: lower_case 34 | -------------------------------------------------------------------------------- /thirdparty/imnodes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project(imnodes) 4 | 5 | set(CMAKE_CXX_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD_REQUIRED True) 7 | 8 | find_package(imgui CONFIG REQUIRED) 9 | find_package(SDL2 CONFIG REQUIRED) 10 | 11 | if(MSVC) 12 | add_compile_definitions(SDL_MAIN_HANDLED) 13 | add_compile_options(/W4 /WX) 14 | else() 15 | add_compile_options(-Wall -Wextra -Wpedantic -Werror) 16 | endif() 17 | 18 | # Imnodes 19 | 20 | add_library(imnodes) 21 | target_sources(imnodes PRIVATE 22 | imnodes.h 23 | imnodes_internal.h 24 | imnodes.cpp) 25 | target_include_directories(imnodes PUBLIC ${CMAKE_SOURCE_DIR}) 26 | target_link_libraries(imnodes PUBLIC imgui::imgui) 27 | 28 | # Example projects 29 | 30 | add_executable(colornode 31 | ${CMAKE_SOURCE_DIR}/imnodes.cpp 32 | ${CMAKE_SOURCE_DIR}/example/main.cpp 33 | ${CMAKE_SOURCE_DIR}/example/color_node_editor.cpp) 34 | target_link_libraries(colornode imnodes SDL2::SDL2) 35 | if (APPLE) 36 | target_link_libraries(colornode "-framework OpenGL") 37 | elseif(MSVC) 38 | target_link_libraries(colornode "opengl32") 39 | else() 40 | target_link_libraries(colornode X11 Xext GL) 41 | endif() 42 | 43 | add_executable(multieditor 44 | ${CMAKE_SOURCE_DIR}/imnodes.cpp 45 | ${CMAKE_SOURCE_DIR}/example/main.cpp 46 | ${CMAKE_SOURCE_DIR}/example/multi_editor.cpp) 47 | target_link_libraries(multieditor imnodes SDL2::SDL2) 48 | if (APPLE) 49 | target_link_libraries(multieditor "-framework OpenGL") 50 | elseif(MSVC) 51 | target_link_libraries(multieditor "opengl32") 52 | else() 53 | target_link_libraries(multieditor X11 Xext GL) 54 | endif() 55 | 56 | add_executable(saveload 57 | ${CMAKE_SOURCE_DIR}/imnodes.cpp 58 | ${CMAKE_SOURCE_DIR}/example/main.cpp 59 | ${CMAKE_SOURCE_DIR}/example/save_load.cpp) 60 | target_link_libraries(saveload imnodes SDL2::SDL2) 61 | if (APPLE) 62 | target_link_libraries(saveload "-framework OpenGL") 63 | elseif(MSVC) 64 | target_link_libraries(saveload "opengl32") 65 | else() 66 | target_link_libraries(saveload X11 Xext GL) 67 | endif() 68 | 69 | add_executable(hello 70 | ${CMAKE_SOURCE_DIR}/imnodes.cpp 71 | ${CMAKE_SOURCE_DIR}/example/main.cpp 72 | ${CMAKE_SOURCE_DIR}/example/hello.cpp) 73 | target_link_libraries(hello imnodes SDL2::SDL2) 74 | if (APPLE) 75 | target_link_libraries(hello "-framework OpenGL") 76 | elseif(MSVC) 77 | target_link_libraries(hello "opengl32") 78 | else() 79 | target_link_libraries(hello X11 Xext GL) 80 | endif() 81 | -------------------------------------------------------------------------------- /thirdparty/imnodes/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Johann Muszynski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /thirdparty/imnodes/README.md: -------------------------------------------------------------------------------- 1 |

imnodes

2 | 3 |

A small, dependency-free node editor extension for dear imgui.

4 | 5 |

6 | 7 |

8 | 9 | [![Build Status](https://github.com/nelarius/imnodes/workflows/Build/badge.svg)](https://github.com/nelarius/imnodes/actions?workflow=Build) 10 | 11 | Imnodes aims to provide a simple, immediate-mode interface for creating a node editor within an ImGui window. Imnodes provides simple, customizable building blocks that a user needs to build their node editor. 12 | 13 | Features: 14 | 15 | * Create nodes, links, and pins in an immediate-mode style. The user controls all the state. 16 | * Nest ImGui widgets inside nodes 17 | * Simple distribution, just copy-paste `imnodes.h`, `imnodes_internal.h`, and `imnodes.cpp` into your project along side ImGui. 18 | 19 | ## Examples 20 | 21 | This repository includes a few example files, under `example/`. They are intended as simple examples giving you an idea of what you can build with imnodes. 22 | 23 | If you need to build the examples, you can use the provided CMake script to do so. 24 | 25 | ```bash 26 | # Initialize the vcpkg submodule 27 | $ git submodule update --init 28 | # Run the generation step and build 29 | $ cmake -B build-release/ -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake 30 | $ cmake --build build-release -- -j 31 | ``` 32 | 33 | Note that this has not been tested on Linux and is likely to fail on the platform. 34 | 35 | ## A brief tour 36 | 37 | Here is a small overview of how the extension is used. For more information on example usage, scroll to the bottom of the README. 38 | 39 | Before anything can be done, the library must be initialized. This can be done at the same time as `dear imgui` initialization. 40 | 41 | ```cpp 42 | ImGui::CreateContext(); 43 | ImNodes::CreateContext(); 44 | 45 | // elsewhere in the code... 46 | ImNodes::DestroyContext(); 47 | ImGui::DestroyContext(); 48 | ``` 49 | 50 | The node editor is a workspace which contains nodes. The node editor must be instantiated within a window, like any other UI element. 51 | 52 | ```cpp 53 | ImGui::Begin("node editor"); 54 | 55 | ImNodes::BeginNodeEditor(); 56 | ImNodes::EndNodeEditor(); 57 | 58 | ImGui::End(); 59 | ``` 60 | 61 | Now you should have a workspace with a grid visible in the window. An empty node can now be instantiated: 62 | 63 | ```cpp 64 | const int hardcoded_node_id = 1; 65 | 66 | ImNodes::BeginNodeEditor(); 67 | 68 | ImNodes::BeginNode(hardcoded_node_id); 69 | ImGui::Dummy(ImVec2(80.0f, 45.0f)); 70 | ImNodes::EndNode(); 71 | 72 | ImNodes::EndNodeEditor(); 73 | ``` 74 | 75 | Nodes, like windows in `dear imgui` must be uniquely identified. But we can't use the node titles for identification, because it should be possible to have many nodes of the same name in the workspace. Instead, you just use integers for identification. 76 | 77 | Attributes are the UI content of the node. An attribute will have a pin (the little circle) on either side of the node. There are two types of attributes: input, and output attributes. Input attribute pins are on the left side of the node, and output attribute pins are on the right. Like nodes, pins must be uniquely identified. 78 | 79 | ```cpp 80 | ImNodes::BeginNode(hardcoded_node_id); 81 | 82 | const int output_attr_id = 2; 83 | ImNodes::BeginOutputAttribute(output_attr_id); 84 | // in between Begin|EndAttribute calls, you can call ImGui 85 | // UI functions 86 | ImGui::Text("output pin"); 87 | ImNodes::EndOutputAttribute(); 88 | 89 | ImNodes::EndNode(); 90 | ``` 91 | 92 | The extension doesn't really care what is in the attribute. It just renders the pin for the attribute, and allows the user to create links between pins. 93 | 94 | A title bar can be added to the node using `BeginNodeTitleBar` and `EndNodeTitleBar`. Like attributes, you place your title bar's content between the function calls. Note that these functions have to be called before adding attributes or other `dear imgui` UI elements to the node, since the node's layout is built in order, top-to-bottom. 95 | 96 | ```cpp 97 | ImNodes::BeginNode(hardcoded_node_id); 98 | 99 | ImNodes::BeginNodeTitleBar(); 100 | ImGui::TextUnformatted("output node"); 101 | ImNodes::EndNodeTitleBar(); 102 | 103 | // pins and other node UI content omitted... 104 | 105 | ImNodes::EndNode(); 106 | ``` 107 | 108 | The user has to render their own links between nodes as well. A link is a curve which connects two attributes. A link is just a pair of attribute ids. And like nodes and attributes, links too have to be identified by unique integer values: 109 | 110 | ```cpp 111 | std::vector> links; 112 | // elsewhere in the code... 113 | for (int i = 0; i < links.size(); ++i) 114 | { 115 | const std::pair p = links[i]; 116 | // in this case, we just use the array index of the link 117 | // as the unique identifier 118 | ImNodes::Link(i, p.first, p.second); 119 | } 120 | ``` 121 | 122 | After `EndNodeEditor` has been called, you can check if a link was created during the frame with the function call `IsLinkCreated`: 123 | 124 | ```cpp 125 | int start_attr, end_attr; 126 | if (ImNodes::IsLinkCreated(&start_attr, &end_attr)) 127 | { 128 | links.push_back(std::make_pair(start_attr, end_attr)); 129 | } 130 | ``` 131 | 132 | In addition to checking for new links, you can also check whether UI elements are being hovered over by the mouse cursor: 133 | 134 | ```cpp 135 | int node_id; 136 | if (ImNodes::IsNodeHovered(&node_id)) 137 | { 138 | node_hovered = node_id; 139 | } 140 | ``` 141 | 142 | You can also check to see if any node has been selected. Nodes can be clicked on, or they can be selected by clicking and dragging the box selector over them. 143 | 144 | ```cpp 145 | // Note that since many nodes can be selected at once, we first need to query the number of 146 | // selected nodes before getting them. 147 | const int num_selected_nodes = ImNodes::NumSelectedNodes(); 148 | if (num_selected_nodes > 0) 149 | { 150 | std::vector selected_nodes; 151 | selected_nodes.resize(num_selected_nodes); 152 | ImNodes::GetSelectedNodes(selected_nodes.data()); 153 | } 154 | ``` 155 | 156 | See `imnodes.h` for more UI event-related functions. 157 | 158 | Like `dear imgui`, the style of the UI can be changed. You can set the color style of individual nodes, pins, and links mid-frame by calling `ImNodes::PushColorStyle` and `ImNodes::PopColorStyle`. 159 | 160 | ```cpp 161 | // set the titlebar color of an individual node 162 | ImNodes::PushColorStyle( 163 | ImNodesCol_TitleBar, IM_COL32(11, 109, 191, 255)); 164 | ImNodes::PushColorStyle( 165 | ImNodesCol_TitleBarSelected, IM_COL32(81, 148, 204, 255)); 166 | 167 | ImNodes::BeginNode(hardcoded_node_id); 168 | // node internals here... 169 | ImNodes::EndNode(); 170 | 171 | ImNodes::PopColorStyle(); 172 | ImNodes::PopColorStyle(); 173 | ``` 174 | 175 | If the style is not being set mid-frame, `ImNodes::GetStyle` can be called instead, and the values can be set into the style array directly. 176 | 177 | ```cpp 178 | // set the titlebar color for all nodes 179 | ImNodesStyle& style = ImNodes::GetStyle(); 180 | style.colors[ImNodesCol_TitleBar] = IM_COL32(232, 27, 86, 255); 181 | style.colors[ImNodesCol_TitleBarSelected] = IM_COL32(241, 108, 146, 255); 182 | ``` 183 | 184 | To handle quicker navigation of large graphs you can use an interactive mini-map overlay. The mini-map can be zoomed and scrolled. Editor nodes will track the panning of the mini-map accordingly. 185 | 186 | ```cpp 187 | ImGui::Begin("node editor"); 188 | 189 | ImNodes::BeginNodeEditor(); 190 | 191 | // add nodes... 192 | 193 | // must be called right before EndNodeEditor 194 | ImNodes::MiniMap(); 195 | ImNodes::EndNodeEditor(); 196 | 197 | ImGui::End(); 198 | ``` 199 | 200 | The relative sizing and corner location of the mini-map in the editor space can be specified like so: 201 | 202 | ```cpp 203 | // MiniMap is a square region with a side length that is 20% the largest editor canvas dimension 204 | // See ImNodesMiniMapLocation_ for other corner locations 205 | ImNodes::MiniMap(0.2f, ImNodesMiniMapLocation_TopRight); 206 | ``` 207 | 208 | The mini-map also supports limited node hovering customization through a user-defined callback. 209 | ```cpp 210 | // User callback 211 | void mini_map_node_hovering_callback(int node_id, void* user_data) 212 | { 213 | ImGui::SetTooltip("This is node %d", node_id); 214 | } 215 | 216 | // Later on... 217 | ImNodes::MiniMap(0.2f, ImNodesMiniMapLocation_TopRight, mini_map_node_hovering_callback, custom_user_data); 218 | 219 | // 'custom_user_data' can be used to supply extra information needed for drawing within the callback 220 | ``` 221 | 222 | ## Customizing ImNodes 223 | 224 | ImNodes can be customized by providing an `imnodes_config.h` header and specifying defining `IMNODES_USER_CONFIG=imnodes_config.h` when compiling. 225 | 226 | It is currently possible to override the type of the minimap hovering callback function. This is useful when generating bindings for another language. 227 | 228 | Here's an example imnodes_config.h, which generates a pybind wrapper for the callback. 229 | ```cpp 230 | #pragma once 231 | 232 | #include 233 | 234 | namespace pybind11 { 235 | 236 | inline bool PyWrapper_Check(PyObject *o) { return true; } 237 | 238 | class wrapper : public object { 239 | public: 240 | PYBIND11_OBJECT_DEFAULT(wrapper, object, PyWrapper_Check) 241 | wrapper(void* x) { m_ptr = (PyObject*)x; } 242 | explicit operator bool() const { return m_ptr != nullptr && m_ptr != Py_None; } 243 | }; 244 | 245 | } //namespace pybind11 246 | 247 | namespace py = pybind11; 248 | 249 | #define ImNodesMiniMapNodeHoveringCallback py::wrapper 250 | 251 | #define ImNodesMiniMapNodeHoveringCallbackUserData py::wrapper 252 | ``` 253 | 254 | ## Known issues 255 | 256 | * `ImGui::Separator()` spans the current window span. As a result, using a separator inside a node will result in the separator spilling out of the node into the node editor grid. 257 | 258 | ## Further information 259 | 260 | See the `examples/` directory to see library usage in greater detail. 261 | 262 | * simple.cpp is a simple hello-world style program which displays two nodes 263 | * save_load.cpp is enables you to add and remove nodes and links, and serializes/deserializes them, so that the program state is retained between restarting the program 264 | * color_node_editor.cpp is a more complete example, which shows how a simple node editor is implemented with a graph. 265 | -------------------------------------------------------------------------------- /thirdparty/imnodes/example/hello.cpp: -------------------------------------------------------------------------------- 1 | #include "node_editor.h" 2 | #include 3 | #include 4 | 5 | namespace example 6 | { 7 | namespace 8 | { 9 | class HelloWorldNodeEditor 10 | { 11 | public: 12 | void show() 13 | { 14 | ImGui::Begin("simple node editor"); 15 | 16 | ImNodes::BeginNodeEditor(); 17 | ImNodes::BeginNode(1); 18 | 19 | ImNodes::BeginNodeTitleBar(); 20 | ImGui::TextUnformatted("simple node :)"); 21 | ImNodes::EndNodeTitleBar(); 22 | 23 | ImNodes::BeginInputAttribute(2); 24 | ImGui::Text("input"); 25 | ImNodes::EndInputAttribute(); 26 | 27 | ImNodes::BeginOutputAttribute(3); 28 | ImGui::Indent(40); 29 | ImGui::Text("output"); 30 | ImNodes::EndOutputAttribute(); 31 | 32 | ImNodes::EndNode(); 33 | ImNodes::EndNodeEditor(); 34 | 35 | ImGui::End(); 36 | } 37 | }; 38 | 39 | static HelloWorldNodeEditor editor; 40 | } // namespace 41 | 42 | void NodeEditorInitialize() { ImNodes::SetNodeGridSpacePos(1, ImVec2(200.0f, 200.0f)); } 43 | 44 | void NodeEditorShow() { editor.show(); } 45 | 46 | void NodeEditorShutdown() {} 47 | 48 | } // namespace example 49 | -------------------------------------------------------------------------------- /thirdparty/imnodes/example/main.cpp: -------------------------------------------------------------------------------- 1 | #include "node_editor.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #if defined(IMGUI_IMPL_OPENGL_ES2) 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | #include 15 | 16 | int main(int, char**) 17 | { 18 | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) 19 | { 20 | printf("Error: %s\n", SDL_GetError()); 21 | return -1; 22 | } 23 | 24 | // Decide GL+GLSL versions 25 | #if defined(IMGUI_IMPL_OPENGL_ES2) 26 | // GL ES 2.0 + GLSL 100 27 | const char* glsl_version = "#version 100"; 28 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); 29 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); 30 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); 31 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); 32 | #elif defined(__APPLE__) 33 | // GL 3.2 Core + GLSL 150 34 | const char* glsl_version = "#version 150"; 35 | SDL_GL_SetAttribute( 36 | SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac 37 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 38 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); 39 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); 40 | #else 41 | // GL 3.0 + GLSL 130 42 | const char* glsl_version = "#version 130"; 43 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); 44 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 45 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); 46 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); 47 | #endif 48 | 49 | // Create window with graphics context 50 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 51 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); 52 | SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); 53 | SDL_WindowFlags window_flags = 54 | (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); 55 | SDL_Window* window = SDL_CreateWindow( 56 | "Dear ImGui SDL2+OpenGL3 example", 57 | SDL_WINDOWPOS_CENTERED, 58 | SDL_WINDOWPOS_CENTERED, 59 | 1280, 60 | 720, 61 | window_flags); 62 | SDL_GLContext gl_context = SDL_GL_CreateContext(window); 63 | SDL_GL_MakeCurrent(window, gl_context); 64 | SDL_GL_SetSwapInterval(1); // Enable vsync 65 | 66 | // Setup Dear ImGui context 67 | IMGUI_CHECKVERSION(); 68 | ImGui::CreateContext(); 69 | ImGuiIO& io = ImGui::GetIO(); 70 | (void)io; 71 | 72 | ImNodes::CreateContext(); 73 | example::NodeEditorInitialize(); 74 | 75 | // Setup Dear ImGui style 76 | ImGui::StyleColorsDark(); 77 | // ImGui::StyleColorsClassic(); 78 | ImNodes::StyleColorsDark(); 79 | 80 | // Setup Platform/Renderer backends 81 | ImGui_ImplSDL2_InitForOpenGL(window, gl_context); 82 | ImGui_ImplOpenGL3_Init(glsl_version); 83 | 84 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 85 | 86 | // Main loop 87 | bool done = false; 88 | while (!done) 89 | { 90 | SDL_Event event; 91 | while (SDL_PollEvent(&event)) 92 | { 93 | ImGui_ImplSDL2_ProcessEvent(&event); 94 | if (event.type == SDL_QUIT) 95 | done = true; 96 | if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && 97 | event.window.windowID == SDL_GetWindowID(window)) 98 | done = true; 99 | } 100 | 101 | // Start the Dear ImGui frame 102 | ImGui_ImplOpenGL3_NewFrame(); 103 | ImGui_ImplSDL2_NewFrame(); 104 | ImGui::NewFrame(); 105 | 106 | example::NodeEditorShow(); 107 | 108 | // Rendering 109 | ImGui::Render(); 110 | glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); 111 | glClearColor( 112 | clear_color.x * clear_color.w, 113 | clear_color.y * clear_color.w, 114 | clear_color.z * clear_color.w, 115 | clear_color.w); 116 | glClear(GL_COLOR_BUFFER_BIT); 117 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 118 | SDL_GL_SwapWindow(window); 119 | } 120 | 121 | // Cleanup 122 | ImGui_ImplOpenGL3_Shutdown(); 123 | ImGui_ImplSDL2_Shutdown(); 124 | example::NodeEditorShutdown(); 125 | ImNodes::DestroyContext(); 126 | ImGui::DestroyContext(); 127 | 128 | SDL_GL_DeleteContext(gl_context); 129 | SDL_DestroyWindow(window); 130 | SDL_Quit(); 131 | 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /thirdparty/imnodes/example/multi_editor.cpp: -------------------------------------------------------------------------------- 1 | #include "node_editor.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace example 10 | { 11 | namespace 12 | { 13 | struct Node 14 | { 15 | int id; 16 | float value; 17 | 18 | Node(const int i, const float v) : id(i), value(v) {} 19 | }; 20 | 21 | struct Link 22 | { 23 | int id; 24 | int start_attr, end_attr; 25 | }; 26 | 27 | struct Editor 28 | { 29 | ImNodesEditorContext* context = nullptr; 30 | std::vector nodes; 31 | std::vector links; 32 | int current_id = 0; 33 | }; 34 | 35 | void show_editor(const char* editor_name, Editor& editor) 36 | { 37 | ImNodes::EditorContextSet(editor.context); 38 | 39 | ImGui::Begin(editor_name); 40 | ImGui::TextUnformatted("A -- add node"); 41 | 42 | ImNodes::BeginNodeEditor(); 43 | 44 | if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && 45 | ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(SDL_SCANCODE_A)) 46 | { 47 | const int node_id = ++editor.current_id; 48 | ImNodes::SetNodeScreenSpacePos(node_id, ImGui::GetMousePos()); 49 | ImNodes::SnapNodeToGrid(node_id); 50 | editor.nodes.push_back(Node(node_id, 0.f)); 51 | } 52 | 53 | for (Node& node : editor.nodes) 54 | { 55 | ImNodes::BeginNode(node.id); 56 | 57 | ImNodes::BeginNodeTitleBar(); 58 | ImGui::TextUnformatted("node"); 59 | ImNodes::EndNodeTitleBar(); 60 | 61 | ImNodes::BeginInputAttribute(node.id << 8); 62 | ImGui::TextUnformatted("input"); 63 | ImNodes::EndInputAttribute(); 64 | 65 | ImNodes::BeginStaticAttribute(node.id << 16); 66 | ImGui::PushItemWidth(120.0f); 67 | ImGui::DragFloat("value", &node.value, 0.01f); 68 | ImGui::PopItemWidth(); 69 | ImNodes::EndStaticAttribute(); 70 | 71 | ImNodes::BeginOutputAttribute(node.id << 24); 72 | const float text_width = ImGui::CalcTextSize("output").x; 73 | ImGui::Indent(120.f + ImGui::CalcTextSize("value").x - text_width); 74 | ImGui::TextUnformatted("output"); 75 | ImNodes::EndOutputAttribute(); 76 | 77 | ImNodes::EndNode(); 78 | } 79 | 80 | for (const Link& link : editor.links) 81 | { 82 | ImNodes::Link(link.id, link.start_attr, link.end_attr); 83 | } 84 | 85 | ImNodes::EndNodeEditor(); 86 | 87 | { 88 | Link link; 89 | if (ImNodes::IsLinkCreated(&link.start_attr, &link.end_attr)) 90 | { 91 | link.id = ++editor.current_id; 92 | editor.links.push_back(link); 93 | } 94 | } 95 | 96 | { 97 | int link_id; 98 | if (ImNodes::IsLinkDestroyed(&link_id)) 99 | { 100 | auto iter = std::find_if( 101 | editor.links.begin(), editor.links.end(), [link_id](const Link& link) -> bool { 102 | return link.id == link_id; 103 | }); 104 | assert(iter != editor.links.end()); 105 | editor.links.erase(iter); 106 | } 107 | } 108 | 109 | ImGui::End(); 110 | } 111 | 112 | Editor editor1; 113 | Editor editor2; 114 | } // namespace 115 | 116 | void NodeEditorInitialize() 117 | { 118 | editor1.context = ImNodes::EditorContextCreate(); 119 | editor2.context = ImNodes::EditorContextCreate(); 120 | ImNodes::PushAttributeFlag(ImNodesAttributeFlags_EnableLinkDetachWithDragClick); 121 | 122 | ImNodesIO& io = ImNodes::GetIO(); 123 | io.LinkDetachWithModifierClick.Modifier = &ImGui::GetIO().KeyCtrl; 124 | io.MultipleSelectModifier.Modifier = &ImGui::GetIO().KeyCtrl; 125 | 126 | ImNodesStyle& style = ImNodes::GetStyle(); 127 | style.Flags |= ImNodesStyleFlags_GridLinesPrimary | ImNodesStyleFlags_GridSnapping; 128 | } 129 | 130 | void NodeEditorShow() 131 | { 132 | show_editor("editor1", editor1); 133 | show_editor("editor2", editor2); 134 | } 135 | 136 | void NodeEditorShutdown() 137 | { 138 | ImNodes::PopAttributeFlag(); 139 | ImNodes::EditorContextFree(editor1.context); 140 | ImNodes::EditorContextFree(editor2.context); 141 | } 142 | } // namespace example 143 | -------------------------------------------------------------------------------- /thirdparty/imnodes/example/node_editor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace example 4 | { 5 | void NodeEditorInitialize(); 6 | void NodeEditorShow(); 7 | void NodeEditorShutdown(); 8 | } // namespace example -------------------------------------------------------------------------------- /thirdparty/imnodes/example/save_load.cpp: -------------------------------------------------------------------------------- 1 | #include "node_editor.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include // for std::streamsize 11 | #include 12 | #include 13 | 14 | namespace example 15 | { 16 | namespace 17 | { 18 | struct Node 19 | { 20 | int id; 21 | float value; 22 | 23 | Node() = default; 24 | 25 | Node(const int i, const float v) : id(i), value(v) {} 26 | }; 27 | 28 | struct Link 29 | { 30 | int id; 31 | int start_attr, end_attr; 32 | }; 33 | 34 | class SaveLoadEditor 35 | { 36 | public: 37 | SaveLoadEditor() : nodes_(), links_(), current_id_(0) {} 38 | 39 | void show() 40 | { 41 | ImGui::Begin("Save & load example"); 42 | ImGui::TextUnformatted("A -- add node"); 43 | ImGui::TextUnformatted( 44 | "Close the executable and rerun it -- your nodes should be exactly " 45 | "where you left them!"); 46 | 47 | ImNodes::BeginNodeEditor(); 48 | 49 | if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && 50 | ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(SDL_SCANCODE_A)) 51 | { 52 | const int node_id = ++current_id_; 53 | ImNodes::SetNodeScreenSpacePos(node_id, ImGui::GetMousePos()); 54 | nodes_.push_back(Node(node_id, 0.f)); 55 | } 56 | 57 | for (Node& node : nodes_) 58 | { 59 | ImNodes::BeginNode(node.id); 60 | 61 | ImNodes::BeginNodeTitleBar(); 62 | ImGui::TextUnformatted("node"); 63 | ImNodes::EndNodeTitleBar(); 64 | 65 | ImNodes::BeginInputAttribute(node.id << 8); 66 | ImGui::TextUnformatted("input"); 67 | ImNodes::EndInputAttribute(); 68 | 69 | ImNodes::BeginStaticAttribute(node.id << 16); 70 | ImGui::PushItemWidth(120.f); 71 | ImGui::DragFloat("value", &node.value, 0.01f); 72 | ImGui::PopItemWidth(); 73 | ImNodes::EndStaticAttribute(); 74 | 75 | ImNodes::BeginOutputAttribute(node.id << 24); 76 | const float text_width = ImGui::CalcTextSize("output").x; 77 | ImGui::Indent(120.f + ImGui::CalcTextSize("value").x - text_width); 78 | ImGui::TextUnformatted("output"); 79 | ImNodes::EndOutputAttribute(); 80 | 81 | ImNodes::EndNode(); 82 | } 83 | 84 | for (const Link& link : links_) 85 | { 86 | ImNodes::Link(link.id, link.start_attr, link.end_attr); 87 | } 88 | 89 | ImNodes::EndNodeEditor(); 90 | 91 | { 92 | Link link; 93 | if (ImNodes::IsLinkCreated(&link.start_attr, &link.end_attr)) 94 | { 95 | link.id = ++current_id_; 96 | links_.push_back(link); 97 | } 98 | } 99 | 100 | { 101 | int link_id; 102 | if (ImNodes::IsLinkDestroyed(&link_id)) 103 | { 104 | auto iter = 105 | std::find_if(links_.begin(), links_.end(), [link_id](const Link& link) -> bool { 106 | return link.id == link_id; 107 | }); 108 | assert(iter != links_.end()); 109 | links_.erase(iter); 110 | } 111 | } 112 | 113 | ImGui::End(); 114 | } 115 | 116 | void save() 117 | { 118 | // Save the internal imnodes state 119 | ImNodes::SaveCurrentEditorStateToIniFile("save_load.ini"); 120 | 121 | // Dump our editor state as bytes into a file 122 | 123 | std::fstream fout( 124 | "save_load.bytes", std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); 125 | 126 | // copy the node vector to file 127 | const size_t num_nodes = nodes_.size(); 128 | fout.write( 129 | reinterpret_cast(&num_nodes), 130 | static_cast(sizeof(size_t))); 131 | fout.write( 132 | reinterpret_cast(nodes_.data()), 133 | static_cast(sizeof(Node) * num_nodes)); 134 | 135 | // copy the link vector to file 136 | const size_t num_links = links_.size(); 137 | fout.write( 138 | reinterpret_cast(&num_links), 139 | static_cast(sizeof(size_t))); 140 | fout.write( 141 | reinterpret_cast(links_.data()), 142 | static_cast(sizeof(Link) * num_links)); 143 | 144 | // copy the current_id to file 145 | fout.write( 146 | reinterpret_cast(¤t_id_), static_cast(sizeof(int))); 147 | } 148 | 149 | void load() 150 | { 151 | // Load the internal imnodes state 152 | ImNodes::LoadCurrentEditorStateFromIniFile("save_load.ini"); 153 | 154 | // Load our editor state into memory 155 | 156 | std::fstream fin("save_load.bytes", std::ios_base::in | std::ios_base::binary); 157 | 158 | if (!fin.is_open()) 159 | { 160 | return; 161 | } 162 | 163 | // copy nodes into memory 164 | size_t num_nodes; 165 | fin.read(reinterpret_cast(&num_nodes), static_cast(sizeof(size_t))); 166 | nodes_.resize(num_nodes); 167 | fin.read( 168 | reinterpret_cast(nodes_.data()), 169 | static_cast(sizeof(Node) * num_nodes)); 170 | 171 | // copy links into memory 172 | size_t num_links; 173 | fin.read(reinterpret_cast(&num_links), static_cast(sizeof(size_t))); 174 | links_.resize(num_links); 175 | fin.read( 176 | reinterpret_cast(links_.data()), 177 | static_cast(sizeof(Link) * num_links)); 178 | 179 | // copy current_id into memory 180 | fin.read(reinterpret_cast(¤t_id_), static_cast(sizeof(int))); 181 | } 182 | 183 | private: 184 | std::vector nodes_; 185 | std::vector links_; 186 | int current_id_; 187 | }; 188 | 189 | static SaveLoadEditor editor; 190 | } // namespace 191 | 192 | void NodeEditorInitialize() 193 | { 194 | ImNodes::GetIO().LinkDetachWithModifierClick.Modifier = &ImGui::GetIO().KeyCtrl; 195 | ImNodes::PushAttributeFlag(ImNodesAttributeFlags_EnableLinkDetachWithDragClick); 196 | editor.load(); 197 | } 198 | 199 | void NodeEditorShow() { editor.show(); } 200 | 201 | void NodeEditorShutdown() 202 | { 203 | ImNodes::PopAttributeFlag(); 204 | editor.save(); 205 | } 206 | } // namespace example 207 | -------------------------------------------------------------------------------- /thirdparty/imnodes/img/imnodes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/imnodes/img/imnodes.gif -------------------------------------------------------------------------------- /thirdparty/imnodes/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "imnodes", 3 | "version-string": "0.1.0-dev", 4 | "dependencies": [ 5 | "sdl2", 6 | { 7 | "name": "imgui", 8 | "features": [ "sdl2-binding", "opengl3-binding" ] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/GUST-FONT-LICENSE.TXT: -------------------------------------------------------------------------------- 1 | % This is version 1.0, dated 22 June 2009, of the GUST Font License. 2 | % (GUST is the Polish TeX Users Group, http://www.gust.org.pl) 3 | % 4 | % For the most recent version of this license see 5 | % http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt 6 | % or 7 | % http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt 8 | % 9 | % This work may be distributed and/or modified under the conditions 10 | % of the LaTeX Project Public License, either version 1.3c of this 11 | % license or (at your option) any later version. 12 | % 13 | % Please also observe the following clause: 14 | % 1) it is requested, but not legally required, that derived works be 15 | % distributed only after changing the names of the fonts comprising this 16 | % work and given in an accompanying "manifest", and that the 17 | % files comprising the Work, as listed in the manifest, also be given 18 | % new names. Any exceptions to this request are also given in the 19 | % manifest. 20 | % 21 | % We recommend the manifest be given in a separate file named 22 | % MANIFEST-.txt, where is some unique identification 23 | % of the font family. If a separate "readme" file accompanies the Work, 24 | % we recommend a name of the form README-.txt. 25 | % 26 | % The latest version of the LaTeX Project Public License is in 27 | % http://www.latex-project.org/lppl.txt and version 1.3c or later 28 | % is part of all distributions of LaTeX version 2006/05/20 or later. 29 | -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lm-info.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lm-info.pdf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman10-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman10-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman10-bolditalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman10-bolditalic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman10-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman10-italic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman12-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman12-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman12-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman12-italic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman12-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman12-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman17-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman17-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman5-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman5-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman5-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman5-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman6-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman6-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman6-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman6-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman7-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman7-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman7-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman7-italic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman7-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman7-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman8-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman8-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman8-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman8-italic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman8-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman8-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman9-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman9-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman9-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman9-italic.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmroman9-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmroman9-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromancaps10-oblique.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromancaps10-oblique.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromancaps10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromancaps10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromandemi10-oblique.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromandemi10-oblique.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromandemi10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromandemi10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromandunh10-oblique.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromandunh10-oblique.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromandunh10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromandunh10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant10-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant10-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant12-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant12-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant17-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant17-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant8-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant8-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanslant9-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanslant9-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmromanunsl10-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmromanunsl10-regular.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmsans10-bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmsans10-bold.otf -------------------------------------------------------------------------------- /thirdparty/latin-modern-roman/lmsans17-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axeldavy/DearCyGui/2b295f109e1c4b6b56d5e8f96da28b556fcac18d/thirdparty/latin-modern-roman/lmsans17-regular.otf --------------------------------------------------------------------------------