diff options
Diffstat (limited to 'cvs/cvsweb.cgi/~checkout~/code/client/Attic')
21 files changed, 1552 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..2176da62 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,66 @@ +/** \file blank_interface.cpp + * Language interface + * + * $Id: blank_interface.cpp,v 1.1 2000/11/23 15:36:14 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "nel/misc/i18n.h" +#include "blank_interface.h" + + +using namespace NL3D; +using namespace NLMISC; + + + + + + +/****************************************************************\ + init() +\****************************************************************/ +void CBlankInterface::init(NL3D::CScene * scene, uint w, uint h) +{ + _Scene = scene; + + _FontManager.setMaxMemory(2000000); + _EventServer.addEmitter(_Scene->getDriver()->getEventEmitter()); + + CDisplayDescriptor displayDesc; + displayDesc.ResX = w; + displayDesc.ResY = h; + ScreenWidth = w; + ScreenHeight = h; + +} + + + + +/****************************************************************\ + release() +\****************************************************************/ +void CBlankInterface::release() +{ + _EventServer.removeListener(EventCharId, _Listener); +} + diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..eca156e3 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,27 @@ +/** \file blank_interface.cpp + * Language interface + * + * $Id: blank_interface.cpp,v 1.2 2000/11/24 14:17:35 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "blank_interface.h" + diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..bb8cab84 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/blank_interface.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,95 @@ +/** \file blank_interface.h + * + * + * $Id: blank_interface.h,v 1.2 2000/11/23 16:41:20 lecroart Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_BLANK_INTERFACE_H +#define NL_BLANK_INTERFACE_H + +#include <vector> +#include "nel/misc/types_nl.h" +#include "nel/misc/event_emitter.h" +#include "nel/misc/event_listener.h" +#include "nel/3d/scene_ut.h" +#include "nel/3d/font_manager.h" +#include "nel/3d/computed_string.h" + + + + +/** + * Class CBlankInterface + * \author Stephane Coutelas + * \author Nevrax France + * \date 2000 + */ +class CBlankInterface +{ +protected: + /// screen width + uint ScreenWidth; + + /// screen height + uint ScreenHeight; + + /// font manager providing font textures + NL3D::CFontManager _FontManager; + + /// font generator + NL3D::CFontGenerator _FontGenerator; + + /// scene (provides driver) + NL3D::CScene * _Scene; + + /// event manager + NLMISC::CEventServer _EventServer; + + /// event listener + NLMISC::IEventListener * _Listener; + + void release(); + +public: + + /// default constructor + CBlankInterface():_FontGenerator("c:/winnt/fonts/arialuni.ttf") + { + ScreenWidth = 0; + ScreenHeight = 0; + } + + /// init font manager, event server,... + virtual void init(NL3D::CScene * scene, uint w, uint h); + + /// destructor + virtual ~CBlankInterface() { release(); } + +}; + + + + + +#endif // NL_BLANK_INTERFACE_H + +/* End of blank_interface.h */ diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..e8e3c67d --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,12 @@ +#! /bin/sh + +set -x + +rm -f config.cache + +aclocal \ +&& libtoolize --force --copy \ +&& autoheader \ +&& automake --gnu --add-missing --copy \ +&& autoconf + diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..666c7d38 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/bootstrap?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,11 @@ +#! /bin/sh + +set -x + +rm -f config.cache + +aclocal \ +&& autoheader \ +&& automake --gnu --add-missing --copy \ +&& autoconf + diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..b61f812a --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,27 @@ + +#include <windows.h> +#include <gl/gl.h> + +#include "nel/misc/types_nl.h" +#include "login_interface.h" + + + +LogUserId login() +{ + CLoginInterface logscreen; + logscreen.init(800,600); + return logscreen.log(); +} + + +/****************************************************************\ + MAIN +\****************************************************************/ +void main() +{ + LogUserId id = login(); + // connect + // list + +}
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..ee0ac1ec --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,82 @@ + +#include <windows.h> +#include <gl/gl.h> + + +#include <string> +#include "nel/3d/driver.h" +#include "nel/misc/types_nl.h" +#include "login_interface.h" +#include "shards_list_interface.h" + + +CLogUserId login(NL3D::CScene * scene, uint w, uint h) +{ + CLoginInterface logscreen; + logscreen.init(scene, w, h); + return logscreen.log(); +} + +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() +{ + // 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); + + // release scene + NL3D::CSceneUt::release3d(scene); +}
\ No newline at end of file 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); +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.4&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.4&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..ff20c163 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.4&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,128 @@ + +#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 (CLogUserId &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; + // TEMPPP + 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 (); + + //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); +/* + CLogUserId id; + id.Login = 'c'; + id.Password = 'c'; +*/ + + // 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); +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..f23d09d6 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,127 @@ + +#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 (CLogUserId &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; + // TEMPPP + 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() +{ + //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); +/* + CLogUserId id; + id.Login = 'c'; + id.Password = 'c'; +*/ + + connectToLS (id); + + // connection // TEMP !! + std::vector<ucstring> shards = connect(id); + + // shard choice + uint shardIndex = chooseShard(&scene, w, h, shards); + + // release scene + NL3D::CSceneUt::release3d(scene); +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.6&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.6&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..65013a62 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.6&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,207 @@ +/** \file client.cpp + * Client prototype + * + * $Id: client.cpp,v 1.6 2000/11/23 15:36:14 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" +#include "nel/misc/i18n.h" + +#include "nel/net/msg_socket.h" +#include "nel/net/naming_client.h" +#include "nel/net/unitime.h" + +#include "nel/3d/driver.h" + +#include "language_interface.h" +#include "login_interface.h" +#include "shards_list_interface.h" + +#include <string> + +using namespace std; +using namespace NLNET; +using namespace NLMISC; +using namespace NL3D; + + + +/** + * login + */ +CLogUserId login(NL3D::CScene * scene, uint w, uint h) +{ + CLoginInterface logscreen; + logscreen.init(scene, w, h); + return logscreen.log(); +} + + +/** + * connect + */ + + +/** + * connectToLS + */ +bool connectToLS (CLogUserId &luid, vector<string>& shards) +{ + CInetAddress servaddr("vianneyl", 49999); + + CSocket server; + try + { + server.connect(servaddr); + } + catch(Exception e) + { + return false; + } + + 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; + uint i; + // TEMPPP + 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); + + if (ok) + { + uint32 nbshard, id; + msgin.serial (id); + msgin.serial (nbshard); + for (uint i = 0; i < nbshard; i++) + { + string shardip, shardname; + msgin.serial (shardip); + msgin.serial (shardname); + shards.push_back (shardip); + } + } + + server.close(); + if(ok) + return true; + else + return false; +} + + +/** + * chooseLanguage + */ +uint chooseLanguage(NL3D::CScene * scene, uint w, uint h) +{ + CLanguageInterface languageScreen; + languageScreen.init(scene, w, h); + return languageScreen.choose(); +} + + + +/** + * chooseShard + */ +uint chooseShard(NL3D::CScene * scene, uint w, uint h, + const std::vector<std::string>& shards) +{ + CShardsListInterface shardListScreen; + shardListScreen.init(scene, w, h, shards); + return shardListScreen.choose(); +} + + + + + +/****************************************************************\ + MAIN +\****************************************************************/ +void main() +{ + // synchronize time with server + CUniTime::syncUniTimeFromService(); + + // 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); + + + // language choice + uint languageIndex = chooseLanguage(&scene, w, h); + CI18N::load(languageIndex); + + //shard's name list + vector<string> shards; + + // user id (login & password) + CLogUserId id; + + // connection + bool connected = false; + bool goOn = true; + do + { + id = login(&scene, w, h); + connected = connectToLS (id,shards); + if(!connected) + { + IDriver::TMessageBoxId answer = + scene.getDriver()->systemMessageBox(CI18N::get("Can't establish connection").c_str(), + CI18N::get("user connection").c_str(), IDriver::retryCancelType, IDriver::errorIcon); + if(answer==IDriver::cancelId) goOn = false; + } + } + while(!connected && goOn); + + + // shard choice + if(connected) + uint shardIndex = chooseShard(&scene, w, h, shards); + + // release scene + NL3D::CSceneUt::release3d(scene); + + + +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.8&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.8&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..37604174 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.8&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,265 @@ +/** \file client.cpp + * Client prototype + * + * $Id: client.cpp,v 1.8 2000/11/24 14:17:35 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" +#include "nel/misc/i18n.h" + +#include "nel/net/msg_socket.h" +#include "nel/net/naming_client.h" +#include "nel/net/unitime.h" + +#include "nel/3d/driver.h" + +#include "language_interface.h" +#include "login_interface.h" +#include "shards_list_interface.h" + +#include <string> + +using namespace std; +using namespace NLNET; +using namespace NLMISC; +using namespace NL3D; + + +#ifdef NL_OS_WINDOWS +CFontGenerator fontGen("\\\\server\\code\\fonts\\arialuni.ttf"); +#else +CFontGenerator fontGen("arialuni.ttf"); +#endif + + +/** + * login + */ +CLogUserId login(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h) +{ + CLoginInterface logscreen(scene, fontGenerator, w, h); + return logscreen.log(); +} + + + +/** + * connectToLS + */ +bool connectToLS (CLogUserId &luid, vector<string>& shards) +{ + CInetAddress servaddr("vianneyl", 49999); + + CSocket server; + try + { + server.connect(servaddr); + } + catch(Exception) + { + return false; + } + + 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 = luid.Login.toString(), p = luid.Password.toString(); + 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); + + if (ok) + { + uint32 nbshard, id; + msgin.serial (id); + msgin.serial (nbshard); + for (uint i = 0; i < nbshard; i++) + { + string shardip, shardname; + msgin.serial (shardip); + msgin.serial (shardname); + shards.push_back (shardip); + } + } + + server.close(); + + return ok==1; +} + + +/** + * chooseLanguage + */ +sint chooseLanguage(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h) +{ + CLanguageInterface languageScreen(scene, fontGenerator, w, h); + return languageScreen.choose(); +} + + + +/** + * chooseShard + */ +sint chooseShard(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h, + const std::vector<std::string>& shards) +{ + CShardsListInterface shardListScreen(scene, fontGenerator, w, h, shards); + return shardListScreen.choose(); +} + + +enum TState +{ + LANGUAGE, + LOGIN, + CONNECT, + SHARD +}; + + +/****************************************************************\ + MAIN +\****************************************************************/ +void main() +{ + try + { + // 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); + + // synchronize time with server + CUniTime::syncUniTimeFromService(); + + // user id (login & password) + CLogUserId id; + + //shard's name list + vector<string> shards; + + // index of chard in the list + sint shardIndex; + + TState clientSate = LANGUAGE; + bool quit = false; + while(!quit) + { + switch(clientSate) + { + // language choice + case LANGUAGE: + { + sint languageIndex = chooseLanguage(&scene, &fontGen, w, h); + if(languageIndex==-1) + quit = true; + else + { + CI18N::load(languageIndex); + clientSate = LOGIN; + } + } + break; + + // get user's login and password + case LOGIN: + { + id = login(&scene, &fontGen, w, h); + if(id.Login.size()==0) // happens only if return back is asked + clientSate = LANGUAGE; + else + clientSate = CONNECT; + } + break; + + // connection + case CONNECT: + { + bool connected = connectToLS (id,shards); + if(!connected) + { + if(windowed) + { + IDriver::TMessageBoxId answer = + scene.getDriver()->systemMessageBox("Can't establish connection", + "user connection", IDriver::retryCancelType, IDriver::errorIcon); + if(answer==IDriver::cancelId) + clientSate = LOGIN; + else + clientSate = CONNECT; + } + else + clientSate = LOGIN; + } + else + clientSate = SHARD; + } + break; + + // shard choice + case SHARD: + { + shardIndex = chooseShard(&scene, &fontGen, w, h, shards); + if(shardIndex==-1) + clientSate = LOGIN; + else + quit = true; + } + break; + } + + if(quit) break; + } + + + // release scene + NL3D::CSceneUt::release3d(scene); + + } + catch(Exception &e) + { + nlerror ("main(): Exception trapped: %s", e.what ()); + } + +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..cf88fe72 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,185 @@ +/** \file client.cpp + * Client prototype + * + * $Id: client.cpp,v 1.9 2000/11/28 13:21:23 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" +#include "nel/misc/i18n.h" + +#include "nel/net/msg_socket.h" +#include "nel/net/naming_client.h" +#include "nel/net/unitime.h" + +#include "nel/3d/driver.h" + +#include "language_interface.h" +#include "login_interface.h" +#include "shards_list_interface.h" + +#include <string> + +using namespace std; +using namespace NLNET; +using namespace NLMISC; +using namespace NL3D; + + +#ifdef NL_OS_WINDOWS +CFontGenerator fontGen("\\\\server\\code\\fonts\\arialuni.ttf"); +#else +CFontGenerator fontGen("arialuni.ttf"); +#endif + + +/** + * login + */ +sint8 login(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h, vector<string>& shards) +{ + CLoginInterface logscreen(scene, fontGenerator, w, h); + return logscreen.log(shards); +} + + + +/** + * chooseLanguage + */ +sint chooseLanguage(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h) +{ + CLanguageInterface languageScreen(scene, fontGenerator, w, h); + return languageScreen.choose(); +} + + + +/** + * chooseShard + */ +sint chooseShard(NL3D::CScene * scene, + NL3D::CFontGenerator * fontGenerator, + uint w, uint h, + const std::vector<std::string>& shards) +{ + CShardsListInterface shardListScreen(scene, fontGenerator, w, h, shards); + return shardListScreen.choose(); +} + + +enum TState +{ + LANGUAGE, + LOGIN, + SHARD +}; + + +/****************************************************************\ + MAIN +\****************************************************************/ +void main() +{ + try + { + // init scene + uint w = 800; + uint h = 600; + uint bpp = 32; + bool windowed = false;//true; + NL3D::CScene scene; + NL3D::CSceneUt::init3d(scene, w, h, bpp, windowed); + + // synchronize time with server + CUniTime::syncUniTimeFromService(); + + // user id (login & password) + CLogUserId id; + + //shard's name list + vector<string> shards; + + // index of chard in the list + sint shardIndex; + + + TState clientState = LANGUAGE; + bool quit = false; + while(!quit) + { + switch(clientState) + { + // language choice + case LANGUAGE: + { + sint languageIndex = chooseLanguage(&scene, &fontGen, w, h); + if(languageIndex==-1) + quit = true; + else + { + CI18N::load(languageIndex); + clientState = LOGIN; + } + } + break; + + // get user's login and password + case LOGIN: + { + if(login(&scene, &fontGen, w, h, shards)) + clientState = SHARD; + else + clientState = LANGUAGE; + } + break; + + // shard choice + case SHARD: + { + shardIndex = chooseShard(&scene, &fontGen, w, h, shards); + if(shardIndex==-1) + clientState = LOGIN; + else + quit = true; + } + break; + } + + if(quit) break; + } + + + // release scene + NL3D::CSceneUt::release3d(scene); + + } + catch(Exception &e) + { + nlerror ("main(): Exception trapped: %s", e.what ()); + } + +} diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.txt?rev=1.2&content-type=text/plain&sortby=log/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.txt?rev=1.2&content-type=text/plain&sortby=log/index.html new file mode 100644 index 00000000..103279bd --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.txt?rev=1.2&content-type=text/plain&sortby=log/index.html @@ -0,0 +1,4 @@ +"english" +"Identification" = "<Not Translated>:Identification" +"Login :" = "<Not Translated>:Login :" +"Password :" = "<Not Translated>:Password :" diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..0c9f0142 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/english.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,4 @@ +"english"
+"Identification" = "<Not Translated>:Identification"
+"Login :" = "<Not Translated>:Login :"
+"Password :" = "<Not Translated>:Password :"
diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.txt?rev=1.2&content-type=text/plain&sortby=log/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.txt?rev=1.2&content-type=text/plain&sortby=log/index.html new file mode 100644 index 00000000..fe395e28 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.txt?rev=1.2&content-type=text/plain&sortby=log/index.html @@ -0,0 +1,4 @@ +"Français" +"Identification" = "Identification (Nöel œuvre)" +"Login :" = "Nom :" +"Password :" = "Môt de passe :" diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..c3cc4b7b --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,4 @@ +"Français"
+"Identification" = "Identification (Nöel œuvre)"
+"Login :" = "Nom :"
+"Password :" = "Môt de passe :"
diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..47c94e44 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/french.uxt?rev=1.5&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,5 @@ +"Français"
+"Identification" = "Identification"
+"Login :" = "Nom :"
+"Password :" = "Mot de passe :"
+
diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/fun.txt?rev=1.1&content-type=text/plain&sortby=log/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/fun.txt?rev=1.1&content-type=text/plain&sortby=log/index.html new file mode 100644 index 00000000..af5b8b89 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/fun.txt?rev=1.1&content-type=text/plain&sortby=log/index.html @@ -0,0 +1,4 @@ +"讋讍譯譭" +"Identification" = "ﶰﶴﶚﶍ" +"Login :" = "푦푆퐭쎫钀 :" +"Password :" = "ພຕຂ๚ :" diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/german.txt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/german.txt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..0fba0a87 --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/german.txt?rev=1.1&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,6 @@ +"Deutch" +"user connection" = "<Not Translated>:user connection" +"Can't establish connection" = "<Not Translated>:Can't establish connection" +"Identification" = "<Not Translated>:Identification" +"Login :" = "<Not Translated>:Login :" +"Password :" = "<Not Translated>:Password :" diff --git a/cvs/cvsweb.cgi/~checkout~/code/client/Attic/move_listener.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/move_listener.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..8fc3444c --- /dev/null +++ b/cvs/cvsweb.cgi/~checkout~/code/client/Attic/move_listener.h?rev=1.2&content-type=text/plain&hideattic=0&sortby=date/index.html @@ -0,0 +1,163 @@ +/** \file move_listener.h + * <File description> + * + * $Id: move_listener.h,v 1.2 2000/12/04 17:58:09 coutelas Exp $ + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_MOVE_LISTENER_H +#define NL_MOVE_LISTENER_H + +#include "nel/misc/types_nl.h" +#include "nel/misc/event_listener.h" +#include "nel/misc/matrix.h" +#include "nel/3d/viewport.h" +#include "nel/3d/scene.h" +#include "nel/3d/camera.h" + + + +namespace NL3D +{ + + +/** + * CMoveListener is a listener that handle a 3d matrix with mouse events. + * \author Stephane Coutelas + * \author Nevrax France + * \date 2000 + */ +class CMoveListener : public NLMISC::IEventListener +{ +public: + + /** + * TMoveMode. + * moving modes + */ + enum TMoveMode + { + WALK, + FREE + }; + + /** + * Constructor. + * You should call init then. + */ + CMoveListener(); + + + /** + * Constructor. + * You should call init then. + * \param scene the scene + * \param w screen width in pixels + * \param h screen height in pixels + * \param camera the camera + */ + void init(CScene * scene, uint w, uint h, const class CCamera& camera) + { + _Scene = scene; + _Width = w; + _Height = h; + + _Viewport = scene->getViewport(); + + float dummy; + _ViewMatrix = camera.getMatrix (); + camera.getFrustum (_Left, _Right, _Bottom, _Top, _Depth, dummy); + } + + /** + * Set the moving mode + * \param m the moving mode + */ + void setMode(TMoveMode m) + { + _Mode = m; + } + + /** + * Register the listener to the server. + */ + void addToServer (NLMISC::CEventServer& server); + + /** + * Unregister the listener to the server. + */ + void removeFromServer (NLMISC::CEventServer& server); + + +private: + + /// Internal use + virtual void operator()(const NLMISC::CEvent& event); + + /// moving mode + TMoveMode _Mode; + + /// view matrix + NLMISC::CMatrix _ViewMatrix; + + /// viewport + NL3D::CViewport _Viewport; + + /// true if previous mouse move event was re-centering cursor + bool _CursorReset; + + CScene * _Scene; + + /// screen width + uint _Width; + + /// screen height + uint _Height; + + ///frustum parameters + float _Top; + float _Bottom; + float _Left; + float _Right; + float _Depth; + + /// current position + CVector _Pos; + + ///current rotation z angle + float _RotZ; + + ///current rotation x angle + float _RotX; + + /// step for translation + static const float _StepTrans; + + /// step for rotation + static const float _StepRot; + +}; // NL3D + +} + +#endif // NL_MOVE_LISTENER_H + +/* End of move_listener.h */ |