Using Command pattern andEntityX
This commit is contained in:
@@ -1,31 +1,48 @@
|
||||
#include <signal.h>
|
||||
#include <iostream>
|
||||
|
||||
// Vendor
|
||||
#include <yojimbo.h>
|
||||
|
||||
// Own
|
||||
#include "GameServer.h"
|
||||
|
||||
// Windows
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using namespace yojimbo;
|
||||
|
||||
static GameServer *serv;
|
||||
|
||||
void interrupt_handler( int /*dummy*/ )
|
||||
void interrupt_handler(int /*dummy*/)
|
||||
{
|
||||
serv->m_running = false;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if ( !InitializeYojimbo() )
|
||||
//--- Setup CMD
|
||||
#ifdef _WIN32
|
||||
HANDLE hInput;
|
||||
DWORD prev_mode;
|
||||
hInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
GetConsoleMode(hInput, &prev_mode);
|
||||
SetConsoleMode(hInput, prev_mode & ENABLE_EXTENDED_FLAGS);
|
||||
#endif
|
||||
|
||||
if (!InitializeYojimbo())
|
||||
{
|
||||
printf( "error: failed to initialize Yojimbo!\n" );
|
||||
printf("error: failed to initialize Yojimbo!\n");
|
||||
return 1;
|
||||
}
|
||||
yojimbo_log_level( YOJIMBO_LOG_LEVEL_INFO );
|
||||
yojimbo_log_level(YOJIMBO_LOG_LEVEL_INFO);
|
||||
|
||||
std::cout << "Yojimbo lives!" << std::endl;
|
||||
signal( SIGINT, interrupt_handler );
|
||||
signal(SIGINT, interrupt_handler);
|
||||
|
||||
yojimbo::Address addr(127,0,0,1,9999);
|
||||
yojimbo::Address addr(127, 0, 0, 1, 9999);
|
||||
GameServer server(addr);
|
||||
serv = &server; //For interrupt
|
||||
server.Run();
|
||||
|
||||
Reference in New Issue
Block a user