int main(int argc, char *argv[]) { int quit = False; if (argc != 2) { fprintf(stderr, "Usage: wt <world file>\n"); exit(EXIT_FAILURE); } if (wt_init(argv[1],320,200) == EXIT_FAILURE) { perror(argv[1]); exit(EXIT_FAILURE); } while (!quit) { wt_render(); quit = wt_input(); } wt_term(); return EXIT_SUCCESS; }
/*----------------------------------------------------------------------------*\ | AppExit() | | | | Description: | | app is just about to exit, cleanup | | | \*----------------------------------------------------------------------------*/ void AppExit() { if (bWTinitialized) { wt_term(); bWTinitialized = FALSE; } if (Buffer) { HBITMAP hbm; // Retrieve the current WinGBitmap, replace with the original hbm = (HBITMAP)SelectObject(Buffer, gbmOldMonoBitmap); // And delete the WinGBitmap and WinGDC DeleteObject(hbm); DeleteDC(Buffer); } if(hpalApp) { DeleteObject(hpalApp); } }