![全屏幕窗口的創(chuàng)建實驗報告_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/29/4513878f-d60b-49cf-bd09-3488c48d7ed0/4513878f-d60b-49cf-bd09-3488c48d7ed01.gif)
![全屏幕窗口的創(chuàng)建實驗報告_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/29/4513878f-d60b-49cf-bd09-3488c48d7ed0/4513878f-d60b-49cf-bd09-3488c48d7ed02.gif)
![全屏幕窗口的創(chuàng)建實驗報告_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/29/4513878f-d60b-49cf-bd09-3488c48d7ed0/4513878f-d60b-49cf-bd09-3488c48d7ed03.gif)
![全屏幕窗口的創(chuàng)建實驗報告_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/29/4513878f-d60b-49cf-bd09-3488c48d7ed0/4513878f-d60b-49cf-bd09-3488c48d7ed04.gif)
![全屏幕窗口的創(chuàng)建實驗報告_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/29/4513878f-d60b-49cf-bd09-3488c48d7ed0/4513878f-d60b-49cf-bd09-3488c48d7ed05.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、實驗四實驗報告課程:全屏幕窗口的創(chuàng)建班級:2010級遠程教育班專業(yè):教育技術(shù)學(遠程教育方向)實驗人:XXX學號:實驗時間:實驗室:數(shù)字媒體實驗室指導老師:XXX一、實驗?zāi)康?.熟悉窗口基本創(chuàng)建;2.學會對窗口模式改為全屏模式;3.熟悉全屏窗口的創(chuàng)建;二、實驗任務(wù)1.創(chuàng)建全屏窗口模式;3、 實驗過程1. 源代碼為:#include #include #include / define the screen resolution(定義屏幕分辨率)#define SCREEN_WIDTH 800#define SCREEN_HEIGHT 600/ include the Direct3D Libr
2、ary file#pragma comment (lib, d3d9.lib)/ global declarationsLPDIRECT3D9 d3d; / the pointer to our Direct3D interfaceLPDIRECT3DDEVICE9 d3ddev; / the pointer to the device class/ function prototypesvoid initD3D(HWND hWnd); / sets up and initializes Direct3D(建立和初始化裝置)void render_frame(void); / renders
3、a single framevoid cleanD3D(void); / closes Direct3D and releases memory/ the WindowProc function prototypeLRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);/ the entry point for any Windows program(入口點的任何窗口程序)int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIn
4、stance, LPSTR lpCmdLine, int nCmdShow)HWND hWnd;WNDCLASSEX wc;ZeroMemory(&wc, sizeof(WNDCLASSEX);wc.cbSize = sizeof(WNDCLASSEX);wc.style = CS_HREDRAW | CS_VREDRAW;wc.lpfnWndProc = WindowProc;wc.hInstance = hInstance;wc.hCursor = LoadCursor(NULL, IDC_ARROW);WS_EX_TOPMOST | WS_POPUP為全屏模式,WS_OVERLAPPED
5、WINDOW為窗口模式/ wc.hbrBackground = (HBRUSH)COLOR_WINDOW; / not needed any morewc.lpszClassName = LWindowClass;RegisterClassEx(&wc);hWnd = CreateWindowEx(NULL,LWindowClass,LOur Direct3D Program,WS_EX_TOPMOST | WS_POPUP, / 全屏模式的代碼0, 0, / the starting x and y positions should be 0SCREEN_WIDTH, SCREEN_HEIG
6、HT, / set the window to 640 x 480(設(shè)置窗口為)NULL,NULL,hInstance,NULL);ShowWindow(hWnd, nCmdShow);/ set up and initialize Direct3DinitD3D(hWnd);/ enter the main loop:MSG msg;while(TRUE)while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)TranslateMessage(&msg);DispatchMessage(&msg);if(msg.message = WM_QUIT)brea
7、k;render_frame();/ clean up DirectX and COMcleanD3D();return msg.wParam;/ this is the main message handler for the program(這是主要的消息處理程序)LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)switch(message)case WM_DESTROY:PostQuitMessage(0);return 0; break;return DefWindowP
8、roc (hWnd, message, wParam, lParam);/ this function initializes and prepares Direct3D for use(該函數(shù)初始化和準備使用的裝置)void initD3D(HWND hWnd)d3d = Direct3DCreate9(D3D_SDK_VERSION); / create the Direct3D interfaceD3DPRESENT_PARAMETERS d3dpp; / create a struct to hold various device information把TRUE改為FALSEZero
9、Memory(&d3dpp, sizeof(d3dpp); / clear out the struct for used3dpp.Windowed = FALSE; / program fullscreen, not windowedd3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; / discard old framesd3dpp.hDeviceWindow = hWnd; / set the window to be used by Direct3Dd3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; / set the b
10、ack buffer format to 32-bitd3dpp.BackBufferWidth = SCREEN_WIDTH; / set the width of the bufferd3dpp.BackBufferHeight = SCREEN_HEIGHT; / set the height of the buffer/ create a device class using this information and the info from the d3dpp stuct(創(chuàng)建一個類使用此信息和信息從d3dpp stuct)d3d-CreateDevice(D3DADAPTER_D
11、EFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&d3ddev);/ this is the function used to render a single frame(這個函數(shù)用來渲染一幀)void render_frame(void)/ clear the window to a deep blued3ddev-Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);d3ddev-BeginScene(); / begins the 3D scene/ do 3D rendering on the back buffer hered3ddev-EndScene(); / ends the 3D scened3ddev-Present(NULL, NULL, NULL, NULL); / displays the created frame on the screen/ this is the function that cleans up Direct3D and COM(這是功能,清理裝置和組件)void cleanD3D(void)d3ddev-Re
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度鋼結(jié)構(gòu)安裝與拆除一體化服務(wù)合同協(xié)議
- 二零二五年度農(nóng)田租賃田地合同
- 2025年度聯(lián)合體投標協(xié)議及航空航天設(shè)備制造合同
- 二零二五年度研學旅行學生社會實踐與職業(yè)規(guī)劃合同
- 二零二五年度2025年度租賃押金退還管理協(xié)議合同
- 二零二五年度互聯(lián)網(wǎng)公司監(jiān)事聘用合同范本(網(wǎng)絡(luò)安全)
- 緊急救援中的CPR拯救生命的黃金時刻
- 綜合性的商場內(nèi)部環(huán)境的舒適性設(shè)計與研究
- 科技驅(qū)動下的創(chuàng)業(yè)與創(chuàng)新能力培養(yǎng)
- 電氣災(zāi)害的預(yù)防措施及其在社區(qū)的普及
- 山東省濰坊市2024-2025學年高三上學期1月期末 英語試題
- 春節(jié)節(jié)后收心會
- 《榜樣9》觀后感心得體會四
- 七年級下冊英語單詞表(人教版)-418個
- 交警安全進校園課件
- 潤滑油過濾培訓
- 內(nèi)蒙自治區(qū)烏蘭察布市集寧二中2025屆高考語文全真模擬密押卷含解析
- 浙江省紹興市2023-2024學年高一上學期期末考試物理試題(含答案)
- 《住院患者身體約束的護理》團體標準解讀課件
- 中國急性缺血性卒中診治指南(2023版)
- 學前教育普及普惠質(zhì)量評估幼兒園準備工作詳解
評論
0/150
提交評論