0% found this document useful (0 votes)
132 views26 pages

TPA - Windows Phone: XNA - Introduction

This document provides an overview of XNA, including: - XNA is a game development framework that allows developers to write games once and deploy them to Windows Phone, Xbox 360, and PC. - It includes tools and a managed runtime for easier game development. Games can be written in C# and deployed to different platforms from the same codebase. - The core framework includes math libraries, input handling, and an application model with a game loop for update/draw. - Content can be loaded and processed through the content pipeline for unified asset handling across platforms. - Examples demonstrate a basic endless loop game structure and creating a bouncing balls game in XNA. - XNA
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views26 pages

TPA - Windows Phone: XNA - Introduction

This document provides an overview of XNA, including: - XNA is a game development framework that allows developers to write games once and deploy them to Windows Phone, Xbox 360, and PC. - It includes tools and a managed runtime for easier game development. Games can be written in C# and deployed to different platforms from the same codebase. - The core framework includes math libraries, input handling, and an application model with a game loop for update/draw. - Content can be loaded and processed through the content pipeline for unified asset handling across platforms. - Examples demonstrate a basic endless loop game structure and creating a bouncing balls game in XNA. - XNA
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

TPA - Windows Phone

XNA introduction

Prepared by: Kamil Kowalski

Agenda
Basic information about XNA XNA endless loop First XNA game XNA vs Silverlight and using them together Bouncing balls Game examples

XNA basic info


XNA stands for XNA is Not an Acronym.
It originally was for Xbox New Architecture. But instead of being release with that name the Xbox 360 (2005) released and XNA was change to XNA is Not an Acronym.

XNA is a set of tools with a managed runtime environment to make developers life a lot easier when It comes to game development. XNA same source code of a game can be run on the WP7, Xbox 360 and Windows PC. Games can be written in any .NET-compliant language, but only C# in XNA Game Studio Express IDE and all versions of Visual Studio 2008 and 2010 (as of XNA 4.0) are officially supported. Games can be submitted with the AppHub membership for Xbox and Windows Phone

XNA basic info


Major elements of XNA
Core framework contains all the necessary elements for game development like math library for working with vectors and matrixes, a library for unified work with different input controllers, etc. Extended Framework: Application model & Content Pipeline

XNA basic info


Application Model - is a framework (template) for an application. Each new XNA Game project already has a Game1 class which has a set of methods, where each has its own purpose.
The purpose of this framework is that the developer doesn't need to think about problems like:
How do I create a game loop? When do I need to process user input? How do I synchronize rendering speed with video adapter refresh rate?

XNA basic info


Content Pipeline - unifies game content processing.
All game contents are placed in a special storage and are processed with importers and processors which are already included into the XNA Game Studio. You don't need to spend time to create your own importers.

XNA endless loop


XNA works on an endless loop
if user quits game then obviously it will stop the loop is between calling the Update and Draw before that other methods are call, witch are: Initialize and LoadContent At the end all content is unloaded in UnloadContent method

XNA endless loop


Initialize
Called before anything is draw in the screen (before the game even starts) here you can query for any required service and non-graphical related content

LoadContent
Called before anything is draw in the screen (before the game even starts) You can load here all of your content like Textures, Vectors, 3D models, etc.

Update
Here all the logic is updated from collision to moving sprites, etc Most of the time you will be here as this is what makes the game do whatever is supposed to do.

Draw
Here all you content like player, menu, map, enemies, etc will actually get draw on the screen.

UnloadContent
Game resources are released / disposed.

First XNA game


Launch Visual Studio 2010 Template: XNA Game Studio 4.0 New Project: Windows Phone Game (4.0) Select target OS (WP 7.1) Add Content player.png Create player and position objects Change back buffer size Load player content Game logic in update Object(s) drawning in Draw Admire the result!

XNA vs Silverlight
Silverlight - event driven application and UI framework which has a lot of controls with awesome tool support for styling them.
3D graphics are supported through perspective effects using PlaneProjection transform.

Use Silverlight when:


You want a XAML based, event driven application framework. You want rapid creation of a Rich Internet Application-style user interface. You want to use Windows Phone controls. You want to embed video inside your application. You want to use an HTML web browser control.

XNA vs Silverlight
XNA uses a frame loop that's designed around game development and high performance graphical applications.
It has fast rendering which supports full 3D through Hardware Accelerated 3D API's.

Use XNA when:


You want a high performance game framework You want rapid creation of multi-screen 2D and 3D games. You want to manage art assets such as models, meshes, sprites, textures, effects, terrains, or animations in the XNA Content Pipeline.

Using XNA in Silverlight


A Silverlight application can use any XNA Framework class except classes from the following assemblies: Microsoft.Xna.Framework.Game and Microsoft.Xna.Framework.Graphics

XNA and Silverlight together

When developing applications for Windows Phone it is a common scenario to use some classes from the other framework. Using XNA in Silverlight
A Silverlight application can use any XNA Framework class except classes from the following assemblies: Microsoft.Xna.Framework.Game and Microsoft.Xna.Framework.Graphics

Using Silverlight in XNA


If you base your application on an XNA Framework template, you can still use classes from Silverlight. An XNA Framework application can use any Silverlight class except classes from the following namespaces: System.Windows, System.Windows.Application, System.Windows.Automation, System.Windows.Automation.Peers, System.Windows.Automation.Provider, System.Windows.Automation.Text, System.Windows.Browser, System.Windows.Controls, System.Windows.Media.Animation, System.Windows.Media.Effects, System.Windows.Media.Imaging, System.Windows.Media.Media3D, System.Windows.Messaging, System.Windows.Navigation, System.Windows.Printing, System.Windows.Resources, System.Windows.Shapes, System.Windows.Threading

XNA and Silverlight together


Further reading: Silverlight & XNA- A tale of two cities

Bouncing Balls
Create ball.png file
white Circle 512x512 on transparent background

Create project for Bouncing Balls Add ball.png file to the content project Set the Game to FullScreen

Bouncing Balls
Load Your Sprites Texture

Bouncing Balls
Create Ball class

Create Ball class

Bouncing Balls

Bouncing Balls
Storing the Balls
Handling Touch Events and Creating Balls

Bouncing Balls
Handling Touch Events and Creating Balls

Bouncing Balls
Drawing the balls

Bouncing Balls
Finall result

Bouncing Balls 3D

IceCream XNA 2d engine


IceCream1945 game

Windows Phone Labyrinth


Labyrinth game

XNA to SilverXNA
XNA to Silverlight integration tutorial

Q&A
??

You might also like