Panda3D
Loading...
Searching...
No Matches
rocketRegion.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file rocketRegion.h
10 * @author rdb
11 * @date 2011-11-30
12 */
13
14#ifndef ROCKETREGION_H
15#define ROCKETREGION_H
16
17#include "config_rocket.h"
18#include "displayRegion.h"
20#include "rocketInputHandler.h"
21
23
24/**
25 * Represents a region in a window or buffer where the libRocket UI will be
26 * rendered to.
27 */
28class EXPCL_ROCKET RocketRegion : public DisplayRegion {
29protected:
30 RocketRegion(GraphicsOutput *window, const LVecBase4 &dimensions,
31 const std::string &context_name);
32
33 virtual void do_cull(CullHandler *cull_handler, SceneSetup *scene_setup,
34 GraphicsStateGuardian *gsg, Thread *current_thread);
35
36PUBLISHED:
37 virtual ~RocketRegion();
38
39 INLINE static RocketRegion* make(const std::string &context_name,
40 GraphicsOutput *window);
41 INLINE static RocketRegion* make(const std::string &context_name,
42 GraphicsOutput *window,
43 const LVecBase4 &dimensions);
44#ifndef CPPPARSER
45 INLINE Rocket::Core::Context* get_context() const;
46#endif
47#ifdef HAVE_ROCKET_PYTHON
48 EXTENSION(PyObject *get_context() const);
49 MAKE_PROPERTY(context, get_context);
50#endif
51
52 INLINE void set_input_handler(RocketInputHandler *handler);
54 MAKE_PROPERTY(input_handler, get_input_handler, set_input_handler);
55
56 bool init_debugger();
57 void set_debugger_visible(bool visible);
58 bool is_debugger_visible() const;
59 MAKE_PROPERTY(debugger_visible, is_debugger_visible, set_debugger_visible);
60
61private:
62 RocketRenderInterface _interface;
63 Rocket::Core::Context* _context;
64 PT(OrthographicLens) _lens;
65 PT(RocketInputHandler) _input_handler;
66
67public:
68 static TypeHandle get_class_type() {
69 return _type_handle;
70 }
71 static void init_type() {
72 DisplayRegion::init_type();
73 register_type(_type_handle, "RocketRegion",
74 DisplayRegion::get_class_type());
75 }
76 virtual TypeHandle get_type() const {
77 return get_class_type();
78 }
79 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
80
81private:
82 static TypeHandle _type_handle;
83};
84
85#include "rocketRegion.I"
86
87#endif /* ROCKETREGION_H */
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
Definition cullHandler.h:28
Encapsulates all the communication with a particular instance of a given rendering backend.
An orthographic lens.
DataNode that listens for keyboard and mouse events and passes them to libRocket.
Rocket::Core::Context * get_context() const
Returns a pointer to the Rocket context associated with this region.
get_input_handler
Returns the RocketInputHandler object previously passed to set_input_handler.
set_input_handler
Sets the RocketInputHandler object from which to gather the keyboard and mouse inputs to pass to the ...
is_debugger_visible
Returns true if the debugger is visible.
static RocketRegion * make(const std::string &context_name, GraphicsOutput *window)
Creates a libRocket context with the given name (must be unique) for the given window.
bool init_debugger()
Initializes the libRocket debugger.
set_debugger_visible
Sets whether the debugger should be visible.
Class that provides the main render interface for libRocket integration.
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition sceneSetup.h:32
A thread; that is, a lightweight process.
Definition thread.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.