Difference between revisions of "Beginner C++ Game Programming Tutorial 10"

From Chilipedia
Jump to: navigation, search
m (Text replacement - "http://www.planetchili.net/" to "https://www.planetchili.net/")
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
== Concepts Taught ==
 
== Concepts Taught ==
* References
+
* <code>while</code> loop
* Passing by reference
+
* <code>for</code> loop
* Const correctness (redux)
+
* <code>do</code> ... <code>while</code> loop
 +
* Preincrement <code>++x</code> and postincrement <code>x++</code> operators
  
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==
Coming soon!
+
* Intro [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=0m0s 0:00]
 +
* The roadmap [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=0m20s 0:20]
 +
* Loops: <code>while() {...}</code> [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=1m39s 1:39]
 +
* Loops: <code>for() {...}</code> [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=8m20s 8:20]
 +
* Increment/decrement unary operator [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=10m51s 10:51]
 +
* Fun Chili fact for the day: the origins of the "C++" language name [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=11m51s 11:51]
 +
* Loops: <code>do {...} while ()</code> [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=12m36s 12:36]
 +
* Loop differences, when to use <code>for(){}</code>, <code>while(){}</code>, or <code>do{} while()</code> (if you are kinda weird) [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=13m15s 13:15]
 +
* Chili's Dank Meta Nugs [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=15m6s 15:06]
 +
* Homework [https://www.youtube.com/watch?v=rwJ0sOmBK6E&t=18m23s 18:23]
  
 
== Homework ==
 
== Homework ==
# Move the drawing code for Dude from Game into the Dude class.
+
# Write a routine to draw a rectangle on the screen.
# Make a second DrawRect function that takes a single point (top left corner) and the dimensions as parameters.
+
# Make it so that you can control the position of the rectangle with the arrow keys and the size of the rectangle with the WASD keys. For info on querying keyboard input for alphanumeric keys, see the section "Virtual Key Codes" on [[Keyboard (Chili Framework)#Virtual_Key_Codes|this page]].
  
The solution is given in a future video.
+
The solution is given in a [https://youtu.be/lWTwNXfU-Nc this] video.
  
 
== Downloads ==
 
== Downloads ==
  
* [http://www.planetchili.net/downloads/Chili%20DirectX%20Framework.zip Framework Download]
+
* [https://www.planetchili.net/downloads/Chili%20DirectX%20Framework.zip Framework Download]
 +
* [https://planetchili.net/downloads/apworks/10/Beginner%20Tutorial%2010%20Code.zip Tutorial 10 Code]
 +
* [https://planetchili.net/downloads/apworks/10/Beginner%20Tutorial%2010%20HW%20Code.zip Tutorial 10 Homework Solution Code]
  
 
== See also ==
 
== See also ==
 
* [https://www.patreon.com/planetchili Planet Chili Patreon]
 
* [https://www.patreon.com/planetchili Planet Chili Patreon]
* [[Beginner C++ Game Programming Tutorial 12|Next in series (Tutorial 12)]]
+
* [[Beginner C++ Game Programming Tutorial 11|Next in series (Tutorial 11)]]
 
* [[Beginner C++ Game Programming Series]]
 
* [[Beginner C++ Game Programming Series]]

Latest revision as of 13:26, 5 May 2022

In this video we learn how to loop our shit. Fuckoff copy and paste. Die in a gasoline fire (just kidding, don't leave me baby!)

Concepts Taught

  • while loop
  • for loop
  • do ... while loop
  • Preincrement ++x and postincrement x++ operators

Video Timestamp Index

  • Intro 0:00
  • The roadmap 0:20
  • Loops: while() {...} 1:39
  • Loops: for() {...} 8:20
  • Increment/decrement unary operator 10:51
  • Fun Chili fact for the day: the origins of the "C++" language name 11:51
  • Loops: do {...} while () 12:36
  • Loop differences, when to use for(){}, while(){}, or do{} while() (if you are kinda weird) 13:15
  • Chili's Dank Meta Nugs 15:06
  • Homework 18:23

Homework

  1. Write a routine to draw a rectangle on the screen.
  2. Make it so that you can control the position of the rectangle with the arrow keys and the size of the rectangle with the WASD keys. For info on querying keyboard input for alphanumeric keys, see the section "Virtual Key Codes" on this page.

The solution is given in a this video.

Downloads

See also