- Learning Windows 8 Game Development
- Michael Quandt
- 340字
- 2021-07-23 15:36:04
Chapter 2. Drawing 2D Sprites
Some newer independent games make use of only audio or other feedback systems to convey the game state to he player; however, most games still use the tried and true method of showing the game to the user through a graphical representation. To really get started, we need to be able to put something onto the screen for the player. In this chapter we will do just that. We'll look at how to load the images from files on disk, and then display them on the screen, in 2D through a 3D API.
One of the best things you can do to make your life easier when writing code is rely on the efforts of others before you. Many thousands of people have written 2D rendering algorithms before this book was even written, and their learnings and efforts should not be wasted by scrapping all of that information and starting from scratch. Microsoft provides an open source library that tries to collect this information and give you a head start in developing your game. DirectXTK is a small library designed to do all of these common tasks for you. We'll be using this to simplify the task of loading textures from disk, rendering them onto the screen, and working with fonts to display some text on the screen.
Through the course of this chapter we will add the ability to draw images and text. We'll start by learning how to load in textures and draw them to the screen using DirectXTK. After that, we will look at text rendering and how to add that functionality to the game for future use. By the end of the chapter, you should have some images and text on screen, ready for gameplay.
In this chapter you will:
- Download and build DirectXTK
- Learn about sprites and textures
- Understand co-ordinate spaces and projections
- Learn about texture formats
- Discover how to load textures
- Draw some sprites to the screen
- Learn about text rendering
- Render some text to the screen
- 微商之道
- Hands-On Industrial Internet of Things
- Django 2 by Example
- JBoss EAP6 High Availability
- PLC、現場總線及工業網絡實用技術速成
- Yii Application Development Cookbook(Second Edition)
- Spring 5.0 Projects
- 從實踐中學習手機抓包與數據分析
- RestKit for iOS
- 物聯網,So Easy!
- Cisco無線局域網配置基礎
- React Design Patterns and Best Practices(Second Edition)
- 物聯網傳感器技術與應用
- 視聽變革:廣電的新媒體戰略
- 互聯網戰略變革與未來