Beginner C++ Game Programming Tutorial 16

From Chilipedia
Revision as of 22:28, 25 December 2016 by Chili (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this video we learn how to float our boat, and how to get type cast.

Topics Covered

  • The float data type
  • Converting from one data type to another with type casts
  • Compiler warnings

Notes

C++ Style Casting

The casts shown in this video are C style casts (i.e. (int) or int()). C++ adds a new style of casting, with the syntax static_cast<int>(). This type of casting is more limited than C style, and thus safer in certain situations. It also has the advantage of making it easier to search a codebase for type casting. However, I have opted not to cover it at this point, mainly because the syntax is clumsy and I did not want to turn beginners off of the idea of explicit casting to clean up compiler warnings.

I will be covering C++ style casts in the future when they will prove be more relevant. Specifically, after we cover pointers, I will discuss the reinterpret_cast<> for reading data from disk into variables / structures. When I cover that topic, I will also mention static_cast<>. The other C++ casts will be mentioned when the topic arises organically over the course of the tutorials.

Poo Sound

The version of the Poo Game used in this tutorial has been enhanced with the addition of sound effects. Check out this page for more information on adding sound to your Chili Framework creations.

Video Timestamp Index

Tutorial 16

Homework

The homework is to create a function that draws a solid circle on the screen.

The solution video is here.

Links

See also