#+TITLE: Theory of Game
#+AUTHOR: screwtape
* Trajectory
** Initial overview
*** Important basics for a game
    1. A computer program having graphics, text, controls and sound
    2. Advanced topics like time passing and network multiplayer
    3. Distant last equal is art and story, though 3D is important
*** Literate programming
    We are going to use Emacs orgmode for writing code in a style due to Donald Knuth. It is like making a magazine article about the program, except that article actually is the computer program.
    
    #+begin_src C :exports both :results drawer
      puts("hey");
    #+end_src

    If anyone else recommends anything else, compare that person's Wikipedia page to Donald Knuth's Wikipedia page.
*** Approach
    Initially we will work on literate programming and the basic premises of SDL2.
    That will segue into using embedded lisp for complex structure and function.
**** To start with
     1. Get used to emacs and orgmode
     2. Use orgmode to export in progress work as a web page
**** Key objective
     Critically get to something like this independently
     (With reference to [[https://wiki.libsdl.org/SDL_RenderClear][SDL's wiki]]) 
     #+begin_src C :includes "/usr/local/include/SDL2/SDL.h" :libs "-L/usr/local/lib -lSDL2" :exports code :results none
       SDL_Window* window;
       SDL_Renderer* renderer;

       /* Initialize SDL. */
       if (SDL_Init(SDL_INIT_VIDEO) < 0)
	 return 1;

       /* Create the window where we will draw. */
       window = SDL_CreateWindow("SDL_RenderClear",
				 SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
				 512, 512,
				 0);
       // The wiki misses something here for example.

       /* We must call SDL_CreateRenderer in order for draw calls to affect this window. */
       renderer = SDL_CreateRenderer(window, -1, 0);

       /* Select the color for drawing. It is set to red here. */
       SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);

       /* Clear the entire screen to our selected color. */
       SDL_RenderClear(renderer);

       /* Up until now everything was drawn behind the scenes.
	  This will show the new, red contents of the window. */
       SDL_RenderPresent(renderer);

       /* Give us time to see the window. */
       SDL_Delay(5000);

       /* Always be sure to clean up */
       SDL_Quit();
       return 0;
     #+end_src