<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > Windows Phone開(kāi)發(fā)工具初體驗

Windows Phone開(kāi)發(fā)工具初體驗

作者: 時(shí)間:2016-10-10 來(lái)源:網(wǎng)絡(luò ) 收藏

本文引用地址:http://dyxdggzs.com/article/201610/306005.htm

新界面

既然把 Emulator起來(lái)了,我們就順便參觀(guān)下的新界面吧。點(diǎn)左邊的Back鍵,會(huì )將應用程序的Debugger斷掉,不知道程序是否退出了。點(diǎn)中間的Win Button,會(huì )回到主界面。

不過(guò)主界面上只有IE一個(gè)圖標。Windows Phone模擬器中還沒(méi)有包括其他的系統功能,比如電話(huà)、電子郵件、搜索等。模擬器也沒(méi)有辦法模擬重力感應、Location定位服務(wù)。希望到Windows Phone正式發(fā)布時(shí),這些系統功能都可以被支持。

IE的用戶(hù)體驗非常好,一開(kāi)始新手發(fā)蒙,沒(méi)找到地址欄,后邊就非常順利了。無(wú)論是頁(yè)面縮放時(shí)的平滑動(dòng)畫(huà),還是輸入時(shí)切換到適當大小的設計,都非常順手。特別是Multi-Tab的設計,感覺(jué)非常舒服。特意試了Google Map,顯示一切正常。智能手機時(shí)代,有一個(gè)好的瀏覽器,其實(shí)就成功了一半。

哦,還有一點(diǎn),我在Windows Phone Emulator里沒(méi)有做任何配置,就可以上網(wǎng)了。

XNA 4.0

在移動(dòng)開(kāi)發(fā)界,XNA還不是一個(gè)響亮的名字,但是在游戲開(kāi)發(fā)界,Xbox 360上的XNA則是泰山北斗級的開(kāi)發(fā)技術(shù)。XNA不僅僅是一個(gè).NET的游戲開(kāi)發(fā)平臺,還包括了很多支持Xbox Live服務(wù)的功能,比如,Avatars技術(shù)支持在游戲中顯示用戶(hù)設計的形象。希望這項技術(shù)能夠和同名電影一樣,改變移動(dòng)游戲開(kāi)發(fā)的歷史。

Windows Phone支持的是XNA 4.0,與Zune HD上的XNA 3.1有啥區別?支持3D游戲!目前我們看到的這個(gè)XNA 4.0預覽版只支持Windows Phone開(kāi)發(fā),不支持Windows和Xbox 360的游戲開(kāi)發(fā)。

Silverlight for Windows Phone是典型的事件驅動(dòng)型應用程序。而XNA是由時(shí)間驅動(dòng)的應用程序,這也是游戲開(kāi)發(fā)技術(shù)的典型特點(diǎn)。每隔固定時(shí)間,系統會(huì )觸發(fā)Update事件,使程序得以更新。

不那么多廢話(huà)了,創(chuàng )建個(gè)XNA 4.0的新工程吧!

選擇Windows Phone Game就好了。IDE環(huán)境下沒(méi)有界面編輯器,需要程序員通過(guò)代碼來(lái)實(shí)現UI。XNA程序的結構非常簡(jiǎn)單,程序員只需要實(shí)現幾個(gè)簡(jiǎn)單的方法,就可以實(shí)現一個(gè)簡(jiǎn)單的XNA程序了。這些方法包括Initialize初始化方法、LoadContent加載文件、Update更新內容和Draw繪制等方法。下面是示例代碼片段:

protected override void LoadContent()

{

// Create a new SpriteBatch, which can be used to draw textures.

spriteBatch = new SpriteBatch(GraphicsDevice);

texture1 = Content.Load(winphone);

texture2 = Content.Load(winphone);

soundEffect = Content.Load(Windows Ding);

spritePosition1.X = 0;

spritePosition1.Y = 0;

spritePosition2.X = graphics.GraphicsDevice.Viewport.Width - texture1.Width;

spritePosition2.Y = graphics.GraphicsDevice.Viewport.Height - texture1.Height;

sprite1Height = texture1.Bounds.Height;

sprite1Width = texture1.Bounds.Width;

sprite2Height = texture2.Bounds.Height;

sprite2Width = texture2.Bounds.Width;

}

LoadContent方法中使用Content.Load方法來(lái)加載資源文件,這些文件也是作為資源被加載到XNA程序中的。

protected override void Update(GameTime gameTime)

{

// Allows the game to exit

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)

this.Exit();

// Move the sprite around.

UpdateSprite(gameTime, ref spritePosition1, ref spriteSpeed1);

UpdateSprite(gameTime, ref spritePosition2, ref spriteSpeed2);

CheckForCollision();

base.Update(gameTime);

}

Update方法負責更新元素的位置,進(jìn)行碰撞檢測。如果后退鍵被按下,則退出程序。

protected override void Draw(GameTime gameTime)

{

GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

// Draw the sprite.

spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

spriteBatch.Draw(texture1, spritePosition1, Color.White);

spriteBatch.End();

spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.Opaque);

spriteBatch.Draw(texture2, spritePosition2, Color.AliceBlue);

spriteBatch.End();

base.Draw(gameTime);

}

Draw方法對更新后的元素進(jìn)行繪制。

我們的第一個(gè)XNA程序會(huì )顯示兩張圖片,這兩張圖片會(huì )在屏幕中運行,運行到邊緣時(shí),會(huì )反彈回來(lái)。



評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>