wp7_tpa_2_xna

Upload: damian-chmielewski

Post on 05-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 WP7_tpa_2_xna

    1/26

    TPA - Windows Phone

    XNA introduction

    Prepared by: Kamil Kowalski

  • 8/2/2019 WP7_tpa_2_xna

    2/26

    Agenda

    Basic information about XNA

    XNA endless loop

    First XNA game

    XNA vs Silverlight and using them together

    Bouncing balls

    Game examples

  • 8/2/2019 WP7_tpa_2_xna

    3/26

    XNA basic info

    XNA stands for XNA is Not an Acronym.

    It originally was for Xbox New Architecture. But instead of being releasewith that name the Xbox 360 (2005) released and XNA was change toXNA 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 360and 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 Studio2008 and 2010 (as of XNA 4.0) are officially supported.

    Games can be submitted with the AppHub membership for Xboxand Windows Phone

  • 8/2/2019 WP7_tpa_2_xna

    4/26

    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 inputcontrollers, etc.

    Extended Framework: Application model & Content Pipeline

  • 8/2/2019 WP7_tpa_2_xna

    5/26

    XNA basic info

    Application Model - is a framework (template) for anapplication.

    Each new XNA Game project already has a Game1 classwhich has a set of methods, where each has its own purpose.

    The purpose of this framework is that the developer doesn'tneed 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 refreshrate?

  • 8/2/2019 WP7_tpa_2_xna

    6/26

    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 GameStudio.

    You don't need to spend time to create your own importers.

  • 8/2/2019 WP7_tpa_2_xna

    7/26

    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

  • 8/2/2019 WP7_tpa_2_xna

    8/26

    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 issupposed 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.

  • 8/2/2019 WP7_tpa_2_xna

    9/26

    First XNA game

    Launch Visual Studio 2010

    Template: XNA Game Studio4.0

    New Project: Windows PhoneGame (4.0)

    Select target OS (WP 7.1) Add Content player.png

    Create player and positionobjects

    Change back buffer size

    Load player content Game logic in update

    Object(s) drawning in Draw

    Admire the result!

  • 8/2/2019 WP7_tpa_2_xna

    10/26

    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.

  • 8/2/2019 WP7_tpa_2_xna

    11/26

    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 thefollowing assemblies: Microsoft.Xna.Framework.Game and

    Microsoft.Xna.Framework.Graphics

  • 8/2/2019 WP7_tpa_2_xna

    12/26

    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

  • 8/2/2019 WP7_tpa_2_xna

    13/26

    XNA and Silverlight together

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

    http://xna-uk.net/blogs/darkgenesis/archive/2011/05/25/silverlight-amp-xna-a-tale-of-two-cities.aspxhttp://xna-uk.net/blogs/darkgenesis/archive/2011/05/25/silverlight-amp-xna-a-tale-of-two-cities.aspxhttp://xna-uk.net/blogs/darkgenesis/archive/2011/05/25/silverlight-amp-xna-a-tale-of-two-cities.aspxhttp://xna-uk.net/blogs/darkgenesis/archive/2011/05/25/silverlight-amp-xna-a-tale-of-two-cities.aspxhttp://xna-uk.net/blogs/darkgenesis/archive/2011/05/25/silverlight-amp-xna-a-tale-of-two-cities.aspx
  • 8/2/2019 WP7_tpa_2_xna

    14/26

  • 8/2/2019 WP7_tpa_2_xna

    15/26

    Bouncing Balls

    Load Your Sprites Texture

  • 8/2/2019 WP7_tpa_2_xna

    16/26

    Bouncing Balls

    Create Ball class

  • 8/2/2019 WP7_tpa_2_xna

    17/26

    Bouncing Balls Create Ball class

  • 8/2/2019 WP7_tpa_2_xna

    18/26

    Bouncing Balls Storing the Balls

    Handling Touch Events and Creating Balls

  • 8/2/2019 WP7_tpa_2_xna

    19/26

    Bouncing Balls

    Handling Touch Events and Creating Balls

  • 8/2/2019 WP7_tpa_2_xna

    20/26

    Bouncing Balls

    Drawing the balls

  • 8/2/2019 WP7_tpa_2_xna

    21/26

    Bouncing Balls

    Finall result

  • 8/2/2019 WP7_tpa_2_xna

    22/26

    Bouncing Balls 3D

  • 8/2/2019 WP7_tpa_2_xna

    23/26

    IceCream XNA 2d engine

    IceCream1945 game

    http://tylerforsythe.com/2012/02/learning-xna-2d-engine-icecream-with-1945-demo-project/http://tylerforsythe.com/2012/02/learning-xna-2d-engine-icecream-with-1945-demo-project/
  • 8/2/2019 WP7_tpa_2_xna

    24/26

    Windows Phone Labyrinth

    Labyrinth game

    http://www.codeproject.com/Articles/275329/Windows-Phone-Labyrinthhttp://www.codeproject.com/Articles/275329/Windows-Phone-Labyrinth
  • 8/2/2019 WP7_tpa_2_xna

    25/26

    XNA to SilverXNA

    XNA to Silverlight integration tutorial

    http://xna-uk.net/blogs/darkgenesis/archive/2011/08/21/xna-to-silverxna-part-1-an-overview.aspxhttp://xna-uk.net/blogs/darkgenesis/archive/2011/08/21/xna-to-silverxna-part-1-an-overview.aspx
  • 8/2/2019 WP7_tpa_2_xna

    26/26

    Q & A

    ??