Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


SSWUG

Reader rating:
Click here to read 1 comment about this article.
Article source: CoDe (2011 Jan/Feb)


Article Pages:  1  2 3 - Next >


New Features in XNA 4.0 and Windows Phone 7

Unless you’ve been living under a rock, you’ve probably heard about Windows Phone 7. What you may not know is that there are two ways of developing applications and games for this device. Silverlight and XNA are your two choices and in this article, I cover the Games and XNA side of the house.

If you are brand new to game development, XNA or mobile device development, don’t worry. This article will get you started and productive in no time.

Where Do I Get It?

The first step in getting started with XNA for Windows Phone development is to visit the developer site at http://developer.windowsphone.com and click the “Get the free tools” link.

Running the web installer puts a number of things on your system, including:

  • Microsoft XNA Game Studio 4.0
  • Microsoft XNA Game Studio 4.0 Windows Phone Extensions
  • Microsoft XNA Framework Redistributable 4.0
  • Windows Phone Emulator
  • Windows Phone 7 Add-in for Visual Studio 2010
  • Microsoft Windows Phone 7 Developer Resources

You also get Expression 4.0 and Silverlight 4.0, though those are not relevant to this article.

How Do I Use It?

If you’ve spent any time with previous versions of XNA up to this point, you’re in luck. There isn’t much difference between XNA 3.1 and XNA 4.0 other than the new stuff added for phone-specific projects.

Hopefully you grabbed the installer and ran it by now, so I’ll just jump right in to your first project.

If you didn’t already have Visual Studio 2010 installed, you do now. The web installer puts the Visual Studio 2010 Express Edition for Windows Phone on your system for you.

Once you have Visual Studio 2010 open (you can use ANY version of Visual Studio 2010 you like) go ahead and select XNA Game Studio 4.0 in the Installed Templates section and then select Windows Phone Game (4.0) as your project type, as seen in Figure 1.

Click for a larger version of this image.

Figure 1: The Create Project screen in Visual Studio 2010.

Go ahead and leave the name alone and create your project.

Once your project has been created, the first thing you will see is the Game1.cs class. This is the meat of your game and where all the interesting things happen.

Regardless of what platform you are developing for (Windows, Xbox or Windows Phone) you will use the same basic concepts.

XNA Games follow a very simple pattern, as seen in Figure 2.

Click for a larger version of this image.

Figure 2: XNA game sequence.

As you can see, there isn’t a lot to it.

The Initialize() and LoadContent() methods are only called once per game and are used to query for any required services, load up content, etc.

Once you are in your game loop, you have two very important methods: Update() and Draw().

The Update() method is used to query for any player input along with processing any “world logic” like collision detection, artificial intelligence, weather, etc. Playing audio is also handled in this method.

The Draw() method is used to draw all the onscreen game objects, using the positional or other data that was manipulated in the Update() method.

Each pass through the game loop is called a frame. XNA games on Windows and Xbox 360 target 60 frames per second (fps), and Windows Phone games run at 30 fps.

If you take a look at the last line of the Game1() constructor, you will see this line:

TargetElapsedTime = TimeSpan.FromTicks(3333333);

This is what tells XNA to run your phone game at 30 frames per second (a tick is roughly 100 nanoseconds or one ten-millionth of a second.)

While you can adjust the value to make your game run slower, you can’t just tweak it up to make your game run faster, so let’s just leave it alone for now.

If you scan the rest of the Game1 class, you can see there isn’t really anything else different from the previous template.

Take It for a Spin…

At this point, go ahead and run your game by hitting F5. This will do a quick build and will also launch the Windows Phone Emulator. After a few seconds, you should be looking at a nice cornflower blue screen in the emulator.

It doesn’t do much, but that’s ok. Click on the Back Button on the emulator to dismiss the game. Don’t close the emulator though. You’ll want to keep it running.

What’s New in the Framework?

With Windows Phone 7 comes a lot of new functionality that traditional Windows developers (and even many existing XNA developers) haven’t been exposed to, such as dealing with device orientation, the accelerometer sensor and multi-touch gesture input.

I will cover each of those in the following samples.

&

By: Chris Williams

Chris Williams is a Principal Consultant for Magenic and the author of the upcoming super-mega-bestseller Professional Windows Phone 7 Game Development: Creating Games Using XNA Game Studio 4.

He's also a DirectX / XNA MVP, MCT, MCSD (.NET) Early Adopter, MCAD, Director of the INETA Speakers Bureau, freelance game developer, conference speaker, vintage arcade game collector, INETA Community Champion and plays a pretty mean guitar in Rock Band.

When not doing any of the above stuff, he can often be found in a Waffle House. He likes 'em scattered, covered and chunked.

http://www.amazon.com/gp/product/images/0470922443/ref=dp_image_0?ie=UTF8&;n=283155&s=books

chrisgwilliams@gmail.com



Article Pages:  1  2 3 - Next Page: 'Device Orientation' >>

Page 1: New Features in XNA 4.0 and Windows Phone 7
Page 2: Device Orientation
Page 3: Multi-touch Gestures

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.4 out of 5

5 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      LearnNow

 

SSWUG