2016-09-13 19:03:36 +00:00
|
|
|
|
#include <iostream>
|
2016-09-27 18:38:36 +00:00
|
|
|
|
#include <getopt.h>
|
2016-09-27 22:26:36 +00:00
|
|
|
|
#include <asio.hpp>
|
|
|
|
|
#include <cstdlib>
|
2016-09-13 19:03:36 +00:00
|
|
|
|
|
2016-09-27 22:26:36 +00:00
|
|
|
|
#include "opengl.hpp"
|
2016-09-27 17:01:21 +00:00
|
|
|
|
#include "game_window.hpp"
|
2016-09-27 22:26:36 +00:00
|
|
|
|
#include "server.hpp"
|
2016-09-27 18:38:36 +00:00
|
|
|
|
#include "options.hpp"
|
2016-09-13 19:03:36 +00:00
|
|
|
|
|
2016-09-27 18:56:57 +00:00
|
|
|
|
uint64_t optionsFlags;
|
2016-09-27 18:38:36 +00:00
|
|
|
|
|
2016-09-27 22:26:36 +00:00
|
|
|
|
|
|
|
|
|
using asio::ip::tcp;
|
|
|
|
|
|
2016-09-27 18:38:36 +00:00
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
2016-09-27 22:26:36 +00:00
|
|
|
|
|
|
|
|
|
char port[]="3490";
|
2016-09-27 18:38:36 +00:00
|
|
|
|
char c;
|
|
|
|
|
|
|
|
|
|
static struct option long_options[] =
|
|
|
|
|
{
|
|
|
|
|
/* These options set a flag. */
|
|
|
|
|
// {"verbose", no_argument, &verbose_flag, 1},
|
|
|
|
|
// {"brief", no_argument, &verbose_flag, 0},
|
|
|
|
|
/* These options don’t set a flag.
|
|
|
|
|
We distinguish them by their indices. */
|
|
|
|
|
// {"add", no_argument, 0, 'a'},
|
|
|
|
|
// {"append", no_argument, 0, 'b'},
|
|
|
|
|
// {"delete", required_argument, 0, 'd'},
|
|
|
|
|
// {"create", required_argument, 0, 'c'},
|
|
|
|
|
{"fps", no_argument, 0, 'f'},
|
|
|
|
|
{0, 0, 0, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int option_index = 0;
|
|
|
|
|
|
|
|
|
|
while(1){
|
|
|
|
|
c = getopt_long (argc, argv, "abc:d:f",
|
|
|
|
|
long_options, &option_index);
|
|
|
|
|
if (c == -1)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case 'f':
|
|
|
|
|
SET_FLAG(SHOW_FPS,true);
|
|
|
|
|
break;
|
|
|
|
|
/*case 'c':
|
|
|
|
|
cvalue = optarg;
|
|
|
|
|
break;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
case '?':
|
|
|
|
|
/* getopt_long already printed an error message. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-27 22:26:36 +00:00
|
|
|
|
asio::io_service io_service;
|
|
|
|
|
Server s(io_service, atoi(port) );
|
|
|
|
|
|
2016-09-27 18:38:36 +00:00
|
|
|
|
GameWindow window(500, 500);
|
|
|
|
|
window.set_maxfps(60.0);
|
2016-09-27 22:26:36 +00:00
|
|
|
|
|
|
|
|
|
while(window.running()){
|
|
|
|
|
window.poll();
|
|
|
|
|
io_service.poll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2016-09-13 19:03:36 +00:00
|
|
|
|
}
|