More work on the user guide

This commit is contained in:
Grayson Riffe (Laptop) 2021-12-08 12:26:57 -06:00
parent 8c67ceb5a4
commit ea1013c573
5 changed files with 62 additions and 4 deletions

View File

@ -6,7 +6,7 @@ namespace nf {
* *
* This struct contains basic information about the engine's window. * 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 { struct Config {
public: public:

View File

@ -39,6 +39,7 @@ bool Debug::m_timerStarted = false
#define NFSleepMS(x) std::this_thread::sleep_for(std::chrono::milliseconds(x)) #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. * 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. * In release mode, this does nothing.
*/ */

View File

@ -331,10 +331,42 @@ After rendering, our world will have a background.
@image html cubemap.png "Our scene with a background" width=50% @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 @section createUITut Creating a UI
@todo Lighting page? @todo Lighting page?
@section debuggingTut Debugging Your App @section debuggingTut Debugging Your App
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 @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.

View File

@ -1,8 +1,33 @@
@page gamestates Gamestate System @page gamestates Gamestate System
@tableofcontents @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 @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 @section obLifetime Object Lifetime

View File

@ -1,7 +1,7 @@
@page assets Asset System @page assets Asset System
@tableofcontents @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 @section buildAssets How to Build Your Assets