Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
SDL Game Development

You're reading from   SDL Game Development If you're good with C++ and object oriented programming, this book utilizes your skills to create 2D games using the Simple DirectMedia Layer API. Practical tutorials include the development of two wickedly good games.

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781849696821
Length 256 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Shaun Mitchell Shaun Mitchell
Author Profile Icon Shaun Mitchell
Shaun Mitchell
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Index

A

  • abstract base classes
    • using / Using abstract base classes
  • Alien Attack game
    • sound SDL_mixer extension, using / Using the SDL_mixer extension for sound
    • basic objects, setting up / Setting up the basic game objects
    • bullets, handling / Handling bullets
    • collisions, dealing with / Dealing with collisions
    • tips / Possible improvements
  • AnimatedGraphic class / Creating the game over state, Loading the game over state

B

  • Base64 decoder / Parsing a tile layer
  • base64 encoding / Getting familiar with the Tiled application
  • basic game objects
    • setting up / Setting up the basic game objects
    • GameObject base class / GameObject revamped
    • SDLGameObject class, renaming to ShooterObject / SDLGameObject is now ShooterObject
    • player object / Player inherits from ShooterObject
    • enemy types / Lots of enemy types
    • scrolling background, adding / Adding a scrolling background
  • boolfullscreen parameter / Fullscreen SDL
  • Bullet class / No more bullets or bullet collisions
  • BulletHandler class / The BulletHandler class
  • bullet handling
    • scrolling background, adding / Handling bullets
    • types / Two types of bullets
    • BulletHandler class / The BulletHandler class

C

  • C++11 standard / GameObject revamped
  • camera-controlled map / Camera-controlled map
  • Camera class / The Camera class
  • checkCollideTile function / ShooterObject is now PlatformerObject
  • checkEnemyPlayerBulletCollision functions / Creating a CollisionManager class
  • checkPlayerEnemyCollision functions / Creating a CollisionManager class
  • clean function / What does this code do?
  • CollisionManager Class / Creating a CollisionManager class
  • collisions
    • dealing with / Dealing with collisions, Creating a CollisionManager class
    • CollisionManager Class, creating / Creating a CollisionManager class
  • CollisonManager class / No more bullets or bullet collisions
  • Conan the Caveman game
    • basic game objects, setting up / Setting up the basic game objects
    • bullet collisions / No more bullets or bullet collisions
    • game objects / Game objects and map collisions
    • map collisions / Game objects and map collisions
    • ShooterObject, renaming as PlatformerObject / ShooterObject is now PlatformerObject
    • Camera class / The Camera class
    • camera-controlled map / Camera-controlled map
    • Player class / The Player class
    • additions / Possible additions

D

  • destination rectangle
    • about / Source and destination rectangles
    • sprite sheet, animating / Animating a sprite sheet
    • images, flipping / Flipping images
  • draw function / Creating the texture manager, Putting it all together, The BulletHandler class

E

  • Enter key / Implementing FSM
  • enum attribute / Using mouse button events

F

  • FPS
    • about / Creating fixed frames per second
  • FSM
    • about / Implementing finite state machines
    • implementing / Implementing finite state machines, Implementing FSM
    • game states, base class / A base class for game states

G

  • game
    • structure / What makes up a game
    • Hello SDL code, breaking up / Breaking up the Hello SDL code
    • code, functioning / What does this code do?
  • Game**getGameHeight functions / Drawing the map
  • Game**getGameWidth / Drawing the map
  • Game**handleEvents function / Implementing FSM
  • Game**init function / Initializing joysticks, Implementing FSM
  • Game**setCurrentLevel function / Player inherits from ShooterObject
  • Game class
    • about / The Game class
    • fullscreen SDL / Fullscreen SDL
    / Using texture manager as a singleton
  • GameObject* class / Creating the game over state
  • GameObject class / Using inheritance
  • GameObject classes
    • altering / Fitting the factory into the framework
  • game objects
    • steps, sumarizing / Putting it all together
  • game objects movement
    • setting up / Setting up game objects for movement
    • Cartesian coordinate system / Setting up game objects for movement
    • vector / What is a vector?
    • Vector2D class, adding / Adding the Vector2D class
    • velocity, adding / Adding velocity
    • acceleration, adding / Adding acceleration
  • game over state
    • loading / Loading the game over state
  • GameOverState class / Creating the game over state
  • gamepad input
    • about / Handling joystick/gamepad input
  • GameState.h / A base class for game states
  • game states
    • switching ways / A simple way for switching states
  • getButtonState function / Dealing with joystick button input
  • getRenderer function / Putting it all together

H

  • Hello SDL
    • about / Hello SDL
    • overview / An overview of Hello SDL
    • initialisation flags / SDL initialization flags
    • renderer flags / SDL renderer flags

I

  • inheritance
    • about / Using inheritance
    • functionality example / Using inheritance
    • using / Should we always use inheritance?
    • result tips / Could the same thing be achieved with a simpler solution?
    • derived classes / Derived classes should model the "is a" relationship
    • possible performance penalties / Possible performance penalties
  • init function / The Game class
  • initialisation flags, SDL
    • about / SDL initialization flags
    • SDL_INIT_HAPTIC / SDL initialization flags
    • SDL_INIT_AUDIO / SDL initialization flags
    • SDL_INIT_VIDEO / SDL initialization flags
    • SDL_INIT_TIMER / SDL initialization flags
    • SDL_INIT_JOYSTICK / SDL initialization flags
    • SDL_INIT_EVERYTHING / SDL initialization flags
    • SDL_INIT_NOPARACHUTE / SDL initialization flags
  • input handling
    • about / Input handling
    • input handler class, creating / Creating our input handler class
    • joystick / Handling joystick/gamepad input
    • axis movement, handling / Listening for and handling axis movement
    • joystick button input, dealing with / Dealing with joystick button input
    • mouse events, handling / Handling mouse events
    • summary / Wrapping things up
  • Instance function / Using texture manager as a singleton
  • int flags parameter / Fullscreen SDL

J

  • joy parameter / Listening for and handling axis movement
  • joystick button input / Dealing with joystick button input
  • Joystick Control Panel property / SDL joystick events
  • joysticks
    • events / SDL joystick events
    • initializing / Initializing joysticks

L

  • Level class / Parsing and drawing a tile map
  • LevelParser**parseLevel / Dealing with collisions
  • LevelParser class
    • creating / Creating the LevelParser class
  • load function / Loading the game over state, Creating the SoundManager class

M

  • MainMenuState class / Loading the menu state from an XML file, Loading other states from an XML file
  • MenuButton class / Loading the menu state from an XML file
  • MenuState.cpp file / A base class for game states
  • menu states
    • implementing / Implementing menu states
    • fuction parameters / Function pointers and callback functions
    • callback functions / Function pointers and callback functions
    • temporary play state, implementing / Implementing the temporary play state, Pausing the game
    • game over state, creating / Creating the game over state
  • mouse events
    • handling / Handling mouse events
    • button events, handling / Using mouse button events
    • motion events, handling / Handling mouse motion events
    • keyboard input, implementing / Implementing keyboard input
  • m_bCanJump variable / The Player class
  • m_lastSafePos variable / The Player class

O

  • Object Factories
    • about / Implementing Object Factories
    • Distributed Factories, using / Using Distributed Factories
  • Object Layer / Parsing object layers
  • object layers
    • parsing / Parsing object layers
    • ObjectLayer class, developing / Developing the ObjectLayer class
  • onEnter function / Implementing FSM, Creating the game over state, Loading the game over state
  • onExit function / Implementing FSM

P

  • parseLevel function / Creating the LevelParser class, Developing the ObjectLayer class
  • parseObjects function / Parsing states from an XML file, Developing the ObjectLayer class
  • pause state
    • loading / Loading the pause state
  • PauseState.cpp file / Pausing the game
  • Player**update function / Listening for and handling axis movement, The Player class
  • Player**update function / Player inherits from ShooterObject
  • Player class / The Player class
  • playSound or playMusic functions / Creating the SoundManager class
  • play state
    • loading / Loading the play state
  • PlayState class / Creating the game over state
  • polymorphism
    • about / Implementing polymorphism
    • implementing / Implementing polymorphism
  • pState parameter / Implementing FSM

Q

  • Quadtree / Possible improvements
  • quit function / Initializing joysticks

R

  • registerType function / Using Distributed Factories
  • renderer flags, SDL
    • SDL_RENDERER_SOFTWARE / SDL renderer flags
    • SDL_RENDERER_ACCELERATED / SDL renderer flags
    • SDL_RENDERER_PRESENTVSYNC / SDL renderer flags
    • SDL_RENDERER_TARGETTEXTURE / SDL renderer flags
  • render function / A simple way for switching states, Drawing the map
  • RTF / Migrating SDL 1.2 extensions

S

  • ScrollingBackground class / Adding a scrolling background
  • SDL
    • need for / Why use SDL?
    • drawing / Basic SDL drawing
  • SDL 1.2
    • extensions / Migrating SDL 1.2 extensions
  • SDL 1.2 extensions / Migrating SDL 1.2 extensions
    • SDL_image / Migrating SDL 1.2 extensions
    • SDL_net / Migrating SDL 1.2 extensions
    • SDL_mixer / Migrating SDL 1.2 extensions
    • SDL_ttf / Migrating SDL 1.2 extensions
    • SDL_rtf / Migrating SDL 1.2 extensions
  • SDL 2.0
    • about / What is new in SDL 2.0?
    • SDL 1.2 extensions / Migrating SDL 1.2 extensions
  • SDL 2.0 Roadmap / What is new in SDL 2.0?
  • SDL drawing
    • about / Basic SDL drawing
    • images, obtaining / Getting some images
    • texture, creating / Creating an SDL texture
  • SDL joystick events
    • SDL_JoyAxisEvent / SDL joystick events
    • SDL_JoyButtonEvent / SDL joystick events
    • SDL_JoyBallEvent / SDL joystick events
    • SDL_JoyHatEvent / SDL joystick events
    • about / SDL joystick events
  • SDL Mouse Event
    • SDL_MouseButtonEvent / Handling mouse events
    • SDL_MouseMotionEvent / Handling mouse events
    • SDL_MouseWheelEvent / Handling mouse events
  • SDL setup, in Visual C++ Express 2010
    • about / Setting up SDL in Visual C++ Express 2010
    • library, retrieving / Setting up SDL in Visual C++ Express 2010
    • Mercurial, using / Using Mercurial to get SDL 2.0 on Windows
    • SDL 2.0 repository, cloning / Cloning and building the latest SDL 2.0 repository
    • SDL 2.0 repository, building / Cloning and building the latest SDL 2.0 repository
    • linking / I have the library; now what?
  • SDL_CreateRenderer function / An overview of Hello SDL
  • SDL_CreateWindow function / Fullscreen SDL
  • SDL_image
    • installing / Installing SDL_image
    • using / Using SDL_image
  • SDL_INIT_AUDIO flag / SDL initialization flags
  • SDL_INIT_EVERYTHING flag / SDL initialization flags
  • SDL_INIT_HAPTIC flag / SDL initialization flags
  • SDL_INIT_JOYSTICK flag / SDL initialization flags
  • SDL_INIT_NOPARACHUTE flag / SDL initialization flags
  • SDL_INIT_TIMER flag / SDL initialization flags
  • SDL_INIT_VIDEO flag / SDL initialization flags
  • SDL_JOYAXISMOTION event / Listening for and handling axis movement
  • SDL_JoyBallEvent / SDL joystick events
  • SDL_JoyButtonEvent / SDL joystick events
  • SDL_JoyHatEvent / SDL joystick events
  • SDL_MouseButtonEvent / Handling mouse events
  • SDL_MouseMotionEvent / Handling mouse events
  • SDL_MouseWheelEvent / Handling mouse events
  • SDL_RendererFlip value
    • SDL_FLIP_NONE / Flipping images
    • SDL_FLIP_HORIZONTAL / Flipping images
    • SDL_FLIP_VERTICAL / Flipping images
  • SDL_RENDERER_ACCELERATED flag / SDL renderer flags
  • SDL_RENDERER_PRESENTVSYNC flag / SDL renderer flags
  • SDL_RENDERER_SOFTWARE flag / SDL renderer flags
  • SDL_RENDERER_TARGETTEXTURE flag / SDL renderer flags
  • SDL_WasInit() function / SDL initialization flags
  • SDL_WindowFlags function / Fullscreen SDL
  • SDL_WindowFlags functions
    • SDL_WINDOW_FULLSCREEN / Fullscreen SDL
    • SDL_WINDOW_OPENGL / Fullscreen SDL
    • SDL_WINDOW_SHOWN / Fullscreen SDL
    • SDL_WINDOW_HIDDEN / Fullscreen SDL
    • SDL_WINDOW_BORDERLESS / Fullscreen SDL
    • SDL_WINDOW_RESIZABLE / Fullscreen SDL
    • SDL_WINDOW_MINIMIZED / Fullscreen SDL
    • SDL_WINDOW_MAXIMIZED / Fullscreen SDL
    • SDL_WINDOW_INPUT_GRABBED / Fullscreen SDL
    • SDL_WINDOW_INPUT_FOCUS / Fullscreen SDL
    • SDL_WINDOW_MOUSE_FOCUS / Fullscreen SDL
    • SDL_WINDOW_FOREIGN / Fullscreen SDL
  • SDL_WINDOW_BORDERLESS function / Fullscreen SDL
  • SDL_WINDOW_FOREIGN function / Fullscreen SDL
  • SDL_WINDOW_FULLSCREEN flag / Fullscreen SDL
  • SDL_WINDOW_FULLSCREEN function / Fullscreen SDL
  • SDL_WINDOW_HIDDEN function / Fullscreen SDL
  • SDL_WINDOW_INPUT_FOCUS function / Fullscreen SDL
  • SDL_WINDOW_INPUT_GRABBED function / Fullscreen SDL
  • SDL_WINDOW_MAXIMIZED function / Fullscreen SDL
  • SDL_WINDOW_MINIMIZED function / Fullscreen SDL
  • SDL_WINDOW_MOUSE_FOCUS function / Fullscreen SDL
  • SDL_WINDOW_OPENGL function / Fullscreen SDL
  • SDL_WINDOW_RESIZABLE function / Fullscreen SDL
  • SDL_WINDOW_SHOWN function / Fullscreen SDL
  • setCallbacks function / Loading the pause state
  • SoundManager class / Creating the SoundManager class
  • sound SDL_mixer extension
    • using / Using the SDL_mixer extension for sound
    • SoundManager class, creating / Creating the SoundManager class
  • source rectangle
    • about / Source and destination rectangles
    • sprite sheet, animating / Animating a sprite sheet
    • images, flipping / Flipping images
  • states, XML file
    • parsing / Parsing states from an XML file
    • menu state, loading / Loading the menu state from an XML file
    • play state, loading / Loading the play state
    • pause state, loading / Loading the pause state
    • game over state, loading / Loading the game over state

T

  • texture manager
    • about / Creating the texture manager
    • creating / Creating the texture manager
    • using, as singleton / Using texture manager as a singleton
  • TextureManager class / Creating the texture manager
  • Tiled application
    • about / Getting familiar with the Tiled application
  • tile layer
    • parsing / Parsing a tile layer
  • TileLayer class / Camera-controlled map
  • TileLayer update function / Drawing the map
  • tile map
    • about / What is a tile map?
    • parsing / Parsing and drawing a tile map
    • drawing / Parsing and drawing a tile map, Drawing the map
    • TileLayer class, creating / Creating the TileLayer class
    • LevelParser class, creating / Creating the LevelParser class
    • tilesets, parsing / Parsing tilesets
    • tile layer, parsing / Parsing a tile layer
    • scrolling / Scrolling a tile map
  • tilesets
    • parsing / Parsing tilesets
  • TortoiseHg Workbench window / Cloning and building the latest SDL 2.0 repository
  • type function / Creating a CollisionManager class

U

  • uncompress function / Parsing a tile layer
  • update function / Creating the texture manager, Function pointers and callback functions, Creating the game over state, The BulletHandler class

V

  • vector
    • about / What is a vector?
    • using / What is a vector?
    • two vectors, adding / Addition of two vectors
    • muliplying, by scalar number / Multiply by a scalar number
    • subtration methods / Subtraction of two vectors
    • sclar number, dividing by / Divide by a scalar number
    • normalizing / Normalizing a vector
  • Visual C++ Express 2010
    • SDL, setting up / Setting up SDL in Visual C++ Express 2010

X

  • Xbox 360 controller / SDL joystick events
  • XML file
    • states, parsing / Parsing states from an XML file
    • menu state, loading / Loading the menu state from an XML file
    • other states, loading / Loading other states from an XML file
  • XML Files
    • about / Loading XML files
    • basic XML structure / Basic XML structure

Z

  • zlib compression algorithm / Getting familiar with the Tiled application
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image