XNA and C# XNA Why? Project management Visual Studio 2010 - - PowerPoint PPT Presentation

▶
xna and c
SMART_READER_LITE
LIVE PREVIEW

XNA and C# XNA Why? Project management Visual Studio 2010 - - PowerPoint PPT Presentation

XNA and C# XNA Why? Project management Visual Studio 2010 Framework Libraries Content resource management Input handling 2D sprite handling 3D Framework Your game derives from a class Game


slide-1
SLIDE 1

XNA and C#

slide-2
SLIDE 2

XNA – Why?

  • Project management – Visual Studio 2010
  • Framework
  • Libraries
  • Content resource management
  • Input handling
  • 2D sprite handling
  • 3D
slide-3
SLIDE 3

Framework

  • Your game derives from a class Game
  • Initialization:

– Constructor, Initialize and LoadContent methods

  • Game loop

– Manages time – Update

  • Poll the input devices that interest you
  • Update your game state

– Draw

  • Display whatever the user should see
  • [Create a default game.]
slide-4
SLIDE 4

Content resource management

  • Sprites are loaded from image files
  • What kind of file?
  • XNA allows a wide variety of graphic file types.

–

.bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga

–

(not .xcf, gimp's default type)

–

You don't have to know the internal file formats.

–

All can be loaded with the same function call.

  • [Load sprites of different file types.]
slide-5
SLIDE 5

Drawing: Sprites

  • Draw method

– 7 (?) Overloads – Allows you to:

  • Position the sprite on the screen
  • Resize
  • Rotate
  • Color
  • Display only part
  • Specify layering
  • [Display the sprites we loaded]
slide-6
SLIDE 6

Update

  • Get input

– KeyboardState

  • KeyState

– MouseState

  • Update the “state” of your game objects
  • [Move the sprites around]
slide-7
SLIDE 7

XNA Class Summary

  • Texture2D
  • Keyboard, KeyboardState, Keys
  • Mouse, MouseState
  • Content

–

Load<>

  • SpriteBatch

–

Draw, Drawstring

  • SpriteFont

–

Methods: MeasureString

  • Vector2

–

Fields / properties: X, Y, Zero,

  • MathHelper