用c 和sdl游戏库开发游戏的教程Table 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
下载sdl game development.pdf用户还喜欢
- 18480 文章数
- 500万+ 热度
作者专栏
编辑推荐
- 淡抹u2引擎,修复内容较多,物有所值
- 界域传说·经典巨作=传世单机(一键安装)
- 丸子版本(175个传世版本大集合)
- GS版本:神话公益服务端+客户端
- 图片放大工具(放大图片不模糊)
- 剪映无限制VIP版
- 传奇世界客户端下载器,史上最全传世客户端
- 传世GS20220920商业引擎注册+登录配置器 解压密码是1
- U2官方排行榜游戏网关 支持元神,支持传家宝
- GS开战传世客户端+服务端
- (淡漠夕阳)u2引擎合区工具
- 传世GS引擎消除“你的游戏客户端版本号过旧,请及时更新”提示
- 传世一机多区双线路配置器--免密码版本
- 传世凤凰登陆器劫持修复软件
- SQLite3 for Navicat
- 传奇世界npc对话框编辑工具
- 传世GS落霞铭文服务器端
- gs_20210409引擎包+注册机(无限制)
- 传奇世界NPC对话封包查看器[支持时长版和极速版]
- 彩虹引擎传世脚本编辑工具1.7版来了,支持函数脚本翻译
评论