hwInit, etc. - visual selection and context management routines for HoverWare
#include "hw.h" int hwInit( hwInt32 argc, char **argv ) hwDisplay hwDisplay->create( hwDisplay proto, hwDisplay sharedDisp, OS_DISPLAY_TYPE osDisplay ) hwInt32 hwDisplay->chooseVisual( hwDisplay disp, hwInt32 must, hwInt32 want ) hwDrawable hwDisplay->createWindow( hwDisplay disp, const char *winName, hwInt32 winX, hwInt32 winY, hwInt32 winW, hwInt32 winH ) void hwDisplay->makeCurrent( hwDisplay disp, hwDrawable draw ) OS_VISUAL_TYPE hwDisplay->extractVisual( hwDisplay disp ) OS_DRAWABLE_TYPE hwDisplay->extractWindow( hwDisplay disp, hwDrawable draw ) hwDrawable hwDisplay->initDrawable( hwDisplay disp, OS_DRAWABLE_TYPE draw ) void hwDisplay->viewport( hwDisplay disp, hwInt32 x, hwInt32 y, hwInt32 width, hwInt32 height ) void hwDisplay->update( hwDisplay disp )
These functions are used to initialize HoverWare for drawing. Their specific uses are:
HW_VIS_DBUFF | A double-buffered visual |
HW_VIS_DEPTH | A visual with depth (Z) buffer |
HW_VIS_ALPHA | A visual with destination alpha |
HW_VIS_STENCIL | A visual with a stencil buffer |
HW_VIS_TEXTURE | A visual which accelerates texture mapping |
HW_VIS_AA | A visual which has multisample AA (>= 2 and < 4 samples) |
HW_VIS_AA_MED | A visual which has multisample AA (>= 4 and < 8 samples) |
HW_VIS_AA_HI | A visual which has multisample AA (>= 8 samples) |
HW_WIN_INPUT | Allow window input to pass events to the routine established via disp->inputHandler |
HW_WIN_FULLSCREEN | Make the window full-screen and borderless |
HW_WIN_BORDERLESS | Make the window borderless |
HW_WIN_HIDE_CURSOR | Hide the cursor when inside the window |
HW_WIN_JOYSTICK | Allow joystick input to pass events to the routine established via disp->inputHandler |
Note that create(), chooseVisual(), createWindow(), makeCurrent(), extractVisual(), extractWindow(), initDrawable(), viewport(), and update() are actually methods in the hwDisplay class, and as such are always called through an instance of that class.
/* This program creates a simple window on the display and * then exits after the user hits return */ #include <stdio.h> #include <stdlib.h> #include "hw.h" int main( int argc, char **argv ) { hwDisplay disp; hwInt32 visResult; hwDrawable win; /* Initialize the display pointer */ hwInit( argc, argv ); disp = hwDefaultDisplay->create( hwDefaultDisplay, NULL, NULL ); if( !disp ) exit( 1 ); /* Find the appropriate visual type */ visResult = disp->chooseVisual( disp, HW_VIS_DBUFF|HW_VIS_DEPTH, 0 ); if( !visResult ) exit( 1 ); /* Create a 512x512 window */ win = disp->createWindow( disp, "Test", 10, 10, 512, 512 ); if( !win ) exit( 1 ); /* Establish it as current */ disp->makeCurrent( disp, win ); /* Update all graphics in it */ disp->update( disp ); /* Wait for user to hit return */ (void)getchar(); /* All done! */ return 0; }