⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddraw.c

📁 uboot在arm处理器s3c2410的移植代码
💻 C
📖 第 1 页 / 共 2 页
字号:
****************************************************************************/static PM_HWND _PM_convertUserWindow(    HWND hwnd,    int width,    int height){    RECT    window;    GetWindowRect(hwnd,&window);    oldWinPosX = window.left;    oldWinPosY = window.top;    oldWinSizeX = window.right - window.left;    oldWinSizeY = window.bottom - window.top;    oldWndStyle = SetWindowLong(hwnd,GWL_STYLE,WS_POPUP | WS_SYSMENU);    oldExWndStyle = SetWindowLong(hwnd,GWL_EXSTYLE,WS_EX_APPWINDOW);    ShowWindow(hwnd,SW_SHOW);    MoveWindow(hwnd,0,0,width,height,TRUE);    SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);    oldWinProc = (WNDPROC)SetWindowLong(hwnd,GWL_WNDPROC, (LPARAM)PM_winProc);    return hwnd;}/****************************************************************************PARAMETERS:hwnd    - User window to restoreREMARKS:This function restores the original attributes of the user window and put'sit back into it's original state before it was converted to a fullscreenwindow.****************************************************************************/static void _PM_restoreUserWindow(    HWND hwnd){    SetWindowLong(hwnd,GWL_WNDPROC, (LPARAM)oldWinProc);    SetWindowLong(hwnd,GWL_EXSTYLE,oldExWndStyle);    SetWindowLong(hwnd,GWL_STYLE,oldWndStyle);    SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);    ShowWindow(hwnd,SW_SHOW);    MoveWindow(hwnd,oldWinPosX,oldWinPosY,oldWinSizeX,oldWinSizeY,TRUE);    oldWinProc = NULL;}/****************************************************************************PARAMETERS:device  - Index of the device to load DirectDraw for (0 for primary)REMARKS:Attempts to dynamically load the DirectDraw DLL's and create the DirectDrawobjects that we need.****************************************************************************/void * PMAPI PM_loadDirectDraw(    int device){    HDC         hdc;    int         bits;    /* Call system DLL version if found */    if (_PM_imports.PM_loadDirectDraw != PM_loadDirectDraw)	return _PM_imports.PM_loadDirectDraw(device);    /* TODO: Handle multi-monitor!! */    if (device != 0)	return NULL;    /* Load the DirectDraw DLL if not presently loaded */    GET_DEFAULT_CW();    if (!hInstDD) {	hdc = GetDC(NULL);	bits = GetDeviceCaps(hdc,BITSPIXEL);	ReleaseDC(NULL,hdc);	if (bits < 8)	    return NULL;	if ((hInstDD = LoadLibrary("ddraw.dll")) == NULL)	    return NULL;	pDirectDrawCreate = (void*)GetProcAddress(hInstDD,"DirectDrawCreate");	if (!pDirectDrawCreate)	    return NULL;	}    /* Create the DirectDraw object */    if (!lpDD && pDirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) {	lpDD = NULL;	return NULL;	}    RESET_DEFAULT_CW();    return lpDD;}/****************************************************************************PARAMETERS:device  - Index of the device to unload DirectDraw for (0 for primary)REMARKS:Frees any DirectDraw objects for the device. We never actually explicitlyunload the ddraw.dll library, since unloading and reloading it isunnecessary since we only want to unload it when the application exits andthat happens automatically.****************************************************************************/void PMAPI PM_unloadDirectDraw(    int device){    /* Call system DLL version if found */    if (_PM_imports.PM_unloadDirectDraw != PM_unloadDirectDraw) {	_PM_imports.PM_unloadDirectDraw(device);	return;	}    if (lpDD) {	IDirectDraw_Release(lpDD);	lpDD = NULL;	}    (void)device;}/****************************************************************************REMARKS:Open a console for output to the screen, creating the main event handlingwindow if necessary.****************************************************************************/PM_HWND PMAPI PM_openConsole(    PM_HWND hWndUser,    int device,    int xRes,    int yRes,    int bpp,    ibool fullScreen){    WNDCLASS        cls;    static ibool    classRegistered = false;    /* Call system DLL version if found */    GA_getSystemPMImports();    if (_PM_imports.PM_openConsole != PM_openConsole) {	if (fullScreen) {	    _PM_deskX = xRes;	    _PM_deskY = yRes;	    }	return _PM_imports.PM_openConsole(hWndUser,device,xRes,yRes,bpp,fullScreen);	}    /* Create the fullscreen window if necessary */    hwndUser = hWndUser;    if (fullScreen) {	if (!classRegistered) {	    /* Create a Window class for the fullscreen window in here, since	     * we need to register one that will do all our event handling for	     * us.	     */	    hInstApp            = GetModuleHandle(NULL);	    cls.hCursor         = LoadCursor(NULL,IDC_ARROW);	    cls.hIcon           = LoadIcon(hInstApp,MAKEINTRESOURCE(1));	    cls.lpszMenuName    = NULL;	    cls.lpszClassName   = szWinClassName;	    cls.hbrBackground   = GetStockObject(BLACK_BRUSH);	    cls.hInstance       = hInstApp;	    cls.style           = CS_DBLCLKS;	    cls.lpfnWndProc     = PM_winProc;	    cls.cbWndExtra      = 0;	    cls.cbClsExtra      = 0;	    if (!RegisterClass(&cls))		return NULL;	    classRegistered = true;	    }	_PM_deskX = xRes;	_PM_deskY = yRes;	if (!hwndUser) {	    char windowTitle[80];	    if (LoadString(hInstApp,1,windowTitle,sizeof(windowTitle)) == 0)		strcpy(windowTitle,"MGL Fullscreen Application");	    _PM_hwndConsole = CreateWindowEx(WS_EX_APPWINDOW,szWinClassName,		windowTitle,WS_POPUP | WS_SYSMENU,0,0,xRes,yRes,		NULL,NULL,hInstApp,NULL);	    }	else {	    _PM_hwndConsole = _PM_convertUserWindow(hwndUser,xRes,yRes);	    }	ShowCursor(false);	isFullScreen = true;	}    else {	_PM_hwndConsole = hwndUser;	isFullScreen = false;	}    SetFocus(_PM_hwndConsole);    SetForegroundWindow(_PM_hwndConsole);    DisableAutoPlay();    (void)bpp;    return _PM_hwndConsole;}/****************************************************************************REMARKS:Find the size of the console state buffer.****************************************************************************/int PMAPI PM_getConsoleStateSize(void){    /* Call system DLL version if found */    if (_PM_imports.PM_getConsoleStateSize != PM_getConsoleStateSize)	return _PM_imports.PM_getConsoleStateSize();    /* Not used in Windows */    return 1;}/****************************************************************************REMARKS:Save the state of the console.****************************************************************************/void PMAPI PM_saveConsoleState(    void *stateBuf,    PM_HWND hwndConsole){    /* Call system DLL version if found */    if (_PM_imports.PM_saveConsoleState != PM_saveConsoleState) {	_PM_imports.PM_saveConsoleState(stateBuf,hwndConsole);	return;	}    /* Not used in Windows */    (void)stateBuf;    (void)hwndConsole;}/****************************************************************************REMARKS:Set the suspend application callback for the fullscreen console.****************************************************************************/void PMAPI PM_setSuspendAppCallback(    PM_saveState_cb saveState){    /* Call system DLL version if found */    if (_PM_imports.PM_setSuspendAppCallback != PM_setSuspendAppCallback) {	_PM_imports.PM_setSuspendAppCallback(saveState);	return;	}    suspendApp = saveState;}/****************************************************************************REMARKS:Restore the console state.****************************************************************************/void PMAPI PM_restoreConsoleState(    const void *stateBuf,    PM_HWND hwndConsole){    /* Call system DLL version if found */    if (_PM_imports.PM_restoreConsoleState != PM_restoreConsoleState) {	_PM_imports.PM_restoreConsoleState(stateBuf,hwndConsole);	return;	}    /* Not used in Windows */    (void)stateBuf;    (void)hwndConsole;}/****************************************************************************REMARKS:Close the fullscreen console.****************************************************************************/void PMAPI PM_closeConsole(    PM_HWND hwndConsole){    /* Call system DLL version if found */    if (_PM_imports.PM_closeConsole != PM_closeConsole) {	_PM_imports.PM_closeConsole(hwndConsole);	return;	}    ShowCursor(true);    RestoreAutoPlay();    if (hwndUser)	_PM_restoreUserWindow(hwndConsole);    else	DestroyWindow(hwndConsole);    hwndUser = NULL;    _PM_hwndConsole = NULL;}/****************************************************************************REMARKS:Return the DirectDraw window handle used by the application.****************************************************************************/PM_HWND PMAPI PM_getDirectDrawWindow(void){    /* Call system DLL version if found */    if (_PM_imports.PM_getDirectDrawWindow != PM_getDirectDrawWindow)	return _PM_imports.PM_getDirectDrawWindow();    return _PM_hwndConsole;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -