青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 16,  comments - 81,  trackbacks - 0
 

Lesson 2: 走向全屏

From

http://www.directxtutorial.com/tutorial9/b-direct3dbasics/dx9b2.aspx#still

Translated By----Double One(王大寶)   dfghj77777@gmail.com
Finished At 20101215

筆者:自第一篇發出以來,已過一月。最近忙,翻譯有些耽擱,接下來我會保證一周至少一篇 ,謝謝大家的支持。

課程概述

Making your game fullscreen is easy, but requires changing a few details of the program, as well as adding a couple lines of code.

In this lesson we will cover two things.  First, we will go over how to globalize your screen resolution and why you would do this.  Second, we'll cover the mechanics of making a window go into fullscreen mode.

其實全屏化很容易,改幾行代碼就好,來死狗(Let’s Go)。

在這一課中我們將介紹兩件事情。首先,我們將研究怎樣改變你的屏幕分辨率以及為什么要這么做。其次呢,我們捎帶介紹一下使窗口進入全屏模式的機制原理。

設置屏幕尺寸

Throughout your DirectX experience and in game programming you will come across many functions and structs that demand to know your screen size.  This can become a hassle when you decide to change the resolution later, and especially when you decide to change it during run-time.  For right now, we will cover a simple method to standardize your screen size across your program.

在你的DirectX或者游戲編程經歷里你一定會碰到許多函數和結構體管你要屏幕尺寸,是的,這也許并不困難。可是當你要更改分辨率時麻煩就來了,尤其是你非得在運行的時候這么干。現在,哥將給你介紹一個簡單的方法來規范你的程序的屏幕大小,這個方法非常簡單,但是非常的實用,而且,它只要九——百——九——十——八,還猶豫什么,趕緊往下看吧。

 

First, we must add two directives to the top of our program.  These represent the screen width and the screen height.

首先,我們在程序開頭添加兩個指令。這些代表了屏幕的寬度和屏幕的高度。

1// define the screen resolution
2#define SCREEN_WIDTH  800
3#define SCREEN_HEIGHT 600
4

 

The next step is to go through your program to where you indicate the width and height of your window.  Up to this point in the tutorial, you only have one, although we will come across another in a minute.  Do this to the code (changes in bold):

接下來,來到聲明窗口寬度和高度的地方。本教程到目前為止,只有一個聲明的地方,注意粗體那行:

 1hWnd = CreateWindowEx(NULL,
 2                          L"WindowClass",
 3                          L"Our Direct3D Program",
 4                          WS_OVERLAPPEDWINDOW,
 5                          300300,
 6                     SCREEN_WIDTH, SCREEN_HEIGHT,    // 設置新的尺寸 
 7NULL,
 8                          NULL,
 9                          hInstance,
10                          NULL);
11
 

In a later lesson we will cover how to maintain screen size throughout your game after changing it during runtime.

There are specific resolutions that are available on most PCs, the most common of which can be seen in this table.

在后面的課上,我們將討論如在運行過程中改變屏幕尺寸后繼續游戲。
這兒有張常見的分辨率表可以參考一下。

 

[Table 2.1 - Common Screen Resolutions]更多信息請猛擊我

Resolution

Pixels

Widescreen

800 x 600

480,000

No

1024 x 768

786,432

No

1152 x 864

995,328

No

1280 x 1024

1,310,720

No

1600 x 1200

1,920,000

No

1440 x 900

1,296,000

Yes

1680 x 1050

1,764,000

Yes

1920 x 1080

2,073,600

Yes

1920 x 1200

2,304,000

Yes



 

變成全屏模式

When changing to full screen you are doing several things.  First, your are telling Windows not to apply any of the standard Windows borders to your window.  Second, you are telling Windows to have your window overlap all other things on the screen, including the start menu.  Third, you are telling DirectX to change the resolution of the monitor to your set preference.  Finally, although less importantly, you are telling Windows to leave the window background color up to you.

The first two of these are handled by changing some CreateWindowEx() parameters.  The changes we need to make are shown here.

切換到全屏的時候你要做這么幾件事兒。首先,你告訴Windows不要添加任何標準的Windows窗口邊框。其次,你告訴不要把其他Windows窗口蓋在我們的全屏游戲上,包括開始菜單。再次,你告訴DirectX的把顯示器的分辨率設置成我們要的值。最后,盡管這條不是那么重要,你得告訴Windows離開窗口時的背景色。
前兩個處理通過改變一些CreateWindowEx()的參數。改動如下。

 1hWnd = CreateWindowEx(NULL,
 2                          L"WindowClass",
 3                          L"Our Direct3D Program",
 4                          WS_EX_TOPMOST | WS_POPUP,    // fullscreen values
 5                          00,    // the starting x and y positions should be 0
 6                          SCREEN_WIDTH, SCREEN_HEIGHT,
 7                          NULL,
 8                          NULL,
 9                          hInstance,
10                          NULL);
11

 

Here we set the starting x and y positions to 0.  We also changed the previous parameter to "WS_EX_TOPMOST | WS_POPUP".  The WS_EX_TOPMOST is self-explanatory, and makes the window overlap everything else.  The WS_POPUP is less self-explanatory, but what it does is tell Windows to remove all borders of any kind, including the rounded-edge top that you see in Windows XP.

在這里,我們設置xy的初始位置為0。我們還改變了第四個參數,將其設置為了“WS_EX_TOPMOST | WS_POPUP” WS_EX_TOPMOST顧名思義就是讓我們的全屏程序在桌面最頂層。WS_POPUP的作用是告訴Windows以消除任何形式的所有邊界,包括圓形的邊緣等窗口邊框,總之就是你所看到過的全屏游戲那樣。

 

There is also a member of the WINDOWCLASSEX struct that we need to take out.  This leaves the background color untouched, which means it won't be visible as window for a second or two before the game starts (important to making your game look professional).

還有一個WINDOWCLASSEX結構的成員,我們需要把它拿掉。它的作用是設置窗口背景色不,而這會使游戲全屏時屏幕閃爍幾下(把它拿掉會讓您的游戲看起來專業得多)。

1 wc.hbrBackground = NULL;//(HBRUSH)COLOR_WINDOW;
 

Next, we have to tell DirectX about our new screen resolution.  We do this by making a few changes to the d3dpp struct we built in the last lesson.  Let's look at what they are before we see what they do.

下一步,我們來告訴DirectX一個新的屏幕分辨率。我們通過對上一課中創建的d3dpp結構體進行一些小小的改變來完成這項工作。下面讓我們看看具體代碼吧

 

 1D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information
 2
 3    ZeroMemory(&d3dpp, sizeof(d3dpp));    // clear out the struct for use
 4    d3dpp.Windowed = FALSE;    // program fullscreen, not windowed
 5    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    // discard old frames
 6    d3dpp.hDeviceWindow = hWnd;    // set the window to be used by Direct3D
 7    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;    // set the back buffer format to 32-bit
 8    d3dpp.BackBufferWidth = SCREEN_WIDTH;    // set the width of the buffer
 9    d3dpp.BackBufferHeight = SCREEN_HEIGHT;    // set the height of the buffer
10


 

Let's examine these new back buffer related variables.

下面我來解釋一下這些新的后臺緩沖相關變量

 

d3dpp.BackBufferFormat

This member is used to tell Direct3D what kind of pixels should be displayed.  There are six types that can be used here, but two of them are older types (16-bit) and not generally used anymore.  There are several 32-bit types that we can use.  We'll use the D3DFMT_X8R8G8B8.  See the table for a description along with some other values than can be used here (definitely not all of them).

這個成員變量是用來告訴Direct3D什么樣的像素會被顯示。可分為六種 ,但其中兩大類型太老了(16),一般不到。有432位的類型,我們可以使用。本課將使用D3DFMT_X8R8G8B8。想知道具體這個四個類型,可以看看下面的表。

 

[Table 2.2 - Some Back Buffer Formats]

描述

D3DFMT_A8R8G8B8

This is a 32-Bit pixel format, with 256 levels (8 bits) of red, green, blue and alpha (semi-transparency).

這是一個32位的像素格式。有256(8bit)的紅,綠,藍以及透明通道。

D3DFMT_X8R8G8B8

This is similar to A8R8G8B8, with the one difference being that it does not support alpha, even though there are 8 bits to represent this.

這個和上一個很類似,唯一的不同就是這個不支持透明

D3DFMT_A2R10G10B10

This is a 32-Bit pixel format, with only two bits of alpha, but 10 bits (1024 levels) of each red, green and blue.

還是一個32位的像素格式。2bit的透明通道,10bit1024級)的紅綠藍通道。

D3DFMT_A16B16G16R16

64-BIT COLOR!  If you have the capability to run 64-bit color, I'd recommend playing around with this to see how it works.
64bit
的!哦這太棒了。如果你可以運行64位的顏色,我強烈推薦你使用這個
This value has 16 bits for each component (65536 levels compared to the current measly 256!)

紅綠藍加透明各占16bit65536級)。

 

BackBufferWidth and BackBufferHeight

These two members indicate the width and height of the back buffer.  Painfully simple.

這兩個成員變量表明后備緩沖區的寬度和高度。相當簡單

最終成品

So, there isn't much to change.  Let's take a look at the whole picture and see what is different and what is the same.

所以,其實沒改動多少。讓我們看一看整個代碼,并對比上一課什么是不同的,什么是一樣的。


 

There isn't really a point in me showing a screenshot of this program's result, because it would just be a blue rectangle.  Your program should look like that: a blue rectangle with a mouse pointer in the middle.

我沒有做截圖,因為它只是一個藍色的長方形。你的程序應該也看起來像他一樣:藍色的長方形充鼠標指針在中間。

總結

Great!  We now have a simple platform on which to build games.

Before you go on, I recommend doing the following exercise to gain familiarity with the code in this program:

Change the resolution of the program until you are familiar with the various resolutions selectable.

When you're ready to go on, let's hit the next lesson!

太棒了!我們現在有一個簡單的平臺做游戲。  

在你接著干之前,我建議做做這幾個練習一遍更好地熟悉Direct3D:  

改變程序的分辨率,直到你熟悉各種各樣可選擇的分辨率。

當你準備好了,我們開始下一個教程。

 

Next Lesson:  An Overview of the Third Dimension

下一課:三維的概述

 

GO! GO! GO!

 

posted on 2010-12-15 23:54 叫我老王吧 閱讀(2393) 評論(0)  編輯 收藏 引用 所屬分類: DierectXC++
<2010年12月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用鏈接

留言簿(4)

隨筆分類

隨筆檔案

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲国产精品va在线看黑人| 欧美激情国产日韩精品一区18| 欧美一区二区三区四区夜夜大片| 国产精品99久久久久久人| 在线观看一区二区视频| 激情综合色综合久久| 樱桃成人精品视频在线播放| 在线成人激情黄色| 亚洲精品久久久久久久久久久久久 | 99精品黄色片免费大全| 一二三区精品福利视频| 午夜亚洲视频| 校园激情久久| 蜜桃久久精品一区二区| 亚洲国产日韩欧美| 一本大道久久a久久综合婷婷| 亚洲男女自偷自拍| 久久综合影视| 国产精品成人在线观看| 在线成人中文字幕| 亚洲一区二区三| 久久综合久久美利坚合众国| 亚洲日本一区二区三区| 亚洲午夜国产成人av电影男同| 午夜精品久久久久久久白皮肤 | 国产模特精品视频久久久久| 在线不卡a资源高清| 一本久道久久综合中文字幕| 欧美一区二区视频97| 欧美成年人视频网站| 亚洲视频免费看| 久久蜜桃香蕉精品一区二区三区| 欧美色欧美亚洲另类二区| 国产精品一区二区在线观看不卡| 一区二区视频免费在线观看| 午夜亚洲福利在线老司机| 亚洲国产成人高清精品| 久久精品在线视频| 国产精品久久久久99| 亚洲精品国产精品国产自| 久久精品亚洲| 亚洲夜间福利| 欧美丝袜一区二区三区| 日韩亚洲欧美一区| 免费在线看成人av| 性xx色xx综合久久久xx| 国产精品一二三四区| 亚洲欧美国产精品桃花| 99re热这里只有精品免费视频| 农夫在线精品视频免费观看| 在线观看精品一区| 久久中文久久字幕| 欧美伊人精品成人久久综合97| 国产精品视频yy9099| 亚洲自拍高清| 亚洲无限av看| 国产精品久久婷婷六月丁香| 亚洲视频狠狠| 亚洲视频一区二区在线观看 | 99re6热只有精品免费观看| 欧美精品二区| 在线亚洲免费视频| 亚洲毛片在线观看| 欧美日韩在线精品| 亚洲欧美日韩另类精品一区二区三区 | 亚洲性色视频| 国产精品一卡二卡| 欧美专区18| 欧美中文字幕不卡| 狠狠色狠狠色综合系列| 欧美~级网站不卡| 麻豆精品网站| 日韩午夜激情av| 亚洲午夜激情网站| 国产一区日韩二区欧美三区| 男女精品视频| 欧美日韩在线一区| 久久国产精品网站| 美女日韩在线中文字幕| aaa亚洲精品一二三区| 亚洲手机视频| 在线精品视频在线观看高清| 亚洲国内精品在线| 国产精品免费看久久久香蕉| 久久精品亚洲精品| 欧美mv日韩mv国产网站app| 一本色道久久综合亚洲91| 亚洲一区二区三区四区五区午夜| 国产真实久久| 亚洲精品视频在线观看免费| 国产精品自拍视频| 裸体歌舞表演一区二区| 欧美日韩亚洲一区| 久久久久久亚洲精品中文字幕| 欧美超级免费视 在线| 午夜久久福利| 牛人盗摄一区二区三区视频| 欧美一区二区大片| 媚黑女一区二区| 欧美在线视频播放| 欧美精品在线免费| 久久人人97超碰精品888| 欧美日韩国产首页在线观看| 久久在线视频在线| 国产精品久久久久天堂| 亚洲黄色片网站| 狠狠综合久久av一区二区小说| 99国产精品| 亚洲精品一区二区在线| 欧美在线一区二区| 亚洲欧洲av一区二区| 欧美电影在线免费观看网站| 麻豆成人综合网| 国产亚洲亚洲| 亚洲综合精品一区二区| 亚洲少妇在线| 欧美精品一区二区三区很污很色的| 看欧美日韩国产| 国产日韩专区| 亚洲欧美激情四射在线日| 亚洲天堂免费观看| 欧美精品性视频| 91久久精品国产| 亚洲精品永久免费| 美女视频黄a大片欧美| 久久精品亚洲精品国产欧美kt∨| 国产精品入口福利| 一区二区三区精品国产| 一本色道久久综合亚洲精品不卡| 免费看的黄色欧美网站| 乱人伦精品视频在线观看| 欧美在线视频全部完| 久久久久久97三级| 国产精品电影网站| 99riav1国产精品视频| 亚洲国产成人精品视频| 久久久久五月天| 欧美www视频| 亚洲欧洲另类| 欧美激情一区二区三区四区| 亚洲国内在线| 一本色道88久久加勒比精品 | 欧美国产精品人人做人人爱| 亚洲福利久久| 男女精品视频| 亚洲美女av黄| 亚洲影院在线观看| 国产精一区二区三区| 午夜在线视频观看日韩17c| 久久久久欧美精品| 亚洲高清不卡在线观看| 欧美激情乱人伦| 在线视频一区观看| 久久精品国产99国产精品澳门| 国内自拍亚洲| 欧美激情乱人伦| 亚洲综合电影| 欧美激情亚洲| 亚洲一区在线直播| 国内久久精品| 欧美激情综合色综合啪啪| 一本色道久久综合狠狠躁篇怎么玩 | 久久久久久久久久久久久久一区| 麻豆av一区二区三区久久| 亚洲国产日韩欧美在线动漫| 欧美日韩国产a| 亚洲欧美日韩网| 欧美xx69| 欧美一区二区视频97| 亚洲人成在线观看| 国产精品日韩一区二区三区| 麻豆久久精品| 亚洲欧美成人网| 亚洲高清视频在线观看| 欧美在线日韩| 亚洲视频你懂的| 在线精品国产欧美| 国产精品久久久久91| 欧美国产一区在线| 欧美在线精品免播放器视频| 亚洲精选在线| 欧美v国产在线一区二区三区| 性欧美超级视频| 洋洋av久久久久久久一区| 精品成人一区二区三区四区| 国产精品久久久久91| 欧美激情久久久| 牛牛影视久久网| 久久久亚洲欧洲日产国码αv| 亚洲——在线| 一区二区三区精品视频在线观看| 亚洲国产精品黑人久久久| 久久精品人人爽| 午夜精品久久久久| 亚洲视频观看| 欧美二区在线| 另类图片国产| 久久亚洲国产精品一区二区 | 香蕉久久夜色精品国产使用方法| 亚洲欧洲视频|