XNa advanced programming: Xbox 360 and Windows 3-1

Source: Internet
Author: User

 

Chapter 3 auxiliary classes

3.1 Overview of this Chapter

I usually put a lot of useful gadgets and classes in oneHelperIn namespaces, they will become very useful slowly. For a single project, they may not be the most important or usefulCodeBut because they are used repeatedly, no matter whether the rest of the engine changes, the helper class is always the most stable part of the engine or project. Most of the helper classes do not have much to do with game programming. They can be used in other projects or evenWebApplication.

as you can see in the previous chapter, you can write a complete game without any helper classes or any additional files or classes. However, as the project grows, you will find that a large number of repetitive models and similar problems that have been solved in the past will reappear. Generally, in xNa most of the features repeatedly used are graphic components ( graphic component ), in the next chapter and the second part of this book, you will learn more about game components and graphics engines. This chapter focuses on the most basic functions, such as logging messages ( Log message ), access the game content ( game content ). unit tests, how to generate random numbers, and many other small issues.

to make the content of this chapter more interesting, you will also create another mini-game, purely for fun. Although not all helper classes are used, building a game engine is not a simple task. Therefore, this chapter and the next chapter will begin with the design of auxiliary classes and game components, so that it is easier to develop your own graphics engine in the second part. Please note that I did not write the helper classes in the way they are presented in this chapter; they evolved over the course of the past couple of years . just add functionally or your own helper classes whenever you need them . After you solve a problem, you feel that it will not be used again, so you don't have to worry about it anymore. However, when you find that you want to copy some function code to a new project or another class, and it will be copied many times, you should consider extracting the processing logic into a special class.

In addition, you will also learn more about the content pipelines used in the previous chapters to support Xbox 360 . You can directly load Texture and shader instead of using a content pipeline, you can only Windows This is done on the platform. If you want to create a cross-platform game, make sure that the Windows and Xbox 360 all things on can be compiled and work properly. You will always do this in this book.

At the end of this chapter, you will quickly developBreakoutThe clone version of the game, and because you write all the helper classes first, it is much easier to implement it than in the previous chapters. For exampleSpritehelperClass to renderSpriteIt will be very simple. In the next chapter, you will see more improvementsPongAndBreakoutGame aids and game components.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.