Learn C Games Programming for Beginners on Windows


Learn C - book cover

50 Chapters

This is an ebook, I've written. It's approximately 200 pages (55,000 words; well Amazon says 328 pages) with lots of diagrams, pictures and short source code listing. All source code from the book is on Github.

The first 20 chapters introduce you to programming in C with 30 example programs. This includes showing you how to install Visual Studio and compile and run programs.

Subjects taught include a large chunk of C including variables, loops, structs, arrays, chars, functions and pointers. You'll learn about typedef and pick up a few tips on programming and debugging along the way. And there's lots more.

Chapters 21-50 - Programming an arcade game

This is about developing a full blown asteroids game, with asteroids, player ships, bullets etc. usingthe SDL2 library to get 60 frames per second action using what you learned in the first 20 chapters.

It builds up with new code added in each of 13 chapters, culminating in a full game around 2,200 lines of C. This includes a fast pixel-perfect collision detection algorithm. Along the way you'll learn how to display graphics at 60 frames per second, play sounds, handle the keyboard, display and update a high-score table and lots more.

It's currently being polished and should be ready for launch on Amazon in December 2018.

When the book is ready, I'll post a link here.


Here's the table of Contents of the Book

Chapter 1. Introduction to C programming

The Game – Asteroids

Chapter 2. Computers and Operating Systems

Chapter 3. Running Programs

Chapter 4. Bytes and Bobs and some Maths

Chapter 5. Hello World

Chapter 6. Installing Visual Studio Community Edition

Chapter 7. Our first project

Chapter 8. Variables in C

Chapter 9. Another type: char

Chapter 10. A little Bit of C code

Chapter 11. A Quick Overview of Visual Studio

Chapter 12. Array variables

Chapter 13. Loop the loops

Chapter 14. More loops

Chapter 15. About operators

Chapter 16 - Structs

Chapter 17. Functions

Chapter 18. More about functions

Chapter 19. Pointers

Chapter 20. Text Strings

Chapter 21. The Asteroids Game

Chapter 22. Architecture of C Programs

Chapter 23. Graphics

Chapter 24. Installing SDL2

Chapter 25. An SDL Demo program

Chapter 26. The Game Loop

Chapter 27. High Precision Timing

Chapter 28. Drawing Text

Chapter 29. More Game Elements

Chapter 30. Adding in asteroids

Chapter 31. Adding in bullets

Chapter 32. A bit of C99

Chapter 33. Editing with Visual Studio

Chapter 34. Restructuring

Chapter 35 Show the Score

Chapter 36. Explosions

Chapter 37. Sounds

Chapter 38. Detecting Collisions Part 1

Chapter 39. Detecting Collisions Part 2

Chapter 40. Detecting Collisions Part 3

Chapter 41. Passing Parameters into functions

Chapter 42. Detecting Collisions Part 4

Chapter 43. Ever Wondered about if (!value)

Chapter 44. Some Debugging Tips

Chapter 45. Improving the game

Chapter 46. Adding Level Structure

Chapter 47. Alien Ships!

Chapter 48. The High Score

Chapter 49. Finishing off

Chapter 50. Obtaining Source code and Resources


A big thank you to limaker for helping with a tedious task!