1 / 9

Fundamentals of 2D Drawing: Coordinate Systems and Sprite Management in XNA

This course module offers an overview of the basics of 2D drawing, focusing on two-dimensional coordinate systems and sprite management using XNA. It covers the essential concepts of coordinate systems, including Cartesian and Polar coordinates, as well as the types of raster images like PPM, GIF, JPEG, and PNG. The module explains how to work with sprites in XNA using the SpriteBatch class, including methods for beginning a drawing session, specifying sprites, and finalizing the drawing. This foundational knowledge is crucial for game development and graphical applications.

Télécharger la présentation

Fundamentals of 2D Drawing: Coordinate Systems and Sprite Management in XNA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2D drawing basics For CSE 3902 By: Matt Boggus

  2. Overview • 2D coordinate systems • Raster images • Sprite drawing in XNA

  3. Coordinate system • A coordinate system is a system which uses one or more numbers, or coordinates, to uniquely determine the position of a point • For a 2D coordinate system, we need • Origin • 2-Tuple of position relative to the origin

  4. 2D coordinate system examples Cartesian Coordinates (http://en.wikipedia.org/wiki/File:Cartesian-coordinate-system.svg) Polar Coordinates (http://en.wikipedia.org/wiki/File:CircularCoordinates.svg)

  5. XNA’s coordinate system

  6. Raster images http://en.wikipedia.org/wiki/File:Rgb-raster-image.svg

  7. Raster image types • PPM • Uncompressed, human readable • GIF • 8 bits per pixel per channel (RGB) • JPEG • Lossy data compression • PNG • Lossless data compression

  8. Sprite drawing in XNA • SpriteBatch object • Begin (call once to start specifying sprites to draw) • Draw (each call specifies another sprite to draw) • End (call once to finish specifying sprites to draw)

  9. SpriteBatch Draw methods Example Image File / Texture2D public void Draw ( Texture2D texture, Rectangle destinationRectangle, Color color ) public void Draw ( Texture2D texture, Rectangle destinationRectangle, Nullable<Rectangle> sourceRectangle, Color color ) Drawing window XNA rectangle object

More Related