Comments (9)
Working well for us, thanks!
from cvui.
Thank you! I am glad you like and find it useful.
Regarding your question, yes, at the moment it is not possible to capture clicks and interactions of cvui components in more than one window. However it is possible to use cvui in more than one window at the time (since the rendering is not attached to any window).
My current project also needs the feature you suggested, so I definitely plan to support it in the near future. I already have some ideas for how to implement this with minimal additions to the existing API.
from cvui.
@jmuncaster I've just added support for multiple windows in cvui.
The API is not final and I still need to document this new feature, but the overall idea is to call cvui components of a particular window between cvui::context(WINDOW_NAME)
and cvui::update(WINDOW_NAME)
:
#define WINDOW1 "window1"
#define WINDOW2 "window2"
main() {
// new cvui::init() function allows automatic creation of windows
const cv::String windows[] = { WINDOW1, WINDOW2 };
cvui::init(windows, 2);
cvui::context(WINDOW1);
// render components of WINDOW1 here
cvui::update(WINDOW1);
cvui::context(WINDOW2);
// render components of WINDOW2 here
cvui::update(WINDOW2);
}
That way cvui knows that which components belong to which window. I added two new examples (here and here) showing how to use cvui with multiple windows.
I would appreciate any feedback on the API and if it works for your needs.
from cvui.
Looks good, I'll try it out!
from cvui.
@Dovyski FYI: Tried running both linked examples and getting two errors from the latest dev-branch:
'gMouse': is not a member of 'cvui::internal' cvui.h 1894
'gMouse': undeclared identifier cvui.h 1894
.
On a hunch, I checked a diff and static cv::Point gMouse;
appears to have been removed from the internal namespace which was breaking the examples(for me, at least). Not sure if you have other plans, but I added it back in and examples ran fine.
from cvui.
Thank you for the heads up, @4xle ! The dev build broke because I recently merged a pull request that uses a mouse structured that is being transitioned to a new format (more robust). I will check on it soon.
from cvui.
I've finished the support for multiple windows in cvui. Thanks for all the help! I added three examples covering different use cases of multiple windows, i.e. multiple-windows, multiple-windows-complex, and multiple-windows-complex-mouse.
Since the work is finished, I'm closing this issue. Please feel free to continue posting here if you have anything to add. If you have found a bug, please open a new issue so I can keep track of things more easily.
from cvui.
Hey,
I have a bit of a problem with multiple windows. I have a bunch of buttons. When a button is pressed I need to do some checks, if the check is unsuccessfull an error window should pop up.
Everything works fine for buttons that aren't grouped, but as soon as they're in a beginRow() / endRow() section I get the error:
[CVUI] Fatal error (code 2): Calling update() before finishing all begin*()/end*() calls. Did you forget to call a begin*() or an end*()? Check if every begin*() has an appropriate end*() call before you call update().
I had a quick look and found out that the error occures during the update() call for the error window. I guess a possible solution would be to add a "gStack" and it's "gStackCount" to the context type.
from cvui.
Thank you for the report and all the additional information, @k-toffel! I've have opened a new issue to keep track of this bug. Your suggestion on how to fix the problem seems spot on. I will work on it.
from cvui.
Related Issues (20)
- linux cvui cpu consumption HOT 3
- Move this under "Immediate Mode UI" organization HOT 2
- Button to add theWinName parameter
- Is it possible support the function of text box input? HOT 3
- why both HOT 4
- True Headless Mode HOT 3
- cursor.x and cursor.y not updating in loop
- Issue when having multiple windows and multiple enhanced windows inside them HOT 1
- how to print inside a window HOT 1
- Feature request: add parameter to adjust windows size by mouse drag
- Add not clickable state to the button
- The interactive layer is separated from the visual layer HOT 4
- Is it possible to make a full screen for cvui window? HOT 1
- [Feature request] Radio buttons (mutually exclusive options) HOT 3
- The so stupid project HOT 1
- Bug cvui:image() crash when size of image is larger from canvas HOT 3
- EnhancedWindow draws image outside of window HOT 3
- _CVUI_COMPILE_MESSAGE as unknown-pragmas HOT 1
- Unicode/ASCII issue HOT 4
- Add API to draw bounding boxes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvui.