19 #if defined(HAVE_ROCKET_DEBUGGER) && !defined(CPPPARSER)
20 #include <Rocket/Debugger.h>
33 RocketRegion(
GraphicsOutput *window,
const LVecBase4 &dr_dimensions,
34 const std::string &context_name) :
39 if (Rocket::Core::GetRenderInterface() ==
nullptr) {
40 Rocket::Core::SetRenderInterface(&_interface);
44 get_pixels(pl, pr, pb, pt);
45 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
48 <<
"Setting initial context dimensions to ("
49 << dimensions.x <<
", " << dimensions.y <<
")\n";
51 _context = Rocket::Core::CreateContext(context_name.c_str(),
52 dimensions, &_interface);
53 nassertv(_context !=
nullptr);
57 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
58 _lens->set_near_far(-1, 1);
69 if (Rocket::Core::GetRenderInterface() == &_interface) {
70 Rocket::Core::SetRenderInterface(
nullptr);
73 if (_context !=
nullptr) {
74 if (_context->GetReferenceCount() > 1) {
75 _context->RemoveReference();
81 #ifdef HAVE_ROCKET_PYTHON
82 PyGILState_STATE gstate;
83 gstate = PyGILState_Ensure();
86 _context->RemoveReference();
88 #ifdef HAVE_ROCKET_PYTHON
89 PyGILState_Release(gstate);
105 #ifdef HAVE_ROCKET_PYTHON
106 PyGILState_STATE gstate;
107 gstate = PyGILState_Ensure();
112 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
114 if (_context->GetDimensions() != dimensions) {
115 rocket_cat.debug() <<
"Setting context dimensions to ("
116 << dimensions.x <<
", " << dimensions.y <<
")\n";
118 _context->SetDimensions(dimensions);
120 _lens->set_film_size(dimensions.x, -dimensions.y);
121 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
124 if (_input_handler !=
nullptr) {
125 _input_handler->update_context(_context, pl, pb);
135 _interface.
render(_context, trav);
137 #ifdef HAVE_ROCKET_PYTHON
138 PyGILState_Release(gstate);
151 #ifdef HAVE_ROCKET_DEBUGGER
152 return Rocket::Debugger::Initialise(_context);
163 #ifdef HAVE_ROCKET_DEBUGGER
164 Rocket::Debugger::SetVisible(visible);
173 #ifdef HAVE_ROCKET_DEBUGGER
174 return Rocket::Debugger::IsVisible();