From ea1013c5739f8812ad1a07d0f2671123a95ce355 Mon Sep 17 00:00:00 2001
From: "Grayson Riffe (Laptop)" <graysonriffe@yahoo.com>
Date: Wed, 8 Dec 2021 12:26:57 -0600
Subject: [PATCH] More work on the user guide

---
 NothinFancy/src/include/nf/Config.h  |  2 +-
 NothinFancy/src/include/nf/Utility.h |  1 +
 docs/pages/2_tutorial.md             | 34 +++++++++++++++++++++++++++-
 docs/pages/3_gamestates.md           | 27 +++++++++++++++++++++-
 docs/pages/4_assets.md               |  2 +-
 5 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/NothinFancy/src/include/nf/Config.h b/NothinFancy/src/include/nf/Config.h
index 86c4eef..7a6e209 100644
--- a/NothinFancy/src/include/nf/Config.h
+++ b/NothinFancy/src/include/nf/Config.h
@@ -6,7 +6,7 @@ namespace nf {
 	 * 
 	 * This struct contains basic information about the engine's window.
 	 * 
-	 * @todo Add more things here such as mouse sensativity and FPS target?
+	 * @todo Add more things here such as mouse sensitivity and FPS target?
 	*/
 	struct Config {
 	public:
diff --git a/NothinFancy/src/include/nf/Utility.h b/NothinFancy/src/include/nf/Utility.h
index ccba6d9..46076ae 100644
--- a/NothinFancy/src/include/nf/Utility.h
+++ b/NothinFancy/src/include/nf/Utility.h
@@ -39,6 +39,7 @@ bool Debug::m_timerStarted = false
 #define NFSleepMS(x) std::this_thread::sleep_for(std::chrono::milliseconds(x))
 /**
 * In debug mode, this prints a nicely-formatted message complete with a timestamp.
+* It takes in either a `const char*` or `std::string`.
 * 
 * In release mode, this does nothing.
 */
diff --git a/docs/pages/2_tutorial.md b/docs/pages/2_tutorial.md
index 82dad05..f6f7a72 100644
--- a/docs/pages/2_tutorial.md
+++ b/docs/pages/2_tutorial.md
@@ -331,10 +331,42 @@ After rendering, our world will have a background.
 
 @image html cubemap.png "Our scene with a background" width=50%
 
+@note Cubemaps do not emit light onto your scene.
+
+@section customAssetsTut Adding Your Assets
+
+NF's asset system builds your assets into NFPacks that the engine reads at runtime. The
+external tool `NFPackCreator.exe` creates these for you. For a complete guide, please
+see @ref assets.
+
 @section createUITut Creating a UI
 
 @todo Lighting page?
 
 @section debuggingTut Debugging Your App
 
-@section packagingTut Packaging and Distributing Your App
\ No newline at end of file
+NF has a number of @ref macros that you can use in your debug builds to help you develop
+your application. These macros can log messages, throw errors, time functions, and pause
+the engine.
+
+~~~cpp
+nf::Vec3 pos = camera->getPosition();
+std::string posStr = std::to_string(pos.x) + (std::string)", " + std::to_string(pos.y) + (std::string)", " + std::to_string(pos.z);
+NFLog("Current position: " + posStr);
+//This will print the current position of the camera every frame.
+~~~
+
+@section packagingTut Packaging and Distributing Your App
+
+@note Remember to only ever distribute your release build.
+
+The only external prerequisite when running a NF app is the 2022 64-bit MSVC
+redistributable. The installer is included in the `redist` folder in the engine download.
+
+Other than that, a build can be very simple:
+
+- **NFApp.exe** - The application binary which is named from the MSVC project
+- **assets** - The folder which holds your NFPacks
+  - **base.nfpack** - The NFPack that holds both critical and default assets
+
+These are the only files you need to package in your build.
\ No newline at end of file
diff --git a/docs/pages/3_gamestates.md b/docs/pages/3_gamestates.md
index ab4466a..d96da59 100644
--- a/docs/pages/3_gamestates.md
+++ b/docs/pages/3_gamestates.md
@@ -1,8 +1,33 @@
 @page gamestates Gamestate System
 @tableofcontents
 
-@todo The gamestates page
+This page details NF's state system and how to use it.
+
+@section gamestatesOverview Overview
+
+Before your nf::Application is run, you must first construct every one of the gamestates
+you want to use in that app **on the heap**. This is because having gamestates with many
+objects could result in a stack overflow.
+
+~~~cpp
+YourState* state = new YourState;
+~~~
+
+When the nf::Application's destructor is called, `delete` is called on every added gamestate
+for your convenience.
 
 @section enterAndExit onEnter and onExit
 
+These two functions are meant to load / initialize and "reset" your state respectively.
+
+The `onEnter` function is called as the loading screen is shown. When it returns, the screen
+fades into your scene. If you do not specify a starting position or rotation for the `camera`,
+it will start at (0.0, 0.0, 0.0) facing -Z (forwards).
+
+The `onExit` function is different. How you use this function is up to you based off of
+what your states are and if you want to connect them in some way, but if you want a
+state to behave in the same way every time you start it, you must
+**reset scalar members of your state that `onEnter` doesn't set itself** and
+**also `delete` any dynamically created objects created while the state was runnng**.
+
 @section obLifetime Object Lifetime
\ No newline at end of file
diff --git a/docs/pages/4_assets.md b/docs/pages/4_assets.md
index ce93875..7ea8541 100644
--- a/docs/pages/4_assets.md
+++ b/docs/pages/4_assets.md
@@ -1,7 +1,7 @@
 @page assets Asset System
 @tableofcontents
 
-This page details NF's asset system and custom pack format.
+This page details NF's asset system and custom NFPack format.
 
 @section buildAssets How to Build Your Assets