找传奇、传世资源到传世资源站!

sdl game development.pdf

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

用c 和sdl游戏库开发游戏的教程from clipboardTable of ContentsPreface 1Chapter 1: Getting Started with SDL 5Why use SDL? 6What is new in SDL 2.0? 6Migrating SDL 1.2 extensions 7Setting up SDL in Visual C Express 2010 8Using Mercurial to get SDL 2.0 on Windows 8Cloning and building the latest SDL 2.0 repository 8I have the library; now what? 10Hello SDL 13An overview of Hello SDL 14SDL initialization flags 16SDL renderer flags 17What makes up a game 17Breaking up the Hello SDL code 18What does this code do? 20The Game class 21Fullscreen SDL 26Summary 28Chapter 2: Drawing in SDL 29Basic SDL drawing 29Getting some images 29Creating an SDL texture 30Source and destination rectangles 32Animating a sprite sheet 35Flipping images 37Installing SDL_image 38Using SDL_image 40Table of Contents[ ii ]Tying it into the framework 42Creating the texture manager 42Using texture manager as a singleton 46Summary 47Chapter 3: Working with Game Objects 49Using inheritance 49Implementing polymorphism 55Using abstract base classes 60Should we always use inheritance? 61Could the same thing be achieved with a simpler solution? 61Derived classes should model the "is a" relationship 61Possible performance penalties 62Putting it all together 62Summary 67Chapter 4: Exploring Movement and Input Handling 69Setting up game objects for movement 70What is a vector? 70Some common operations 72Addition of two vectors 72Multiply by a scalar number 73Subtraction of two vectors 73Divide by a scalar number 74Normalizing a vector 74Adding the Vector2D class 75Adding velocity 76Adding acceleration 77Creating fixed frames per second 77Input handling 79Creating our input handler class 79Handling joystick/gamepad input 80SDL joystick events 80Initializing joysticks 81Listening for and handling axis movement 84Dealing with joystick button input 91Handling mouse events 93Using mouse button events 93Handling mouse motion events 95Implementing keyboard input 96Wrapping things up 98Summary 100Table of Contents[ iii ]Chapter 5: Handling Game States 101A simple way for switching states 101Implementing finite state machines 103A base class for game states 103Implementing FSM 106Implementing menu states 110Function pointers and callback functions 114Implementing the temporary play state 117Pausing the game 120Creating the game over state 123Summary 130Chapter 6: Data-driven Design 131Loading XML files 131Basic XML structure 132Implementing Object Factories 134Using Distributed Factories 135Fitting the factory into the framework 138Parsing states from an XML file 140Loading the menu state from an XML file 147Loading other states from an XML file 150Loading the play state 150Loading the pause state 152Loading the game over state 153Summary 155Chapter 7: Creating and Displaying Tile Maps 157What is a tile map? 158Getting familiar with the Tiled application 160Parsing and drawing a tile map 165Creating the TileLayer class 167Creating the LevelParser class 168Parsing tilesets 170Parsing a tile layer 171Drawing the map 175Scrolling a tile map 180Parsing object layers 182Developing the ObjectLayer class 184Summary 189Table of Contents[ iv ]Chapter 8: Creating Alien Attack 191Using the SDL_mixer extension for sound 193Creating the SoundManager class 193Setting up the basic game objects 196GameObject revamped 196SDLGameObject is now ShooterObject 199Player inherits from ShooterObject 200Lots of enemy types 204Adding a scrolling background 205Handling bullets 207Two types of bullets 207The BulletHandler class 209Dealing with collisions 211Creating a CollisionManager class 214Possible improvements 216Summary 216Chapter 9: Creating Conan the Caveman 217Setting up the basic game objects 218No more bullets or bullet collisions 218Game objects and map collisions 219ShooterObject is now PlatformerObject 219The Camera class 222Camera-controlled map 224The Player class 225Possible additions 231Summary 231Index 233

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复