This is the base class for cross-platform porting of applications that access a window on the desktop.
class VIRTUALwindow {
protected:
unsigned int flags;
This data element contains state data about the window, who's values are determined by subclasses.
public:
mapul mapbuffer;
This data element may contain information about the contents displayed, usually screendumps.
VIRTUALwindow();
virtual ~VIRTUALwindow();
virtual int VIRTUALreparent(void *data) = 0;
This method allows the user to reparent the window as a child to another. "data" is determined by subclasses.
virtual int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs = NULL) = 0;
This method is called to initialize the window. "argc" & "argv" are a list of initialization tokens whose source is usually the arguments to main(). "maxx" & "maxy" are the width and height dimensions, "winname" is the window title, usually displayed in the border, and "attribs" is a NULL terminated array of initialization variables, whose contents are determined by subclasses. Note: proper behavior is to call VIRTUALcancel() to close the window - it is undefined if VIRTUALreset() is called more than once w/o intervening calls to VIRTUALcancel().
virtual void VIRTUALswapbuffers() = 0;
This method is called when drawing commands are completed for the current frame.
virtual void VIRTUALcancel() = 0;
This method is called to close the window. It's behavior undetermined if this is called without a preceeding call to VIRTUALreset().
virtual void VIRTUALgetdim(int *w, int *h) = 0;
This method returns the current width & height of the window.
};
This subclass of VIRTUALwindow is a parent class that has image viewing capability.
class BLTwindow : public VIRTUALwindow {
public:
virtual void BLTbitblt(mapul *mcanvas) = 0;
This method displays the 32 bit image w/in "mcanvas" till user input (keystroke, mouse button) is detected.
virtual void BLTbitblt(int framenum, linelist *mcanvas) = 0;
This method displays a number ("framenum") of vector objects w/in "mcanvas" till user input (keystroke, mouse button) is detected.
virtual void BLTbitmap(mapul *mcanvas) = 0;
This method displays the raster image w/in "mcanvas".
virtual void BLTbitmap(int framenum, linelist *mcanvas) = 0;
This method displays frame # "framenum" from a series of vector based images w/in "mcanvas".
virtual void BLTanimate(int numframes, mapul *mcanvas) = 0;
This method displays a series of raster based images. "numframes" is the number of images, and "mcanvas" is an array of images to be displayed.
virtual void BLTanimate(linelist *mcanvas) = 0;
This method displays a series of vector based images w/in "mcanvas" till user input (keystroke, mouse button) is detected.
virtual ~BLTwindow(); };
This subclass of VIRTUALwindow is a parent class for performing offscreen rendering.
class OSwindow : public VIRTUALwindow {
public:
virtual int OSquery_reset() = 0;
virtual ~OSwindow();
This method is used to determine if the instantiated object was initialized correctly, usually by calling "VIRTUALreset()".
virtual void OSset_context() = 0;
This method is usually called if multiple VIRTUALwindow based objects exist, and there's the possibility of the current drawing state currently set to another window. This method resets the current drawing state to the off-screen buffer represented by this object.
};
This is the MS-Windows/OpenGL-pbuffer implementation of the OSwindow offscreen rendering class.
class WOSwindow : public OSwindow {
protected:
HPBUFFERARB pbuffer;
This member is a handle to the pbuffer.
HDC mdisplay;
This member is a handle to a background screen device context.
HDC pdisplay;
This member is a handle to the pbuffer device context.
HGLRC bcontext;
This member is a handle to a background OpenGL context.
HGLRC context;
This member is a handle to a pbuffer OpenGL context.
HWND bgwin;
This member is a handle to a background window.
void WOSsetup_ogl();
This method initializes the pbuffer for rendering.
public:
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALpause() {}
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
void OSset_context();
A replacement for the virtual function defined in "OSwindow".
int OSquery_reset();
A replacement for the virtual function defined in "OSwindow".
WOSwindow();
virtual ~WOSwindow();
};
This is the X11/OpenGL-pbuffer implementation of the OSwindow offscreen rendering class.
class XOSwindow : public OSwindow {
protected:
Display *mdisplay;
This member is a pointer to the screen display.
GLXPbuffer pbuffer;
This member is a representation of the pbuffer.
GLXContext context;
This member is a representation of the rendering context.
unsigned int *XOSnew_ogl_attrib_list(unsigned int *attribs);
This method is used to extract information from "attribs", who's source is usually "VIRTUALreset()".
void XOSsetup_ogl();
This method initializes the pbuffer for rendering.
public:
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALpause();
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
void OSset_context();
A replacement for the virtual function defined in "OSwindow".
int OSquery_reset();
A replacement for the virtual function defined in "OSwindow".
XOSwindow();
virtual ~XOSwindow();
};
This subclass of BLTwindow is a parent class for designing customized MS-Windowing classes.
class WIN32window : public BLTwindow {
protected:
int WIN32create_window(int argc, char *argv[], int maxx, int maxy, char *winname);
This function creates a generic window using the arguments, usually called by "VIRTUALreset()". "argc" & "argv" are a list of initialization tokens whose source is usually the arguments to main(). "maxx" & "maxy" are the width and height dimensions, "winname" is the window title, displayed in the border.
public:
HWND mwindow;
This member is a handle to the window.
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALpause();
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
virtual ~WIN32window(); };
This subclass of WIN32window is a parent class for designing customized MS-Window DirectDraw & Direct3D classes.
class DXGLwindow : public WIN32window {
protected:
IDirect3D8 *ddtr;
This is a pointer to the object returned by Direct3DCreate8().
int bpp;
This member is the requested bytes per pixel.
IDirect3DDevice8 *ddevice;
This member is the device object returned by CreateDevice().
IDirect3DSurface8 *background;
This member is the backbuffer object for "ddevice".
int DXGL_DDInit(int fullscreen_flag);
This method performs the DirectDraw/Direct3D calls to create a drawing canvas.
public:
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
void BLTbitblt(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitblt(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(int numframes, mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
DXGLwindow();
virtual ~DXGLwindow();
};
This subclass of WIN32window is a parent class for designing customized MS-Window OpenGL-onscreen classes.
class WOGLwindow : public WIN32window {
protected:
HDC mdisplay;
This member is a reference to the device context.
void WOGLbitmap(dbl_llist_manager *mcanvas);
This method renders a vector-based image. "mcanvas" manages a list of "line_type" objects.
int WOGLinit_font();
This method initializes the default font used by WOGLprint().
void WOGLsetup_ogl();
This method initializes the window for rendering.
public:
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
void BLTbitblt(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitblt(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(int numframes, mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
HGLRC context;
This member is a reference to the OpenGL rendering context.
unsigned int fontid;
This member is the texture ID for the font used by WOGLprint().
virtual ~WOGLwindow();
void WOGLprint(int x, int y, char *buffer);
This member will print the character string "buffer" to the screen at coordinates (x,y), where (0,0) is the lower left corner of the window.
void WOGLset_context();
This method is usually called if multiple VIRTUALwindow based objects exist, and there's the possibility of the current drawing state currently set to another window. This method resets the current drawing state to the off-screen buffer represented by this object.
};
This subclass of BLTwindow is a parent class for designing customized X11 window classes.
class Xwindow : public BLTwindow {
protected:
GC mGC;
This member is a reference to the graphics context.
XImage *xcanvas;
This member is a pointer to an XImage structure that is used to transfer images from Pixcon to the screen.
void Xmapcpy(XImage * mcanvas, mapul *tob);
This method transfers an image from "tob" to "mcanvas".
public:
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
void BLTbitblt(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitblt(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(int numframes, mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
Display *mdisplay;
This member is a pointer to the display.
Window mwindow;
This member is a reference to the window.
Xwindow();
virtual ~Xwindow();
int Xqtest(unsigned int x);
This method checks if an XEvent of type "x" exists on the input queue.
int Xpollkeyboard(char *x);
This method polls the keyboard for the status of the keys and puts the result in "x". "x" must be at least 32 bytes - each bit represents the up/down status of each key.
int Xcode2sym(unsigned int x);
This method takes a KeyCode "x" and returns the associated KeySym.
XEvent Xqread(unsigned int *x);
This method returns the next XEvent on the queue. If it's a KeyPress, "x" is assignedthe associated Keysym.
void Xqenter(XEvent *mevent);
This method puts an XEvent on the queue.
void Xline(int x0, int y0, int x1, int y1, unsigned int color, mapul *mcanvas);
This method draws a line on "mcanvas" from (x0, y0) to (x1, y1), where (0,0) is the lower left corner.
void Xline(int x0, int y0, int x1, int y1, unsigned int color, XImage *mcanvas);
This method draws a line on "mcanvas" from (x0, y0) to (x1, y1), where (0,0) is the lower left corner.
};
This subclass of Xwindow is a parent class for designing customized X11 window OpenGL-onscreen classes.
class XOGLwindow : public Xwindow {
protected:
int fontcount;
This is the number of characters in the font.
unsigned int *XOGLnew_ogl_attrib_list(unsigned int *attribs);
This method converts the generic OGLFLAG attributes contained int "attribs", converts them to OpenGL specific attributes, returns them in an integer array. It is up to the caller to use "delete []" to free the returned array.
int XOGLinit_font();
This method initializes the default font used by XOGLprint().
void XOGLsetup_ogl();
This method initializes the window for rendering.
public:
int VIRTUALreset(int argc, char **argv, int maxx, int maxy, char *winname, void *attribs);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALcancel();
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALswapbuffers();
A replacement for the virtual function defined in "VIRTUALwindow".
int VIRTUALreparent(void *data);
A replacement for the virtual function defined in "VIRTUALwindow".
void VIRTUALgetdim(int *w, int *h);
A replacement for the virtual function defined in "VIRTUALwindow".
void BLTbitblt(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitblt(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTbitmap(int framenum, linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(int numframes, mapul *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
void BLTanimate(linelist *mcanvas);
A replacement for the virtual function defined in "BLTwindow".
GLXContext context;
This member contains the GLX context used for OpenGL rendering.
GLuint fontid;
This member is the texture ID for the font used by XOGLprint().
virtual ~XOGLwindow();
void XOGLprint(int x, int y, char *buffer);
This member will print the character string "buffer" to the screen at coordinates (x,y), where (0,0) is the lower left corner of the window.
void XOGLset_context();
This method is usually called if multiple VIRTUALwindow based objects exist, and there's the possibility of the current drawing state currently set to another window. This method resets the current drawing state to the off-screen buffer represented by this object.
};