14#ifndef CALLBACKGRAPHICSWINDOW_H
15#define CALLBACKGRAPHICSWINDOW_H
26class EXPCL_PANDA_DISPLAY CallbackGraphicsWindow :
public GraphicsWindow {
28 CallbackGraphicsWindow(GraphicsEngine *engine,
30 const std::string &name,
37 virtual ~CallbackGraphicsWindow();
39 class EXPCL_PANDA_DISPLAY WindowCallbackData :
public CallbackData {
41 INLINE WindowCallbackData(CallbackGraphicsWindow *window);
44 INLINE CallbackGraphicsWindow *
get_window()
const;
48 PT(CallbackGraphicsWindow) _window;
54 static void init_type() {
55 CallbackData::init_type();
56 register_type(_type_handle,
"CallbackGraphicsWindow::WindowCallbackData",
57 CallbackData::get_class_type());
60 return get_class_type();
62 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
65 static TypeHandle _type_handle;
68 class EXPCL_PANDA_DISPLAY EventsCallbackData :
public WindowCallbackData {
70 INLINE EventsCallbackData(CallbackGraphicsWindow *window);
79 static void init_type() {
80 WindowCallbackData::init_type();
81 register_type(_type_handle,
"CallbackGraphicsWindow::EventsCallbackData",
82 WindowCallbackData::get_class_type());
85 return get_class_type();
87 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
93 class EXPCL_PANDA_DISPLAY PropertiesCallbackData :
public WindowCallbackData {
95 INLINE PropertiesCallbackData(CallbackGraphicsWindow *window,
WindowProperties &properties);
109 static void init_type() {
110 WindowCallbackData::init_type();
111 register_type(_type_handle,
"CallbackGraphicsWindow::PropertiesCallbackData",
112 WindowCallbackData::get_class_type());
115 return get_class_type();
117 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
123 enum RenderCallbackType {
130 class EXPCL_PANDA_DISPLAY RenderCallbackData :
public WindowCallbackData {
132 INLINE RenderCallbackData(CallbackGraphicsWindow *window, RenderCallbackType callback_type, FrameMode frame_mode);
147 RenderCallbackType _callback_type;
148 FrameMode _frame_mode;
155 static void init_type() {
156 WindowCallbackData::init_type();
157 register_type(_type_handle,
"CallbackGraphicsWindow::RenderCallbackData",
158 WindowCallbackData::get_class_type());
161 return get_class_type();
163 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
166 static TypeHandle _type_handle;
169 INLINE
void set_events_callback(CallbackObject *
object);
170 INLINE
void clear_events_callback();
171 INLINE CallbackObject *get_events_callback()
const;
173 INLINE
void set_properties_callback(CallbackObject *
object);
174 INLINE
void clear_properties_callback();
175 INLINE CallbackObject *get_properties_callback()
const;
177 INLINE
void set_render_callback(CallbackObject *
object);
178 INLINE
void clear_render_callback();
179 INLINE CallbackObject *get_render_callback()
const;
181 int create_input_device(
const std::string &name);
184 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
185 virtual void end_frame(FrameMode mode, Thread *current_thread);
194 virtual bool open_window();
195 virtual bool do_reshape_request(
int x_origin,
int y_origin,
bool has_origin,
196 int x_size,
int y_size);
199 PT(CallbackObject) _events_callback;
200 PT(CallbackObject) _properties_callback;
201 PT(CallbackObject) _render_callback;
204 static TypeHandle get_class_type() {
207 static void init_type() {
208 GraphicsWindow::init_type();
210 GraphicsWindow::get_class_type());
211 WindowCallbackData::init_type();
212 EventsCallbackData::init_type();
213 PropertiesCallbackData::init_type();
214 RenderCallbackData::init_type();
216 virtual TypeHandle get_type()
const {
217 return get_class_type();
219 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
222 static TypeHandle _type_handle;
224 friend class GraphicsEngine;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
get_frame_mode
If the callback type (returned by get_callback_type) is RCT_begin_frame or RCT_end_frame,...
get_callback_type
Since the render callback is shared for several functions, this method is needed to indicate which pa...
get_render_flag
Returns the current setting of the render flag.
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
set_render_flag
If the callback type is RCT_begin_frame, this call is available to specify the return value from the ...
get_window
Returns the window this callback was triggered from.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows,...
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
Encapsulates all the communication with a particular instance of a given rendering backend.
get_properties
Returns the current properties of the window.
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
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(),...