diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.3&content-type=text/plain&hideattic=0&sortby=date | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.3&content-type=text/plain&hideattic=0&sortby=date/index.html | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.3&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.3&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..85dd33f5 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.3&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,126 @@ + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" +#include "login_interface.h" + +#include "nel/net/msg_socket.h" +#include "nel/net/naming_client.h" + +#include <string> +#include "nel/3d/driver.h" +#include "nel/misc/types_nl.h" +#include "login_interface.h" +#include "shards_list_interface.h" + +using namespace std; +using namespace NLNET; +using namespace NLMISC; + +CLogUserId login(NL3D::CScene * scene, uint w, uint h) +{ + CLoginInterface logscreen; + logscreen.init(scene, w, h); + return logscreen.log(); +} + +void connectToLS (LogUserId &luid) +{ + CInetAddress servaddr("vianneyl", 49999); + + CSocket server; + server.connect(servaddr); + + CMessage msgout(""); + msgout.setType(0); // we don't listen for incoming replies, therefore we must not use a type as string. 0 is the default action for CLogService : "LOG" + + string l, p; + int i; + for (i=0;i<luid.Login.size (); i++) l+=luid.Login[i]; + for (i=0;i<luid.Password.size (); i++) p+=luid.Password[i]; + msgout.serial(l); + msgout.serial(p); + + // send the message + server.send(msgout); + + // receive the answer + CMessage msgin("", true); + server.receive(msgin); + + uint8 ok; + msgin.serial (ok); + nlinfo ("res=%d", ok); + server.close(); +} + + +uint chooseShard(NL3D::CScene * scene, uint w, uint h, + const std::vector<ucstring>& shards) +{ + CShardsListInterface shardListScreen; + shardListScreen.init(scene, w, h, shards); + return shardListScreen.choose(); +} + + + +std::vector<ucstring> connect(CLogUserId id) //TEMP !! +{ + std::vector<ucstring> shards; + shards.reserve(10); + ucstring ucs; + ucs+='s';ucs+='h';ucs+='a';ucs+='r';ucs+='d';ucs+=' '; + ucstring ucsa = ucs; ucsa += 'A'; + shards.push_back(ucsa); + ucstring ucsb = ucs; ucsb += 'B'; + shards.push_back(ucsb); + ucstring ucsc = ucs; ucsc += 'C'; + shards.push_back(ucsc); + ucstring ucsd = ucs; ucsd += 'D'; + shards.push_back(ucsd); + ucstring ucse = ucs; ucse += 'E'; + shards.push_back(ucse); + ucstring ucsf = ucs; ucsf += 'F'; + shards.push_back(ucsf); + ucstring ucsg = ucs; ucsg += 'G'; + shards.push_back(ucsg); + return shards; +} + + + +/****************************************************************\ + MAIN +\****************************************************************/ +void main() +{ + InitDebug (); + + LogUserId id; + id.Login = 'c'; + id.Password = 'c'; + + //id = login(); + + // init scene + uint w = 800; + uint h = 600; + uint bpp = 32; + bool windowed = true; + NL3D::CScene scene; + NL3D::CSceneUt::init3d(scene, w, h, bpp, windowed); + + + // user login session + CLogUserId id = login(&scene, w, h); + + // connection // TEMP !! + std::vector<ucstring> shards = connect(id); + + // shard choice + uint shardIndex = chooseShard(&scene, w, h, shards); + + connectToLS (id); + // release scene + NL3D::CSceneUt::release3d(scene); +} |