timesynk/main.c

36 lines
844 B
C

#include "main.h"
#include "common.h"
#include "stubs.h"
#include "game.h"
#include "player.h"
// TODO: add arguments, so user can connect to server via cmdline option
int main(int argc, char *argv[]) {
// initialize our interface system (ncurses, SDL, etc.)
if (interfaceInit() == ERROR) {
return ERROR;
}
// initialize our network system (sockets, winsock, etc.)
if (netInit() == ERROR) {
return ERROR;
}
is_running = 1;
// h'okay, let's add our default player commands
playerSetCommand(PLAYER_MOVE, playerMove);
gameInit();
// start our program loop!
while(is_running) {
if (is_networking)
netLoop(); // handle new network input
gameLoop();
//worldLoop();
interfaceDraw();
interfaceLoop(); // handle new user input, redraw screen, etc.
}
interfaceClose();
return SUCCESS;
}