C++ Game Programming: Learn game programming with C++ step by step very easy
by am moh
- Length: 549 pages
- Edition: 1
- Language: English
- Publication Date: 2022-01-18
- ISBN-10: B09QQRZPR6
- ISBN-13: 9798404934151
- Sales Rank: #0 (See Top 100 Books)
Learn game programming with C++ step by step very easy for beginners
What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions 1. C++, SFML, Visual Studio, and Starting the First Game The games Timber!!! Zombie Arena Thomas was Late Meet C++ Microsoft Visual Studio SFML Setting up the development environment What about Mac and Linux? Installing Visual Studio Express 2015 on your desktop Setting up SFML Creating a reusable project template Planning Timber!!! Creating a project from the template Project assets Outsourcing assets Making your own sound FX Adding assets to the project Exploring assets Understanding screen and internal coordinates Starting to code the game Making code clearer with comments #including Windows essentials The main function Presentation and syntax Returning values from a function Running the game Opening a window using SFML #including SFML features OOP, classes, objects Using namespace sf SFML VideoMode and RenderWindow Running the game The main game loop While loops C-style code comments Input, update, draw, repeat Detecting a key press Clearing and drawing the scene Running the game Drawing the game background Preparing the sprite using a texture Double-buffering the background sprite Running the game Handling errors Configuration errors Compile errors Link errors Bugs FAQ Summary 2. Variables, Operators, and Decisions – Animating Sprites C++ variables Types of variable Constants User-defined types Declaring and initializing variables Declaring variables Initializing variables Declaring and initializing in one step Declaring and initializing user-defined types Manipulating variables C++ arithmetic and assignment operators Getting things done with expressions Adding clouds, a tree, and a buzzing bee Preparing the tree Preparing the bee Preparing the clouds Drawing the tree, the bee, and the clouds Random numbers Generating random numbers in C++ Making decisions with if and else Logical operators C++ if and else If they come over the bridge, shoot them! Or do this instead Reader challenge Timing The frame-rate problem The SFML frame-rate solution Moving the clouds and the bee Giving life to the bee Blowing the clouds FAQ Summary 3. C++ Strings, SFML Time, Player Input, and HUD Pausing and restarting the game C++ strings Declaring strings Assigning a value to strings Manipulating strings SFML Text and Font Adding a score and a message Adding a time bar FAQ Summary 4. Loops, Arrays, Switch, Enumerations, and Functions – Implementing Game Mechanics Loops while loops Breaking out of a while loop for loops Arrays Declaring an array Initializing the elements of an array Quickly initializing the elements of an array So what do these arrays really do for our games? Making decisions with switch Class enumerations Getting started with functions Function return types Function names Function parameters The function body Function prototypes Organizing functions Function gotcha! Final word on functions - for now 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 Summary 5. Collisions, Sound, and End Conditions – Making the Game Playable 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 ax Handling death Simple sound FX How SFML sound works? When to play the sounds Adding the sound code Improving the game and the code FAQ Summary 6. Object-Oriented Programming, Classes, and SFML Views Planning and starting the Zombie Arena game Creating a project from the template The project assets Exploring the assets Adding the assets to the project OOP What is OOP? Encapsulation Polymorphism Inheritance Why do it like this? What is a class? The class variable and function declarations The class function definitions Using an instance of a class Constructors and getter functions Jumping around in the code 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 coding the main game loop FAQ Summary 7. C++ References, Sprite Sheets, and Vertex Arrays C++ References References summary SFML vertex arrays and sprite sheets What is a sprite sheet? What is a vertex array? Building a background from tiles Building a vertex array Using the vertex array to draw Creating a randomly generated scrolling background Using the background FAQ Summary 8. Pointers, the Standard Template Library, and Texture Management Pointers Pointer syntax Declaring a pointer Initializing a pointer Reinitializing pointers Dereferencing a pointer Pointers are versatile and powerful Dynamically allocated memory Passing a pointer to a function Declaring and using a pointer to an object Pointers and arrays Summary of pointers The Standard Template Library What is a Map Declaring a Map Adding data to a Map Finding data in a Map Removing data from a Map Checking the size of a Map Checking for keys in a Map Looping/iterating through the key-value pairs of a Map The auto keyword STL summary The TextureHolder Class Coding the TextureHolder header file Coding the TextureHolder function definitions What exactly have we achieved with TextureHolder? Building a horde of zombies Coding the Zombie.h file Coding the Zombie.cpp file Using the Zombie class to create a horde Bringing the horde to life (back to life) Using the TextureHolder class for all textures Change the way the background gets its textures Change the way Player gets its texture FAQ Summary 9. Collision Detection, Pickups, and Bullets Coding the Bullet class Coding the Bullet header file Coding the Bullet source file Making the bullets fly Including the Bullet class Control variables and the bullet array Reloading the gun Shooting a bullet Updating the bullets each frame Drawing the bullets each frame Giving the player a crosshair Coding a class for pickups 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 Summary 10. Layering Views and Implementing the HUD Adding all the Text and HUD objects Updating the HUD each frame Drawing the HUD, and the home and level up screens FAQ Summary 11. Sound Effects, File I/O, and Finishing the Game Saving and loading the high-score Preparing sound effects Leveling up Restarting the game Playing the rest of the sounds Adding sound effects while the player is reloading Make a shooting sound Play a sound when the player is hit Play a sound when getting a pickup Make a splat sound when a zombie is shot FAQ Summary 12. Abstraction and Code Management – Making Better Use of OOP The Thomas Was Late game Features of Thomas Was Late Creating a project from the template The project assets Game level designs GLSL Shaders The graphical assets close-up The sound assets close-up Adding the assets to the project Structuring the Thomas Was Late code Building the game engine Reusing the TextureHolder class Coding Engine.h Coding Engine.cpp 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 Summary 13. Advanced OOP – Inheritance and Polymorphism Inheritance Extending a class Polymorphism Abstract classes - virtual and pure virtual functions Building the PlayableCharacter class Coding PlayableCharacter.h Coding PlayableCharacter.cpp Building the Thomas and Bob classes Coding Thomas.h Coding Thomas.cpp Coding Bob.h Coding Bob.cpp Updating the game engine to use Thomas and Bob Updating Engine.h 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 Summary 14. Building Playable Levels and Collision Detection Designing some levels Building the LevelManager class Coding LevelManager.h Coding the LevelManager.cpp file Coding the loadLevel function Updating the engine Collision detection Coding the detectCollisions function More collision detection Summary 15. Sound Spatialization and HUD What is Spatialization? Emitters, attenuation, and listeners How SFML handles spatialization Building the SoundManager class Coding SoundManager.h Coding the SoundManager.cpp file 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 The HUD class Coding HUD.h Coding the HUD.cpp file Using the HUD class Summary 16. Extending SFML Classes, Particle Systems, and Shaders The SFML Drawable class An alternative to inheriting from Drawable Why it is best to inherit from Drawable? Building a particle system Coding the Particle class Coding Particle.h Coding the Particle.cpp file Coding the ParticleSystem class Coding ParticleSystem.h Coding the ParticleSystem.cpp file Using ParticleSystem Adding a ParticleSystem object to the Engine class Initializing ParticleSystem Updating the particle system in each frame 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 Adding shaders to the Engine class Loading the shaders Updating and drawing the shader in each frame Summary 17. Before you go...
Donate to keep this site alive
To access the Link, solve the captcha.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.