Get Started Now

Intro to C++ Programming

Starting from the fundamentals, become a C++ software engineer, step by step.

LATEST UPDATES

Screenshot from Cyberpunk 2077
Module One

Intro to C++ Programming

Starting from the basics, become a C++ software engineer, step by step

Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
Screenshot from Cyberpunk 2077
Module Two

Game Dev with SDL2

Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games

Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
Screenshot from Cyberpunk 2077
Module Three

Professional C++

Learn C++ and SDL development by recreating classic retro games

Screenshot from Cyberpunk 2077
Screenshot from The Witcher 3: Wild Hunt
Screenshot from Warhammer: Total War
MOST POPULAR

Building a 2D Vector Type

Learn the foundations of vector math to work with positions and movements, and create a custom type to apply these concepts
Abstract art representing computer programming
Ryan McCombe
Updated
Published

In previous lessons, we hinted at a custom type that could store a two-dimensional vector, which we can use to represent positions in a space. Such a type is typically called a vector, and they are the fundamental building block of computer graphics, simulation, and more.

Throughout the rest of this chapter, we’ll use them to represent concepts like positions, movements, directions, accelerations, and forces.

In this lesson, we'll implement a Vec2 type that can represent positions, movements, and forces in a 2D space by equipping our vector with operations like addition, subtraction, and scalar multiplication. This foundation will serve us well throughout the remainder of this chapter as we build increasingly sophisticated graphics and physics systems for our games.

Moving Objects with Vectors

Explore how to use vectors for representing positions, directions, and implementing speed-limited movement in games.
Abstract art representing computer programming
Ryan McCombe
Updated
Published

In this lesson, we’ll see some examples of how we can use our new Vec2 type to support functionality like positioning and moving objects within our game world.

We'll see how vectors provide elegant solutions for positioning and moving objects in a game world. We'll implement a character movement system that handles speed limits, direction calculations, and smooth transitions between positions. Later in the course, we’ll build on these techniques, introducing concepts like acceleration, gravity, and other forces to our movement logic.

The examples in this lesson use the Vec2 type we created in the previous section. A complete version of this struct is available below:

Understanding Screen & World Space

Learn to implement coordinate space conversions in C++ to position game objects correctly on screen.
Abstract art representing computer programming
Ryan McCombe
Published

Every non-trivial game needs to represent positions in at least two different ways: where things are in the game world, and where they appear on the player's screen.

These different representation systems are called the world space and the screen space, and converting between them is a core skill in game development. In this lesson, we'll explore some of the main reasons why we need to work across multiple spaces, and how to transform our objects between them.

We’ll be using the Vec2 struct we created earlier in the course. A complete version of it is available below:

Exponents and cmath

Understand the math foundations needed for game programming in C++, including power and root functions.
Abstract art representing computer programming
Ryan McCombe
Updated
Published

Math and programming go hand in hand, especially in game development. We’ll cover the core concepts throughout this chapter, starting from the basics and moving on to concepts that allow us to implement things like virtual cameras and physics systems.

In this first lesson, we're starting with the fundamentals - exponents and square roots. We'll explore how these work in C++, look at different ways to implement them, and start thinking about performance considerations. This sets the stage for the more complex math concepts we'll tackle as we move forward.

Spaces, Vectors and Coordinates

Learn the fundamentals of coordinate systems and vectors to create spatial representations
Abstract art representing computer programming
Ryan McCombe
Updated
Published

In this lesson, we'll cover coordinate systems and vectors, which form the basis of spatial representation in computer graphics. These mathematical constructs allow us to specify the positions of objects in our virtual worlds.

We'll start by defining spaces and the Cartesian coordinate system. Then, we'll examine vectors as a way to store positional data using multiple components. Finally, we'll explore how to implement these structures in C++ and understand the transformations required to convert between different coordinate spaces.

These concepts serve as building blocks for all spatial calculations in game development, from simple 2D positioning to complex 3D transformations.

Angles and Distance

Learn key geometry concepts like angles, triangles, and vectors to implement distance calculations.
Abstract art representing computer programming
Ryan McCombe
Updated
Published

This lesson introduces the core geometric concepts used in game programming. We'll cover angles and right-angled triangles before exploring the Pythagorean theorem and its applications in calculating distances.

We'll implement these mathematical principles in C++ to solve common game development problems. The lesson demonstrates how to calculate vector magnitudes and distances between objects in both 2D and 3D coordinate systems.

These techniques form the basis for many game mechanics, including collision detection and spatial positioning, which we’ll implement later in this chapter.

Snake Game Core Components

Introducing the foundational components for our game and setting up the project
Digital art showing a retro snake game
Ryan McCombe
Published

In this lesson, we'll build the foundational components of our Snake game. We'll implement the essential components for window management, asset handling, and user interface. This framework will serve as the backbone for our game's implementation.

Building the Snake Grid

Build the foundational grid structure that will power our Snake game's movement and collision systems.
Digital art showing a retro snake game
Ryan McCombe
Published

In this lesson, we'll build the foundation of our Snake game by implementing a grid system. We'll create Cell and Grid classes to manage the game state, handle rendering, and prepare for the snake's movement.

By the end, you'll have a fully functional grid that displays the initial snake position and first apple.

Snake Movement and Navigation

Learn how to implement core snake game mechanics including movement, controls, and state management
Digital art showing a retro snake game
Ryan McCombe
Published

In this lesson, we'll implement the core mechanics of our snake game. We'll create the game state management system, handle user input for controlling the snake's movement, and implement the snake's movement logic. By the end, you'll have a fully functional snake that responds to player controls.

We'll start by defining the fundamental data structures needed to track our snake's state, including its position, length, and direction. Then we'll expand our state system to advance the game through time.

Finally, we’ll allow our game state to respond to user input, allowing the player to control the direction their snake moves.

Snake Growth

Allowing our snake to eat apples, and grow longer each time it does
Digital art showing a retro snake game
Ryan McCombe
Published

Now that we have our basic movement system in place, it's time to make our Snake game truly playable. We'll implement apple consumption mechanics, handle snake growth, and create a dynamic apple spawning system.

By the end of this section, our snake will be able to move around the grid eating apples, and getting longer for every apple it consumes.

Module One
3D art showing a progammer setting up a development environment

Intro to C++ Programming

Become a software engineer with C++. Starting from the basics, we guide you step by step along the way

This course includes:

  • 60 Lessons
  • Over 200 Quiz Questions
  • 95% Positive Reviews
  • Regularly Updated
  • Help and FAQ
Module Two
sdl2-promo.jpg

Game Dev with SDL2

Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games

This course includes:

  • 90 Lessons
  • 92% Positive Reviews
  • Regularly Updated
  • Help and FAQs
Module Three
A computer programmer

Professional C++

Comprehensive course covering advanced concepts, and how to use them on large-scale projects.

This course includes:

  • 125 Lessons
  • 550+ Code Samples
  • 96% Positive Reviews
  • Regularly Updated
  • Help and FAQ
Get Started Now

Intro to C++ Programming

Starting from the fundamentals, become a C++ software engineer, step by step.

Contact|Privacy Policy|Terms of Use
Copyright © 2025 - All Rights Reserved