Difference between revisions of "Beginner C++ Game Programming Tutorial 16"
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* Compiler warnings | * Compiler warnings | ||
− | == Poo Sound == | + | == Notes == |
+ | === C++ Style Casting === | ||
+ | The casts shown in this video are C style casts (i.e. <code>(int)</code> or <code>int()</code>). C++ adds a new style of casting, with the syntax <code>static_cast<int>()</code>. 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 <code>reinterpret_cast<></code> for reading data from disk into variables / structures. When I cover that topic, I will also mention <code>static_cast<></code>. 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 [[Chili Sound Pack|this page]] for more information on adding sound to your Chili Framework creations. | The version of the Poo Game used in this tutorial has been enhanced with the addition of sound effects. Check out [[Chili Sound Pack|this page]] for more information on adding sound to your Chili Framework creations. | ||
Line 15: | Line 21: | ||
The homework is to create a function that draws a solid circle on the screen. | The homework is to create a function that draws a solid circle on the screen. | ||
− | The solution video is | + | The solution video is [https://youtu.be/EXsnvWI_2nc here]. |
== Links == | == Links == |
Latest revision as of 22:28, 25 December 2016
In this video we learn how to float
our boat, and how to get type cast.
Contents
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
Homework
The homework is to create a function that draws a solid circle on the screen.
The solution video is here.