add resize fn, remove resize callback

This commit is contained in:
cxgeorge 2001-09-28 02:33:48 +00:00
parent f587aaf020
commit 733e471461
2 changed files with 40 additions and 17 deletions

View File

@ -34,7 +34,7 @@ TypeHandle GraphicsWindow::WindowPipe::_type_handle;
GraphicsWindow::WindowFactory *GraphicsWindow::_factory = NULL; GraphicsWindow::WindowFactory *GraphicsWindow::_factory = NULL;
#ifndef CPPPARSER #if defined(DO_PSTATS) && !defined(CPPPARSER)
PStatCollector GraphicsWindow::_app_pcollector("App"); PStatCollector GraphicsWindow::_app_pcollector("App");
PStatCollector GraphicsWindow::_show_code_pcollector("App:Show code"); PStatCollector GraphicsWindow::_show_code_pcollector("App:Show code");
PStatCollector GraphicsWindow::_swap_pcollector("Swap buffers"); PStatCollector GraphicsWindow::_swap_pcollector("Swap buffers");
@ -138,7 +138,6 @@ GraphicsWindow(GraphicsPipe *pipe) : Configurable() {
_draw_callback = NULL; _draw_callback = NULL;
_idle_callback = NULL; _idle_callback = NULL;
_resize_callback = NULL;
_frame_number = 0; _frame_number = 0;
_is_synced = false; _is_synced = false;
} }
@ -157,7 +156,6 @@ GraphicsWindow(GraphicsPipe *pipe,
_draw_callback = NULL; _draw_callback = NULL;
_idle_callback = NULL; _idle_callback = NULL;
_resize_callback = NULL;
_is_synced = false; _is_synced = false;
} }
@ -368,16 +366,6 @@ register_idle_function(GraphicsWindow::vfn f) {
_idle_function = f; _idle_function = f;
} }
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::register_resize_function
// Access: Public, Virtual
// Description:
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
register_resize_function(GraphicsWindow::vfnii f) {
_resize_function = f;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::main_loop // Function: GraphicsWindow::main_loop
// Access: Public, Virtual // Access: Public, Virtual
@ -450,7 +438,7 @@ end_frame() {
// Description: Called whenever the window gets the resize event. // Description: Called whenever the window gets the resize event.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void GraphicsWindow:: void GraphicsWindow::
resized(const int x, const int y) { resized(const unsigned int x, const unsigned int y) {
Channels::iterator ci; Channels::iterator ci;
for (ci = _channels.begin(); ci != _channels.end(); ++ci) { for (ci = _channels.begin(); ci != _channels.end(); ++ci) {
GraphicsChannel *chan = (*ci); GraphicsChannel *chan = (*ci);
@ -611,6 +599,31 @@ void GraphicsWindow::read_priorities(void) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void GraphicsWindow:: void GraphicsWindow::
swap() { swap() {
display_cat.warning() << "swap() unimplemented by " << get_type() << endl;
}
void GraphicsWindow::
resize(unsigned int xsize,unsigned int ysize) {
display_cat.warning() << "resize() unimplemented by " << get_type() << endl;
}
unsigned int GraphicsWindow::
verify_window_sizes(unsigned int numsizes,unsigned int *dimen) {
// see if window sizes are supported (i.e. in fullscrn mode)
// dimen is an array containing contiguous x,y pairs specifying
// possible display sizes, it is numsizes*2 long. fn will zero
// out any invalid x,y size pairs. return value is number of valid
// sizes that were found.
//
// note: it might be better to implement some sort of query
// interface that returns an array of supported sizes,
// but this way is somewhat simpler and will do the job
// on most cards, assuming they handle the std sizes the app
// knows about.
display_cat.warning() << "verify_window_sizes() unimplemented by " << get_type() << endl;
return numsizes;
} }
void GraphicsWindow::deactivate_window(void) { return; } void GraphicsWindow::deactivate_window(void) { return; }

View File

@ -124,10 +124,22 @@ PUBLISHED:
INLINE void set_sync(const bool); INLINE void set_sync(const bool);
INLINE bool get_sync() const; INLINE bool get_sync() const;
// resize the window to the given size
virtual void resize(unsigned int xsize,unsigned int ysize);
// see if window sizes are supported (i.e. in fullscrn mode)
//
// note: it might be better to implement some sort of query
// interface that returns an array of supported sizes,
// but this way is somewhat simpler and will do the job
// on most cards, assuming they handle the std sizes the app
// knows about.
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
virtual void swap(); virtual void swap();
public: public:
virtual void resized(const int, const int); virtual void resized(const unsigned int, const unsigned int);
INLINE virtual void set_draw_callback(Callback *c); INLINE virtual void set_draw_callback(Callback *c);
INLINE virtual void set_idle_callback(Callback *c); INLINE virtual void set_idle_callback(Callback *c);
@ -164,7 +176,6 @@ PUBLISHED:
virtual void flag_redisplay(); virtual void flag_redisplay();
virtual void register_draw_function(GraphicsWindow::vfn); virtual void register_draw_function(GraphicsWindow::vfn);
virtual void register_idle_function(GraphicsWindow::vfn); virtual void register_idle_function(GraphicsWindow::vfn);
virtual void register_resize_function(GraphicsWindow::vfnii);
virtual void main_loop(); virtual void main_loop();
virtual bool supports_update() const; virtual bool supports_update() const;
@ -207,7 +218,6 @@ protected:
Callback *_draw_callback; Callback *_draw_callback;
Callback *_idle_callback; Callback *_idle_callback;
Callback *_resize_callback;
public: public:
virtual GraphicsChannel *get_channel(int index); virtual GraphicsChannel *get_channel(int index);