Difference between revisions of "Beginner C++ Game Programming Tutorial 9"
From Chilipedia
(→Homework) |
m (Text replacement - "http://www.planetchili.net/" to "https://www.planetchili.net/") |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
== Concepts Taught == | == Concepts Taught == | ||
− | * Creating a class | + | * Creating a <code>class</code> |
− | * public vs. private access | + | * <code>public</code> vs. <code>private</code> access |
− | * static member variables | + | * <code>static</code> member variables |
− | * constexpr variables | + | * <code>constexpr</code> variables |
== Video Timestamp Index == | == Video Timestamp Index == | ||
− | + | * Intro [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=0m0s 0:00] | |
+ | * ClampScreen code recap [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=0m18s 0:18] | ||
+ | * The issue of the current Game data organization: [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=1m38s 1:38] | ||
+ | * Classes: OOP to the rescue [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=1m38s 2:25] | ||
+ | * Creating our own class [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=3m21s 3:21] | ||
+ | * Header guard: <code>#pragma once</code> [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=3m40s 3:40] | ||
+ | * Letting other files know about our class: including headers [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=5m52s 5:52] | ||
+ | * Refactoring game code related to poo [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=6m56s 6:56] | ||
+ | * A little trick: Advanced find + replace with regex enabled [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=7m8s 7:08] | ||
+ | * Adding an implementation file (.cpp) for Poo class [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=9m5s 9:05] | ||
+ | * Advantages of the new poo object oriented code [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=12m7s 12:07] | ||
+ | * Initializing poos' velocities [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=14m12s 14:12] | ||
+ | * Factoring out common attributes from class objects: <code>static</code> and <code>constexpr</code> [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=14m41s 14:41] | ||
+ | * Difference between <code>constexpr</code> and <code>const</code> [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=16m8s 16:08] | ||
+ | * Accessing static class members [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=16m40s 16:40] | ||
+ | * Class member access restrictions: <code>public</code> vs <code>private</code> [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=17m20s 17:20] | ||
+ | * Summing up what we have learned and a couple of tips [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=19m12s 19:12] | ||
+ | * Homework [https://www.youtube.com/watch?v=Wwgyw69MiEU&t=20m3s 20:03] | ||
== Homework == | == Homework == | ||
− | Make the Dude entity into a class as well. It's up to you to decide what member functions you should give it. Might want to add another function to Poo as well (hint hint hint!). | + | Make the Dude entity into a <code>class</code> as well. It's up to you to decide what member functions you should give it. Might want to add another function to <code>Poo</code> as well (hint hint hint!). |
− | The solution is given in | + | The solution is given in [https://youtu.be/b4FjV2R9jy0 this video]. |
== Downloads == | == Downloads == | ||
− | * [ | + | * [https://www.planetchili.net/downloads/T9-Starting-Code.zip T9 Starting Code] |
+ | * [https://planetchili.net/downloads/apworks/9/Beginner%20Tutorial%209%20Code.zip Tutorial 9 Code] | ||
+ | * [https://planetchili.net/downloads/apworks/9/Beginner%20Tutorial%209%20HW%20Code.zip Tutorial 9 Homework Solution Code] | ||
== See also == | == See also == |
Latest revision as of 13:26, 5 May 2022
In this video we make our first class and Chili teaches us about the birds and the bees and the static constexpr.
Concepts Taught
- Creating a
class
-
public
vs.private
access -
static
member variables -
constexpr
variables
Video Timestamp Index
- Intro 0:00
- ClampScreen code recap 0:18
- The issue of the current Game data organization: 1:38
- Classes: OOP to the rescue 2:25
- Creating our own class 3:21
- Header guard:
#pragma once
3:40 - Letting other files know about our class: including headers 5:52
- Refactoring game code related to poo 6:56
- A little trick: Advanced find + replace with regex enabled 7:08
- Adding an implementation file (.cpp) for Poo class 9:05
- Advantages of the new poo object oriented code 12:07
- Initializing poos' velocities 14:12
- Factoring out common attributes from class objects:
static
andconstexpr
14:41 - Difference between
constexpr
andconst
16:08 - Accessing static class members 16:40
- Class member access restrictions:
public
vsprivate
17:20 - Summing up what we have learned and a couple of tips 19:12
- Homework 20:03
Homework
Make the Dude entity into a class
as well. It's up to you to decide what member functions you should give it. Might want to add another function to Poo
as well (hint hint hint!).
The solution is given in this video.