-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the debugger with short-lived contexts #200
Comments
Hi, and thank you for the kind words! The way I use the debugger is having a dedicated context for it, as you suggest. Inputs are first submitted to the debugger (this is always considered to be on top when active), then if they are not captured here they are submitted to the next context and so on. This is handled automatically the way I have structured this so it didn't take any effort to do it this way for me. I don't fully understand how the contexts are layed out in your case and what you mean by aligning things. But generally to position and size windows, use RCSS properties just like for any other element. The document is really just an absolutely positioned element. In any case, I can see how in your situation it might be simpler to change the host context, I'll gladly accept a PR if you submit one. I think we should intentionally make the name of the function a bit more complicated so users don't accidentally use it. Maybe something like Let me know what you think. And also I'd love to see some screenshots when you feel ready to share some, I like to see people's creations, feel free to post them in the gallery :) |
Thank you for your reply! I see, having a dedicated debugger context does seem like the cleanest way to do things. That totally makes sense for input, thank you! Well my cameras can define the part of the screen they render to, currently that means that when queueing rendering commands from the RmlUI context, they will be drawn with a specific viewport for that camera (this can be useful for HUDs in split-screen for instance), and it also means I set the context's dimensions to be that of the pixels available to the camera on the screen. This is fine on its own but I have no idea how that would interact with another context for debugging, if the debugging context is just fullscreen while the debugged context is some specific part of the screen for instance, then probably the outlines it will try to draw will be misaligned right? If so then that means whenever I try to debug a context, I would have to replicate the same offset/dimensions of the debugged context with the debugger context, which shouldn't be difficult but seems pretty messy. Maybe I should just always use fullscreen contexts and deal with screen partitioning inside the context instead? You're right I was assuming that the host context was shut down. Which makes me think maybe it would be even better to make that new method just Believe me I would have submitted screenshots already except I am but a mere engine programmer and all my UI currently consists of colored rectangles with text which is definitely not gallery-worthy x) My graphic designer partner will be working on the UI at some point however and I know she will be able to do really neat things with it :) |
Yeah, I guess this alignment is just one of those things one has to figure out. I think all your proposals sound reasonable so it's just a matter of picking one. Yes, absolutely, Very cool, looking forward to see what your partner comes up with! :) |
Thanks again for your help :) |
Hello!
I am having some trouble integrating the debugger in my engine, and I have a few solutions but I'm unsure which one makes the most sense from the perspective of RmlUi's philosophy.
For starters, in my engine I can have one RmlUi context per camera, which means that at any given moment I could have no context at all, or multiple contexts at once. This does not seem to play well at all with the way the debugger works. The debugger can be initialized with a context, which will become its host context, and then it can either debug its own host context or any other context. However, as soon as the host context for the debugger is released, it seems impossible to make use of the debugger again, since
Rml::Debugger::Initialise
will fail because the plugin already exists, andRml::Debugger::SetContext
will only change the context to be debugged. In any case it ends up crashing when trying to use the debugger.Here are the solutions I found (from more involved on my side to more involved on RmlUi's side):
SetContentBox
I suppose?). That seems fine to me ifSetContentBox
does what I think it does. Is it closer to the RmlUi phisolophy perhaps?Rml::Debugger::Initialise
). This is something I've tested locally and that seems to work. I added a methodRml::Debugger::SetHostContext
that can reinitialise the debugger with a new host context (see here: lut0pia@25d359b). It works fine for my use case, I'm not entirely sure that I'm not missing something but I can definitely jump from context to context without crashing, and input and rendering work like a charm because the debugger coexists nicely with the rest of the documents. If this approach seems good to you, I can create a PR with the new method (or with the modifiedRml::Debugger::Initialise
).I would love to have your input on all of this. Thanks again for this wonderful library :)
The text was updated successfully, but these errors were encountered: