Panda3D
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"
19 #include "rocketRenderInterface.h"
20 #include "rocketInputHandler.h"
21 
22 class OrthographicLens;
23 
24 /**
25  * Represents a region in a window or buffer where the libRocket UI will be
26  * rendered to.
27  */
28 class EXPCL_ROCKET RocketRegion : public DisplayRegion {
29 protected:
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 
36 PUBLISHED:
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);
53  INLINE RocketInputHandler *get_input_handler() const;
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 
61 private:
62  RocketRenderInterface _interface;
63  Rocket::Core::Context* _context;
64  PT(OrthographicLens) _lens;
65  PT(RocketInputHandler) _input_handler;
66 
67 public:
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 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "rocketRegion.I"
86 
87 #endif /* ROCKETREGION_H */
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(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a region in a window or buffer where the libRocket UI will be rendered to.
Definition: rocketRegion.h:28
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
Definition: cullHandler.h:28
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for the various different classes that represent the result of a frame of render...
DataNode that listens for keyboard and mouse events and passes them to libRocket.
An orthographic lens.
A thread; that is, a lightweight process.
Definition: thread.h:46
Encapsulates all the communication with a particular instance of a given rendering backend.
A rectangular subregion within a window for rendering into.
Definition: displayRegion.h:57
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.