Starting loki programming guide

This commit is contained in:
Logen Kain 2016-08-07 14:42:10 -07:00
parent fcec176008
commit 95a6777ebd
5 changed files with 68 additions and 0 deletions

34
loki_sample/Makefile Normal file
View File

@ -0,0 +1,34 @@
PREFIX=/usr
#OBJS specifies which files to compile as part of the project
OBJS = tuxc.c lib/logenlib.c
#CC specifies which compiler to use
CC = clang
#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppress all warnings
COMPILER_FLAGS = -Wall
#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -llua
#OBJ_NAME specifies the name of our executable
OBJ_NAME= tuxc
#This is the target that compiles our executable
all : $(OBJS)
$(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)
install :
mkdir -p ${PREFIX}/share/tuxc
cp tuxc ${PREFIX}/share/tuxc/
cp -R package_managers ${PREFIX}/share/tuxc/
ln -si ${PREFIX}/share/tuxc/tuxc ${PREFIX}/bin/tux
uninstall :
rm ${PREFIX}/bin/tux
rm -r ${PREFIX}/share/tuxc/package_managers
rm ${PREFIX}/share/tuxc/tuxc
rm -r ${PREFIX}/share/tuxc
clean :
rm tuxc

View File

@ -0,0 +1,2 @@
ALL:
gcc -ggdb buggy.c -o buggy

View File

@ -0,0 +1 @@
this did not help me figure out gdb; however, clang happily showed me the issue easily. However, DDD worked amazingly. All I have to do is add a breakpoint and then run the program. It shows results as it goes. It's great!

View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main()
{
int i;
for (i = 0; i < 10; i++); // The bug is this extra semicolon
printf("Counter is now %i\n",i);
return 0;
}
// Should (wrongfully) only print out "Counter is now 10"
// Note that GCC does not report an error. Clang reports the error.

20
loki_sample/notes Normal file
View File

@ -0,0 +1,20 @@
Most engines seem to have this.
Input subsystem >> Keyboard/Mouse/Game Pad
Network Subsystem >> internet or lan
update subsystem >> This should not be in the game loop >> Should be a seperate module to begin with >> Pay attention to code organization.
display subsystem >> 32 Hardware / Framebuffer
Audio Sybsystem >> sound card
main loop >> Just a while loop that runs the entire time anywhere from 30 to 60 times per second.
Invokes correct routines to gather input from the player and network
updates the status of all objects in the game
draws the next frame of graphics
and produces audio.
seperating meu system from main loop is good, but can complicate the code
Networking information should usually be grabed first
Graphics should be usually grabed last