Starting loki programming guide
This commit is contained in:
parent
fcec176008
commit
95a6777ebd
34
loki_sample/Makefile
Normal file
34
loki_sample/Makefile
Normal 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
|
||||
|
2
loki_sample/gdb_example/Makefile
Normal file
2
loki_sample/gdb_example/Makefile
Normal file
@ -0,0 +1,2 @@
|
||||
ALL:
|
||||
gcc -ggdb buggy.c -o buggy
|
1
loki_sample/gdb_example/NOTES
Normal file
1
loki_sample/gdb_example/NOTES
Normal 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!
|
11
loki_sample/gdb_example/buggy.c
Normal file
11
loki_sample/gdb_example/buggy.c
Normal 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
20
loki_sample/notes
Normal 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
|
Loading…
x
Reference in New Issue
Block a user