/******************************************************************************/
#include "stdafx.h"
#include "$$headers.h"
/******************************************************************************/
ConnectionServer mServer;
Connection mSelf;
Str text;
Str data;
/******************************************************************************/
void InitPre(){
App.name("Client");
App.flag = APP_WORK_IN_BACKGROUND;
DataPath("C:/EsenthelEngineSDK/Data");
Paks.add("engine.pak");
D.mode(640, 480);
D.full(false);
}
/******************************************************************************/
Bool Init()
{
if(!mServer.create(55874))
Exit("Couldn\'t create the server.");
mServer.clients.replaceClass<Client>();
SockAddr server; server.setLocal(55874);
if(mSelf.clientConnectToServer(server))
{
}
else {
return false;
}
return true;
}
/******************************************************************************/
void Shut()
{
mServer.del();
mSelf.del();
}
/******************************************************************************/
Bool Update()
{
mServer.update();
/*if (mSelf.state() == CONNECT_VERSION_CONFLICT) text += " | Version Trouble";
else if (mSelf.state() == CONNECT_INVALID) text += " | Invalid";
else if (mSelf.state() == CONNECT_AWAIT_GREET) text += " | Connecting...";
else if (mSelf.state() == CONNECT_GREETED) text += " | Success!"; */
if(Kb.bp(KB_ESC))
return false;
return true;
if (mSelf.receive(0))
{
mSelf.data.getStr(data);
}
}
/******************************************************************************/
void Draw()
{
if(mSelf.state()!=CONNECT_GREETED)
text += " | Invalid connection";
D.clear(BLACK);
D.text(0, 0.8, text);
text = "";
}