Skip to Main Content
Learning XNA 3.0
book

Learning XNA 3.0

by Aaron Reed
November 2008
Beginner content levelBeginner
510 pages
16h 24m
English
O'Reilly Media, Inc.
Content preview from Learning XNA 3.0

Adding a Sprite to Your Project

All right, I said no more talk, and this time I'm serious. Let's get to it. Your project thus far has been fairly boring. Now, let's draw an image on the screen in your game.

All graphics, sounds, effects, and other items are loaded in XNA through something called the content pipeline. Essentially, the content pipeline takes things such as .jpg files, .bmp files, .png files, and other formats and converts them during compilation to an internal format that's friendly to XNA. It also does similar things with other types of resources, such as sound files, 3D models, fonts, etc., which will be explored later in this book. A great benefit of the XNA Framework is that it takes a lot of the guesswork out of importing different file types. If you put an image file into your game and the content pipeline is able to recognize it during compilation, you don't have to worry about the format of the image. (We'll talk more about the content pipeline in later chapters.)

Download the source code for this chapter and place it somewhere on your PC's hard drive. You'll need to do this so that you can access the images that you'll be adding to your project throughout the rest of this chapter.

Open Visual Studio's Solution Explorer and take a look at your project. You'll see a Content node, through which all resources (images, sounds, models, etc.) will be added to your project. Because I'm an organization-junkie, I recommend creating a subfolder within the Content node ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning XNA 4.0

Learning XNA 4.0

Aaron Reed
Beginning C# 7 Programming with Visual Studio 2017

Beginning C# 7 Programming with Visual Studio 2017

Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid

Publisher Resources

ISBN: 9780596154905Supplemental ContentErrata Page