int CGraphics::Init(HWND _hWnd) { m_hWnd = _hWnd; m_hDC = GetDC(m_hWnd); if (!InitPixelFormat(m_hDC)) return 1; m_hRC = wglCreateContext(m_hDC); wglMakeCurrent(m_hDC, m_hRC); glClearColor( 0, 0, 0, 0 ); wglUseFontBitmaps(m_hDC, 0, 256, 1000); return 0; }
BOOL ss_init(HWND hwnd) { RECT rc; set_saver_name(progname); ss.hwnd = hwnd; #undef ya_rand_init ya_rand_init(0); GetClientRect(hwnd, &rc); ss.x0 = rc.left; ss.y0 = rc.top; assert(ss.x0 == 0); assert(ss.y0 == 0); ss.width = rc.right - rc.left; ss.height = rc.bottom - rc.top; if (ss.width == 0 || ss.height == 0) return FALSE; ss.hdc = GetWindowDC(hwnd); if (ss.hdc == NULL) return FALSE; if (!InitPixelFormat(&ss)) { ReleaseDC(hwnd, ss.hdc); return FALSE; } ss.hbmScreenShot = GetScreenShotBitmap(); if (ss.hbmScreenShot == NULL) { ReleaseDC(hwnd, ss.hdc); return FALSE; } //SaveBitmapToFile("screenshot.bmp", ss.hbmScreenShot); MakeCurrent(&ss); ss.modeinfo.dpy = ss.hdc; ss.modeinfo.window = 0; ss.modeinfo.width = ss.width; ss.modeinfo.height = ss.height; ss.modeinfo.num_screen = 1; ss.modeinfo.screen_number = 0; ss.modeinfo.polygon_count = 0; ss.modeinfo.fps_p = False; ss.modeinfo.is_drawn = True; ss.modeinfo.count = hack_count; ss.modeinfo.cycles = hack_cycles; ss.modeinfo.size = hack_size; ss.modeinfo.xgwa.width = ss.width; ss.modeinfo.xgwa.height = ss.height; ss.modeinfo.xgwa.depth = 32; ss.modeinfo.xgwa.visual = NULL; ss.modeinfo.xgwa.colormap = 0; ss.modeinfo.xgwa.screen = 0; LoadSetting(&ss.modeinfo); SaveSetting(&ss.modeinfo); hack_init(&ss.modeinfo); return TRUE; }
BOOL ss_init(HWND hwnd) { RECT rc; set_saver_name(progname); ss.hwnd = hwnd; #undef ya_rand_init ya_rand_init(0); GetClientRect(hwnd, &rc); ss.x0 = rc.left; ss.y0 = rc.top; assert(ss.x0 == 0); assert(ss.y0 == 0); ss.width = rc.right - rc.left; ss.height = rc.bottom - rc.top; if (ss.width == 0 || ss.height == 0) return FALSE; ss.hdc = GetWindowDC(hwnd); if (ss.hdc == NULL) return FALSE; if (!InitPixelFormat(&ss)) { ReleaseDC(hwnd, ss.hdc); return FALSE; } ss.hbmScreenShot = GetScreenShotBitmap(); if (ss.hbmScreenShot == NULL) { ReleaseDC(hwnd, ss.hdc); return FALSE; } //SaveBitmapToFile("screenshot.bmp", ss.hbmScreenShot); MakeCurrent(&ss); ss.dpy = ss.hdc; ss.window = 0; ss.xgwa.width = ss.width; ss.xgwa.height = ss.height; ss.xgwa.depth = 32; ss.xgwa.visual = (Visual *)calloc(sizeof(Visual), 1); ss.xgwa.visual->class_ = TrueColor; ss.xgwa.visual->red_mask = 0x000000FF; ss.xgwa.visual->green_mask = 0x0000FF00; ss.xgwa.visual->blue_mask = 0x00FF0000; ss.xgwa.visual->bits_per_rgb = 32; ss.xgwa.colormap = 0; ss.xgwa.screen = 0; LoadSetting(); SaveSetting(); ss.closure = hack_init(ss.dpy, ss.window); return TRUE; }