From 69df507d7b7b2084df6a5de186dfd0b7db9b2cad Mon Sep 17 00:00:00 2001
From: namark <namark@disroot.org>
Date: Tue, 4 Feb 2020 01:43:12 +0400
Subject: [PATCH] Updated README and docs.

---
 README.md                 | 21 ++++++++++++++-------
 docs/1_basic_setup.md     | 10 ++++++++--
 docs/2_compile_and_run.md | 22 ++++++++++++++++++----
 3 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 8dee816..7d16914 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,18 @@ Multi-threaded game of life with 8 generation history (current + 7 generations b
 
 ## Use instructions
 ### Overview
-Mouse - draw living cells.
-Enter/Return - toggle life at ~60 generation per second.
-Right Arrow - step forward one generation.
-Left Arrow - step backward one generation.
-+ - zoom in
-- - zoom out
+Mouse - draw living cells.<br />
+Enter/Return - toggle life at ~60 generation per second.<br />
+Right Arrow - step forward one generation.<br />
+Left Arrow - step backward one generation.<br />
+\+ - zoom in<br />
+\- - zoom out<br />
+Shift+R - start/stop recording, when recording is stopped, it'll take some time to render it to a file, frames being played back at the rate of video encoding<br />
+
 
 ### Special secret dangerous command line parameters
-None so far
+Positional:
+1. filename for recording, required to enable the recording functionality
 
 ## Build instructions
 Below are build instructions for GNU systems (including cygwin on Windows), primarily using `make`. If that does not suit your needs it should not be hard to set this project up with your favorite build system/IDE. See the dependencies in the next section. <br />
@@ -25,8 +28,12 @@ Below are build instructions for GNU systems (including cygwin on Windows), prim
 [libsimple_musical](https://notabug.org/namark/libsimple_musical) <br />
 [libsimple_geom](https://notabug.org/namark/libsimple_geom) <br />
 [libsimple_support](https://notabug.org/namark/libsimple_support) <br />
+[libsimple_file](https://notabug.org/namark/libsimple_file) <br />
 [libsimple_sdlcore](https://notabug.org/namark/libsimple_sdlcore) <br />
 [cpp_tools](https://notabug.org/namark/cpp_tools) <br />
+Optional: <br />
+[libtheora](https://theora.org) <br />
+[libogg](https://xiph.org/ogg/) <br />
 
 The SDL2 headers are expected to be in a directory named SDL2. libsimple are all static libraries. cpp_tools is only necessary for building with GNU make as outlined in the previous section.<br />
 There are also source archives in releases, which have all the simple libraries included, so using that you won't have to individually setup those.
diff --git a/docs/1_basic_setup.md b/docs/1_basic_setup.md
index 52df019..a378809 100644
--- a/docs/1_basic_setup.md
+++ b/docs/1_basic_setup.md
@@ -3,8 +3,9 @@
 Required software:
 1. git, to fetch some dependencies
 2. GNU stuff (make, coreutils, findutils, binutils)
-2. C++ 17 compliant compiler
-3. SDL 2.0 runtime and development libraries
+3. C++ 17 compliant compiler
+4. SDL 2.0 runtime and development libraries
+5. Optionally theora and ogg libraries for video recording functionality.
 
 ## Specific instruction for Debian based distributions
 (Something similar should work on your favorite system/package manager as well. Know your distro!)
@@ -21,6 +22,11 @@ sudo apt update
 sudo apt install g++-7 -y
 ```
 
+3. Optionally (for video recording) install theora and ogg libraries
+```bash
+sudo apt install libtheora-dev libogg-dev
+```
+
 ## Specific instruction for Windows
 
 Download [cygwin](https://www.cygwin.com).<br />
diff --git a/docs/2_compile_and_run.md b/docs/2_compile_and_run.md
index bff2999..927939a 100644
--- a/docs/2_compile_and_run.md
+++ b/docs/2_compile_and_run.md
@@ -1,6 +1,11 @@
 # Compilation and start
 
 ## Common for all GNU systems
+Recommended - turn on optimizations for your compiler. You can do that using the CXXFLAGS variable, for example:<br />
+```bash
+export CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG -fno-rtti"
+```
+
 1. For the sake of completeness - obtain the project and change directory to its root:
 ```bash
 git clone https://notabug.org/namark/neogol
@@ -22,11 +27,19 @@ Otherwise, skip this step.
 ```bash
 make
 ```
+To enable video recording functionality specify ENABLE_THEORA_RECORDER
+```bash
+make ENABLE_THEORA_RECORDER=true
+```
 
 5. After compilation the executable file will be created in the `out` folder. You can run it like so:
 ```bash
 ./out/neogol
 ```
+To enable video recording functionality specify the video file name/path
+```bash
+./out/neogol recording.ogv
+```
 It can be used as is, or installed system wide using `make install` (or `checkinstall` on Debian based systems). `make unisntall` will uninstall it (use package manager in case of `checkinstall`).
 
 That should be about it.
@@ -44,7 +57,7 @@ export AR=x86_64-w64-mingw32-ar # archiver variable
 ```
 Now, SDL does some shenanigans with the main function, that didn't work for me, so had do disable that for step 4:
 ```bash
-export CXXFLAGS="-DSDL_MAIN_HANDLED"
+export CXXFLAGS="$CXXFLAGS -DSDL_MAIN_HANDLED"
 ```
 You can try to skip this and see if it works for you, or try some other solutions to the problem.<br />
 Before proceeding with step 5 there is the timeless problem of dlls to solve. Fortunately it seems pretty easy with this setup, need to just copy over all the dlls from mingw bin:
@@ -57,11 +70,12 @@ git clone https://notabug.org/namark/neogol
 cd neogol
 export CXX=x86_64-w64-mingw32-g++
 export AR=x86_64-w64-mingw32-ar
+export CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG -fno-rtti"
 ./tools/setup/init.sh
-export CXXFLAGS="-DSDL_MAIN_HANDLED"
-make
+export CXXFLAGS="$CXXFLAGS -DSDL_MAIN_HANDLED"
+make ENABLE_THEORA_RECORDER=true
 cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll ./out/
-./out/neogol
+./out/neogol recording.ogv
 ```
 
 <br />
-- 
GitLab