xna and silverlight

Post on 22-Jan-2015

2.005 Views

Category:

Documents

8 Downloads

Preview:

Click to see full reader

DESCRIPTION

My slide deck from presenting to the Cleveland WPF User Group about using XNA inside Silverlight for web gaming.

TRANSCRIPT

XNA and SilverlightAaron Stanley King

XNA and Silverlight

Free game development toolkit using .NET, C#

Extends Visual Studio 2010 Including the free C#

Express Edition Version 4.0

Cross Platform Input API Enhanced Audio and Video Windows Phone 7

App Hub membership Develop and publish for

Xbox 360 or Windows Phone Unlock your phone to

development and publish to the Zune Marketplace

$99/12 months

Common Base Classes

Windows Phone 7

Silverlight XNA

Fundementals

Initialize LoadContent Update

DrawUnloadContent

The Game Loop

while (IsRunning) {

Update(); Draw();

}

The Content Pipeline

Images, fonts, wav

files, models

Importer

ProcessorCompiled Output

ScreenManager

screenManager = new ScreenManager(this);

Components.Add(screenManager);

void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e) {

ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex); }

Architectural Design (decide early if you want more than one ScreenManager)

GameScreen classes are loaded into a ScreenManager ( pretty! ) Simple transitions can be added (Bing for more) GameComponent is very useful as a base class for most parts of

your game

MSFT.XNA.FW.INPUT

GamePad Buttons ButtonState GamePadDeadZone GamePadType

Keyboard Keys KeyState

Mouse Buttons Position

MSFT.XNA.FW.INPUT.TOUCH

TouchPanel GestureType TouchLocationState

Input API

MSFT.DEVICES.SENSORS Accelerometer

SensorState

_soundEffect = Content.Load<SoundEffect>("ShotEffect");

var pan = (float)((_rnd.NextDouble() - 0.5) * 2.0);var pitch = (float)((_rnd.NextDouble() - 0.5) * 2.0); var volume = (float)((_rnd.NextDouble() / 2.0) + 0.5);

_soundEffect.Play(volume, pitch, pan);

Audio

Sorry, no transforms or storyboards Just Draw ( most powerful method in the XNA universe )

public void Draw ( Texture2D texture, Vector2 position, Nullable<Rectangle> sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth

)

Animations

SilverArcade.SilverSprite.dll SilverArcade.SilverSprite.Core.dll

A little XAML <UserControl x:Class="SilverSprite.Page"

xmlns="http://schem...resentation" xmlns:x="http://schema...xaml" Width="400" Height="300" xmlns:game="clr-namespace:Game"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas> <game:Game1 x:Name="game"/> </Canvas> </Grid> </UserControl>

Add content to your silverlight app (/Content )

Silversprite

Demo

Publish your games to Xbox LIVE Marketplace Profit!! 70%/30% baseline split Time-limited trial, no free games Charge 200, 400, or 800 points

150 MB limit for 400 and 800 point games 50 MB limit for 200 point games

You retain all rights and IP (if Microsoft invests in further marketing, they

reserve the right to take 10-30% more)

Xbox LIVE Indie Games

Publish your games to Windows Phone Marketplace

Profit!! 70%/30% baseline split Free apps are ok Charge $.99 to $499 ( no points )

225 MB limit You retain all rights and IP You can’t charge for updates. It’s not in the

Microsoft marketing strategy.

Windows Phone Marketplace

INDIE

Develop with XNA

Studio

ARCADE

Leaderboards Achievements Xbox LIVE Rich

Presence Xbox LIVE Multiplayer C++ and Native

DirectX Develop with XNA

Studio

Why not go Pro!

XNA Futures

Kinect for Windows SDK ( later this summer )

MSFT.XNA.FW.Input.You

Aaron Stanley King

Twitter -> @trendoid Gamertag -> HeraldStudios Email -> aaron@woundvision.com

Wanna play?

top related