Book Image

Beginning C++ Game Programming

Book Image

Beginning C++ Game Programming

Overview of this book

This book is all about offering you a fun introduction to the world of game programming, C++, and the OpenGL-powered SFML using three fun, fully-playable games. These games are an addictive frantic two-button tapper, a multi-level zombie survival shooter, and a split-screen multiplayer puzzle-platformer. We will start with the very basics of programming, such as variables, loops, and conditions and you will become more skillful with each game as you move through the key C++ topics, such as OOP (Object-Orientated Programming), C++ pointers, and an introduction to the Standard Template Library. While building these games, you will also learn exciting game programming concepts like particle effects, directional sound (spatialization), OpenGL programmable Shaders, spawning thousands of objects, and more.
Table of Contents (24 chapters)
Beginning C++ Game Programming
Credits
About the Author
About the Reviewer
www.PacktPub.com
Dedication
Preface
17
Before you go...

Summary


In this chapter we learnt about strings, SFML Text, and SFML Font. Between them they enabled us to draw text to the screen, which provided the player with a HUD. We also used sstream, which allows us to concatenate strings and other variables to display the score.

We explored the SFML RectangleShape class, which does exactly what its name suggests. We used an object of the type RectangleShape, and some carefully planned variables, to draw a time bar that visually displays how much time a player has left. Once we have implemented chopping, and moving branches that can squash the player, the time bar will create tension and urgency.

Next we are going to learn about a whole range of new C++ features, including loops, arrays, switching, enumerations, and functions. This will enable us to move the tree branches, keep track of their locations, and squash the player.