Зарегистрироваться
Восстановить пароль
FAQ по входу

Horton J. Beginning C++ Game Programming

  • Файл формата pdf
  • размером 5,96 МБ
  • Добавлен пользователем
  • Описание отредактировано
Horton J. Beginning C++ Game Programming
Packt, 2019. — 746 p.
This book is perfect for you if any of the following describes you: You have no C++ programming knowledge whatsoever or need a beginner level refresher course, if you want to learn to build games or just use games as an engaging way to learn C++, if you have aspirations to publish a game one day, perhaps on Steam, or if you just want to have loads of fun and impress friends with your creations.
What You Will Learn
Get to know C++ from scratch while simultaneously learning game building
Learn the basics of C++, such as variables, loops, and functions to animate game objects, respond to collisions, keep score, play sound effects, and build your first playable game.
Use more advanced C++ topics such as classes, inheritance, and references to spawn and control thousands of enemies, shoot with a rapid fire machine gun, and realize random scrolling game-worlds
Stretch your C++ knowledge beyond the beginner level and use concepts such as pointers, references, and the Standard Template Library to add features like split-screen coop, immersive directional sound, and custom levels loaded from level-design files
Get ready to go and build your own unique games!
The games we will build
Pong
Zombie Arena
Space Invaders ++
Meet C++
SFML
What about Mac and Linux?
Installing Visual Studio Community edition
Setting up SFML
Creating a new project
Configuring the project properties
Planning Timber!
Making your own sound FX
Exploring the assets
Understanding screen and internal coordinates
Making code clearer with comments
Presentation and syntax
Returning values from a function
Opening a window using SFML
#including SFML features
OOP, classes, and objects
Using namespace sf
SFML VideoMode and RenderWindow
The main game loop
C-style code comments
Detecting a key press
Drawing the game's background
Preparing the Sprite using a Texture
Double buffering the background sprite
Handling errors
Link errors
FAQ
C++ variables
Types of variables
Declaring variables
Constants
Declaring and initializing user-defined types
C++ arithmetic and assignment operators
Getting things done with expressions
Preparing the tree
Preparing the bee
Preparing the clouds
Drawing the tree, the bee, and the clouds
Generating random numbers in C++
Logical operators
Shoot them … or else do this instead
Reader challenge
The frame rate problem
The SFML frame rate solution
Giving life to the bee
Blowing the clouds
FAQ
Pausing and restarting the game
Declaring Strings
Manipulating Strings
SFML's Text and Font classes
Implementing the HUD
Adding a time-bar
FAQ
Loops, Arrays, Switch, Enumerations, and Functions – Implementing Game Mechanics
while loops
Breaking out of a while loop
for loops
Arrays
Initializing the elements of an array
What do these arrays really do for our games?
Making decisions with switch
Class enumerations
Getting started with functions
Function return types
Function names
The function body
Function prototypes
Function gotcha!
An absolute final word on functions – for now
Growing the branches
Preparing the branches
Updating the branch sprites each frame
Drawing the branches
Moving the branches
FAQ
Preparing the player (and other sprites)
Drawing the player and other sprites
Handling the player's input
Handling setting up a new game
Detecting the player chopping
Detecting a key being released
Animating the chopped logs and the axe
Handling death
How SFML sound works
Adding the sound code
Improving the game and the code
FAQ
OOP
Encapsulation
Why use OOP?
What exactly is a class?
The class variable and function declarations
The class function definitions
Using an instance of a class
Creating the Pong project
Coding Bath
Continuing with the Bath explanation
Coding Batcpp
Using the Bat class and coding the main function
FAQ
Coding the Ball class
Using the Ball class
Collision detection and scoring
FAQ
SFML Views – Starting the Zombie Shooter Game
Planning and starting the Zombie Arena game
Creating a new project
The project assets
Exploring the assets
OOP and the Zombie Arena project
Building the player – the first class
Coding the Player class header file
Coding the Player class function definitions
Controlling the game camera with SFML View
Starting the Zombie Arena game engine
Managing the code files
Starting to code the main game loop
FAQ
C++ References, Sprite Sheets, and Vertex Arrays
C++ references
References summary
What is a sprite sheet?
What is a vertex array?
Building a vertex array
Using the vertex array to draw
Creating a randomly generated scrolling background
Using the background
FAQ
Pointers, the Standard Template Library, and Texture Management
Learning about Pointers
Pointer syntax
Declaring a pointer
Initializing a pointer
Dereferencing a pointer
Dynamically allocated memory
Passing a pointer to a function
Declaring and using a pointer to an object
Pointers and arrays
The Standard Template Library
What is a map?
Finding data in a map
Checking for keys in a map
Looping/iterating through the key-value pairs of a map
The TextureHolder class
Coding the TextureHolder header file
Coding the TextureHolder function definitions
Building a horde of zombies
Coding the Zombieh file
Coding the Zombiecpp file
Using the Zombie class to create a horde
Bringing the horde to life (back to life)
Changing the way the background gets its textures
Changing the way the Player gets its texture
FAQ
Collision Detection, Pickups, and Bullets
Coding the Bullet header file
Coding the Bullet source file
Including the Bullet class
Reloading the gun
Shooting a bullet
Updating the bullets each frame
Drawing the bullets each frame
Giving the player a crosshair
Coding the Pickup header file
Coding the Pickup class function definitions
Using the Pickup class
Detecting collisions
Has a zombie been shot?
Has the player been touched by a zombie?
Has the player touched a pickup?
FAQ
Adding all the Text and HUD objects
Updating the HUD
Drawing the HUD, home, and level-up screens
FAQ
Saving and loading the high score
Preparing sound effects
Leveling up
Playing the rest of the sounds
Making a shooting sound
Playing a sound when the player is hit
Playing a sound when getting a pickup
Making a splat sound when a zombie is shot
FAQ
Abstraction and Code Management – Making Better Use of OOP
Features of Thomas Was Late
Creating the project
Game level designs
The sound assets close up
Adding the assets to the project
Structuring the Thomas Was Late code
Reusing the TextureHolder class
Coding Engineh
Coding the Engine class constructor definition
Coding the run function definition
Coding the input function definition
Coding the update function definition
Coding the draw function definition
The Engine class so far
Coding the main function
FAQ
Inheritance
Extending a class
Polymorphism
Abstract classes – virtual and pure virtual functions
Building the PlayableCharacter class
Coding PlayableCharacterh
Coding PlayableCharactercpp
Building the Thomas and Bob classes
Coding Thomascpp
Coding Bobh
Coding Bobcpp
Updating Engineh to add an instance of Bob and Thomas
Updating the input function to control Thomas and Bob
Updating the update function to spawn and update the PlayableCharacter instances
Spawning Thomas and Bob
Updating Thomas and Bob each frame
Drawing Bob and Thomas
FAQ
Building Playable Levels and Collision Detection
Designing some levels
Building the LevelManager class
Coding LevelManagerh
Coding the LevelManagercpp file
Coding the loadLevel function
Updating the engine
Coding the detectCollisions function
More collision detection
What is spatialization?
Handling spatialization using SFML
Coding SoundManagerh
Coding the constructor
Coding the playFire function
Coding the rest of the SoundManager functions
Adding SoundManager to the game engine
Populating the sound emitters
Coding the populateEmitters function
Playing sounds
Coding HUDh
Coding the HUDcpp file
Using the HUD class
Building a particle system
Coding Particleh
Coding the Particlecpp file
Exploring SFML's Drawable class and OOP
An alternative to inheriting from Drawable
Coding ParticleSystemh
Coding the ParticleSystemcpp file
Adding a ParticleSystem object to the Engine class
Initializing ParticleSystem
Starting the particle system
Drawing the particle system
OpenGL, Shaders, and GLSL
The programmable pipeline and shaders
Coding a fragment shader
Coding a vertex shader
Loading the shaders
Updating and drawing the shader
Game Programming Design Patterns – Starting the Space Invaders ++ Game
Space Invaders ++
Why Space Invaders ++?
Design patterns
Screen, InputHandler, UIPanel, and Button
Why lots of diverse object types are hard to manage
Using a generic GameObject for better code structure
Prefer composition over inheritance
Factory pattern
Shared pointers
Unique pointers
Casting smart pointers
C++ assertions
Creating the Space Invaders ++ project
Organizing code files with filters
Coding SpaceInvaders ++cpp
Coding the GameEngine class
Coding the SoundEngine class
Coding the ScreenManager class
Coding the BitmapStore class
Coding the ScreenManagerRemoteControl class
Where are we now?
Coding the Button class
Coding the UIPanel class
Coding the InputHandler class
Coding the Screen class
Adding the WorldStateh file
Coding the SelectScreen class
Coding the SelectInputHandler class
Coding the SelectUIPanel class
Coding the GameScreen class
Coding the GameInputHandler class
Coding the GameUIPanel class
Coding the GameOverInputHandler class
Coding the GameOverUIPanel class
Running the game
Game Objects and Components
Coding the Component base class
Coding the collider components
Coding the ColliderComponent class
Coding the RectColliderComponent class
Coding the GraphicsComponent class
Coding the StandardGraphicsComponent class
Coding the TransformComponent class
Coding the UpdateComponent class
Coding the BulletUpdateComponent class
Coding the InvaderUpdateComponent class
Explaining the update function
Explaining the dropDownAndReverse function
Coding the PlayerUpdateComponent class
Coding the GameObject class
Explaining the update function
Explaining the draw function
Explaining the addComponent function
Explaining the getter and setter functions
Explaining the getComponentByTypeAndSpecificType function
Explaining the getEncompassingRectCollider function
Explaining the final getter functions
File I/O and the Game
Object Factory
The structure of the file I/O and factory classes
Describing an object in the world
Coding the GameObjectBlueprint class
Coding the ObjectTags class
Coding the BlueprintObjectParser class
Coding the PlayModeObjectLoader class
Coding the GameObjectFactoryPlayMode class
Coding the GameObjectSharer class
Coding the LevelManager class
Updating the ScreenManager and ScreenManagerRemoteControl classes
Where are we now?
Using Game Objects and Building a Game
Coding the BulletSpawner class
Updating GameScreenh
Handling the player's input
Using a gamepad
Coding the PhysicsEnginePlayMode class
Making the game
Understanding the flow of execution and debugging
Reusing the code to make a different game and building a design mode
Before You Go
Thanks!
Other Books You May Enjoy
  • Чтобы скачать этот файл зарегистрируйтесь и/или войдите на сайт используя форму сверху.
  • Регистрация