aboutsummaryrefslogtreecommitdiff
path: root/cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html')
-rw-r--r--cvs/cvsweb.cgi/~checkout~/code/client/Attic/client.cpp?rev=1.9&content-type=text/plain&hideattic=0&sortby=date/index.html185
1 files changed, 185 insertions, 0 deletions
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 ());
+ }
+
+}