Difference between revisions of "Intermediate C++ Game Programming Tutorial 7"

From Chilipedia
Jump to: navigation, search
(Topics Covered)
(Homework)
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
* <code>std::endl</code> and buffered I/O flushing
 
* <code>std::endl</code> and buffered I/O flushing
 
* <code>&lt;iomanip&gt;</code>
 
* <code>&lt;iomanip&gt;</code>
* Cleaning out an input stream
+
* Cleaning an input stream with <code>ignore()</code> and <code>clear()</code>
 
* <code>std::numeric_limits<></code>
 
* <code>std::numeric_limits<></code>
 
* <code>std::string</code>
 
* <code>std::string</code>
* <code>OutputDebugString</code>
+
* <code>OutputDebugString()</code>
 
* <code>std::stringstream</code>
 
* <code>std::stringstream</code>
  
Line 21: Line 21:
 
== Other Links ==
 
== Other Links ==
 
[https://www.cppreference.com C++ Hardcore Reference]<br />
 
[https://www.cppreference.com C++ Hardcore Reference]<br />
[https://www.cplusplus.com C++ Softcore Reference]<br />
+
[http://www.cplusplus.com C++ Softcore Reference]<br />
 
[http://www.gutenberg.org/files/2600/2600-0.txt War and Peace (warp.txt)]
 
[http://www.gutenberg.org/files/2600/2600-0.txt War and Peace (warp.txt)]
  
Line 31: Line 31:
 
* Speedup Rate
 
* Speedup Rate
 
* Poison Amount
 
* Poison Amount
* Goal Amount
+
* Food Amount
 +
 
 +
For this homework, you are not required to handle malformed input files, though you can attempt to handle those as a bonus challenge if you like.
  
 
== See also ==
 
== See also ==
 
* [[Intermediate C++ Game Programming Tutorial 8|Next in series (Tutorial 8)]]
 
* [[Intermediate C++ Game Programming Tutorial 8|Next in series (Tutorial 8)]]
 
* [[Intermediate C++ Game Programming Series]]
 
* [[Intermediate C++ Game Programming Series]]

Latest revision as of 17:35, 30 July 2017

We finally ditch our janky makeshift chili:: routines and use some real shit here. Standard streams (std::cin / std::cout / std::fstream) are covered, and then we talk about string manipulation with std::string. We'll also cover some other less well-known dank C++ code memes, so check it out. Note that this video is more of an overview / whirlwind tour; it introduces various techniques and gives examples, but don't expect a detailed or exhaustive treatment here.

Topics Covered

  • C++ Streams
  • std::cin / std::cout
  • Insertion << / extraction >> operators
  • std::endl and buffered I/O flushing
  • <iomanip>
  • Cleaning an input stream with ignore() and clear()
  • std::numeric_limits<>
  • std::string
  • OutputDebugString()
  • std::stringstream

Video Timestamp Index

Tutorial 7

Source Code

GitHub Repo for Snek

Other Links

C++ Hardcore Reference
C++ Softcore Reference
War and Peace (warp.txt)

Homework

The homework is to modify Poison Snek so that various game settings can be configured by the user by editing a text file. The settings file should be parseable regardless of the order of the settings in the file. The following settings are recommended:

  • Tile Size
  • Board Size
  • Speedup Rate
  • Poison Amount
  • Food Amount

For this homework, you are not required to handle malformed input files, though you can attempt to handle those as a bonus challenge if you like.

See also